зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1109608 - Log.stackTrace should use human-readable task stack traces if available. r=Yoric
This commit is contained in:
Родитель
6640ced2a6
Коммит
fc99a1c828
|
@ -194,8 +194,8 @@ this.Log = {
|
|||
}
|
||||
// Standard JS exception
|
||||
if (e.stack) {
|
||||
return "JS Stack trace: " + e.stack.trim().replace(/\n/g, " < ").
|
||||
replace(/@[^@]*?([^\/\.]+\.\w+:)/g, "@$1");
|
||||
return "JS Stack trace: " + Task.Debugging.generateReadableStack(e.stack).trim()
|
||||
.replace(/\n/g, " < ").replace(/@[^@]*?([^\/\.]+\.\w+:)/g, "@$1");
|
||||
}
|
||||
|
||||
return "No traceback available";
|
||||
|
|
|
@ -6,6 +6,7 @@ const {utils: Cu} = Components;
|
|||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
Cu.import("resource://gre/modules/Promise.jsm")
|
||||
Cu.import("resource://gre/modules/Log.jsm");
|
||||
|
||||
let testFormatter = {
|
||||
|
@ -573,6 +574,7 @@ add_task(function format_errors() {
|
|||
|
||||
// Test that JS-generated Errors are recognized and formatted.
|
||||
try {
|
||||
yield Promise.resolve(); // Scrambles the stack
|
||||
eval("javascript syntax error");
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -581,5 +583,10 @@ add_task(function format_errors() {
|
|||
// Make sure we identified it as an Error and formatted the error location as
|
||||
// lineNumber:columnNumber.
|
||||
do_check_true(str.contains(":1:11)"));
|
||||
// Make sure that we use human-readable stack traces
|
||||
// Check that the error doesn't contain any reference to "Promise.jsm" or "Task.jsm"
|
||||
do_check_false(str.contains("Promise.jsm"));
|
||||
do_check_false(str.contains("Task.jsm"));
|
||||
do_check_true(str.contains("format_errors"));
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче