mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-10 09:58:30 +00:00
Bug 1256364. If we have an exception stack in the onerror handler in SimpleTest, include it in the error message. r=jmaher
This commit is contained in:
parent
d78dc504bd
commit
95bb8802ec
@ -1526,7 +1526,8 @@ var isDeeply = SimpleTest.isDeeply;
|
|||||||
var info = SimpleTest.info;
|
var info = SimpleTest.info;
|
||||||
|
|
||||||
var gOldOnError = window.onerror;
|
var gOldOnError = window.onerror;
|
||||||
window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
window.onerror = function simpletestOnerror(errorMsg, url, lineNumber,
|
||||||
|
columnNumber, originalException) {
|
||||||
// Log the message.
|
// Log the message.
|
||||||
// XXX Chrome mochitests sometimes trigger this window.onerror handler,
|
// XXX Chrome mochitests sometimes trigger this window.onerror handler,
|
||||||
// but there are a number of uncaught JS exceptions from those tests.
|
// but there are a number of uncaught JS exceptions from those tests.
|
||||||
@ -1535,7 +1536,13 @@ window.onerror = function simpletestOnerror(errorMsg, url, lineNumber) {
|
|||||||
// a test failure. See bug 652494.
|
// a test failure. See bug 652494.
|
||||||
var isExpected = !!SimpleTest._expectingUncaughtException;
|
var isExpected = !!SimpleTest._expectingUncaughtException;
|
||||||
var message = (isExpected ? "expected " : "") + "uncaught exception";
|
var message = (isExpected ? "expected " : "") + "uncaught exception";
|
||||||
var error = errorMsg + " at " + url + ":" + lineNumber;
|
var error = errorMsg + " at ";
|
||||||
|
try {
|
||||||
|
error += originalException.stack;
|
||||||
|
} catch (e) {
|
||||||
|
// At least use the url+line+column we were given
|
||||||
|
error += url + ":" + lineNumber + ":" + columnNumber;
|
||||||
|
}
|
||||||
if (!SimpleTest._ignoringAllUncaughtExceptions) {
|
if (!SimpleTest._ignoringAllUncaughtExceptions) {
|
||||||
// Don't log if SimpleTest.finish() is already called, it would cause failures
|
// Don't log if SimpleTest.finish() is already called, it would cause failures
|
||||||
if (!SimpleTest._alreadyFinished)
|
if (!SimpleTest._alreadyFinished)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user