mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
rm stacktrace.js!
--HG-- extra : rebase_source : ee145386d3b3836f0c02005c1f4f7ef517377b7e
This commit is contained in:
parent
49b66e7e06
commit
5715d04263
@ -570,19 +570,22 @@ var Utils = {
|
||||
// Pass as many arguments as you want, it'll print them all.
|
||||
trace: function() {
|
||||
var text = this.expandArgumentsForLog(arguments);
|
||||
if (typeof(printStackTrace) != 'function')
|
||||
this.log(text + ' trace: you need to include stacktrace.js');
|
||||
else {
|
||||
var calls = printStackTrace();
|
||||
calls.splice(0, 3); // Remove this call and the printStackTrace calls
|
||||
this.log('trace: ' + text + '\n' + calls.join('\n'));
|
||||
try { // coerce an error
|
||||
throw new Error("error");
|
||||
} catch (e) {
|
||||
// cut off the first two lines of the stack trace, because they're just this function.
|
||||
var stack = e.stack.replace(/^.*?\n.*?\n/,'');
|
||||
// if the caller was assert, cut out the line for the assert function as well.
|
||||
if (this.trace.caller.name == 'Utils_assert')
|
||||
stack = stack.replace(/^.*?\n/,'');
|
||||
this.log('trace: ' + text + '\n' + stack);
|
||||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: assert
|
||||
// Prints a stack trace along with label (as a console message) if condition is false.
|
||||
assert: function(label, condition) {
|
||||
assert: function Utils_assert(label, condition) {
|
||||
if (!condition) {
|
||||
var text;
|
||||
if (typeof(label) == 'undefined')
|
||||
@ -590,11 +593,6 @@ var Utils = {
|
||||
else
|
||||
text = 'tabcandy assert: ' + label;
|
||||
|
||||
if (typeof(printStackTrace) == 'function') {
|
||||
var calls = printStackTrace();
|
||||
text += '\n' + calls[3];
|
||||
}
|
||||
|
||||
this.trace(text);
|
||||
}
|
||||
},
|
||||
@ -610,10 +608,11 @@ var Utils = {
|
||||
else
|
||||
text = 'tabcandy assert: ' + label;
|
||||
|
||||
if (typeof(printStackTrace) == 'function') {
|
||||
var calls = printStackTrace();
|
||||
calls.splice(0, 3); // Remove this call and the printStackTrace calls
|
||||
text += '\n' + calls.join('\n');
|
||||
try { // coerce an error
|
||||
throw new Error("error");
|
||||
} catch (e) {
|
||||
// cut off the first two lines of the stack trace, because they're just this function.
|
||||
text += e.stack.replace(/^.*?\n.*?\n/,'');
|
||||
}
|
||||
|
||||
throw text;
|
||||
|
Loading…
Reference in New Issue
Block a user