зеркало из https://github.com/mozilla/pjs.git
Bug 511888 - SimpleTest/SimpleTest.js: report stack too in |window.onerror|; (Bv1) additional nits; r=rcampbell
This commit is contained in:
Родитель
50f131fb4d
Коммит
4d9b7e5a17
|
@ -464,7 +464,7 @@ var todo_is = SimpleTest.todo_is;
|
||||||
var todo_isnot = SimpleTest.todo_isnot;
|
var todo_isnot = SimpleTest.todo_isnot;
|
||||||
var isDeeply = SimpleTest.isDeeply;
|
var isDeeply = SimpleTest.isDeeply;
|
||||||
|
|
||||||
const oldOnError = window.onerror;
|
const gOldOnError = window.onerror;
|
||||||
window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
||||||
var funcIdentifier = "[SimpleTest/SimpleTest.js, window.onerror] ";
|
var funcIdentifier = "[SimpleTest/SimpleTest.js, window.onerror] ";
|
||||||
|
|
||||||
|
@ -473,12 +473,13 @@ window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
||||||
// There is no Components.stack.caller to log. (See bug 511888.)
|
// There is no Components.stack.caller to log. (See bug 511888.)
|
||||||
|
|
||||||
// Call previous handler.
|
// Call previous handler.
|
||||||
if (oldOnError) {
|
if (gOldOnError) {
|
||||||
try {
|
try {
|
||||||
oldOnError(errorMsg, url, lineNumber);
|
// Ignore return value: always run default handler.
|
||||||
|
gOldOnError(errorMsg, url, lineNumber);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Log the error.
|
// Log the error.
|
||||||
ok(false, funcIdentifier + "Exception thrown by oldOnError()", e);
|
ok(false, funcIdentifier + "Exception thrown by gOldOnError()", e);
|
||||||
// Log its stack.
|
// Log its stack.
|
||||||
if (e.stack)
|
if (e.stack)
|
||||||
ok(false, funcIdentifier + "JavaScript error stack:\n" + e.stack);
|
ok(false, funcIdentifier + "JavaScript error stack:\n" + e.stack);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче