зеркало из https://github.com/mozilla/pjs.git
Bug 494397 - SimpleTest.js |window.onerror| calls |SimpleTest.finish()| while test is still running; (Av1) Tabs cleanup, Improve+Add error messages, Use executeSoon(); r=rcampbell
This commit is contained in:
Родитель
0215b1d90f
Коммит
4364915d15
|
@ -180,9 +180,9 @@ SimpleTest.showReport = function() {
|
|||
toggleTodo.onclick = partial(SimpleTest.toggleByClass, 'test_todo');
|
||||
var body = document.body; // Handles HTML documents
|
||||
if (!body) {
|
||||
// Do the XML thing
|
||||
// Do the XML thing.
|
||||
body = document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml",
|
||||
"body")[0]
|
||||
"body")[0];
|
||||
}
|
||||
var firstChild = body.childNodes[0];
|
||||
var addNode;
|
||||
|
@ -464,17 +464,24 @@ var todo = SimpleTest.todo;
|
|||
var todo_is = SimpleTest.todo_is;
|
||||
var todo_isnot = SimpleTest.todo_isnot;
|
||||
var isDeeply = SimpleTest.isDeeply;
|
||||
var oldOnError = window.onerror;
|
||||
|
||||
const oldOnError = window.onerror;
|
||||
window.onerror = function (ev) {
|
||||
is(0, 1, "Error thrown during test: " + ev);
|
||||
// Log the error.
|
||||
ok(false, "[SimpleTest/SimpleTest.js, window.onerror] An error occurred: [ " + ev + " ]");
|
||||
|
||||
// Call previous handler.
|
||||
if (oldOnError) {
|
||||
try {
|
||||
oldOnError(ev);
|
||||
} catch (e) {
|
||||
// Log the exception.
|
||||
ok(false, "[SimpleTest/SimpleTest.js, window.onerror] Exception thrown by oldOnError(): [ " + e + " ]");
|
||||
}
|
||||
}
|
||||
if (SimpleTest._stopOnLoad == false) {
|
||||
// Need to finish() manually here
|
||||
SimpleTest.finish();
|
||||
|
||||
if (!SimpleTest._stopOnLoad) {
|
||||
// Need to finish() manually here, yet let the test actually end first.
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче