mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
- Add stacktrace support for IE.
This commit is contained in:
parent
69912ecef4
commit
022e3d982a
@ -29,21 +29,30 @@ Math.sign = function (value) {
|
|||||||
return (value >= 0) ? 1 : -1;
|
return (value >= 0) ? 1 : -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
function stackTrace() {
|
function stackTrace(exception) {
|
||||||
var result = "";
|
|
||||||
var isCallstackPopulated = false;
|
if (!$defined(exception)) {
|
||||||
try {
|
try {
|
||||||
null.eval();
|
throw "Dummy Exception"
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.stack) { //Firefox and Chrome...
|
exception = e;
|
||||||
result = e.stack;
|
|
||||||
isCallstackPopulated = true;
|
|
||||||
}
|
|
||||||
else if (window.opera && e.message) { //Opera
|
|
||||||
result = e.message;
|
|
||||||
isCallstackPopulated = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var result = "";
|
||||||
|
if (exception.stack) { //Firefox and Chrome...
|
||||||
|
result = exception.stack;
|
||||||
|
}
|
||||||
|
else if (window.opera && exception.message) { //Opera
|
||||||
|
result = exception.message;
|
||||||
|
} else { //IE and Safari
|
||||||
|
var currentFunction = arguments.callee.caller;
|
||||||
|
while (currentFunction) {
|
||||||
|
var fn = currentFunction.toString();
|
||||||
|
result = result + "\n" + fn;
|
||||||
|
currentFunction = currentFunction.caller;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user