mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 299458 - Small fixes to formatException and isinstance.
ChatZilla only. r=samuel
This commit is contained in:
parent
5c886e9864
commit
a9a4284cd2
@ -316,11 +316,18 @@ function replaceVars(str, vars)
|
||||
return str.replace(/(\$\w[\w\d\-]+)/g, doReplace);
|
||||
}
|
||||
|
||||
function formatException (ex)
|
||||
function formatException(ex)
|
||||
{
|
||||
if (ex instanceof Error)
|
||||
return getMsg (MSG_FMT_JSEXCEPTION, [ex.name, ex.message, ex.fileName,
|
||||
ex.lineNumber]);
|
||||
if (isinstance(ex, Error))
|
||||
{
|
||||
return getMsg(MSG_FMT_JSEXCEPTION, [ex.name, ex.message, ex.fileName,
|
||||
ex.lineNumber]);
|
||||
}
|
||||
if ((typeof ex == "object") && ("filename" in ex))
|
||||
{
|
||||
return getMsg(MSG_FMT_JSEXCEPTION, [ex.name, ex.message, ex.filename,
|
||||
ex.lineNumber]);
|
||||
}
|
||||
|
||||
return String(ex);
|
||||
}
|
||||
@ -1135,8 +1142,9 @@ function isinstance(inst, base)
|
||||
* 254067 which makes instanceof fail if the two sides are 'from'
|
||||
* different windows (something we don't care about).
|
||||
*/
|
||||
return (inst && inst.constructor && base &&
|
||||
(inst.constructor.name == base.name));
|
||||
return (inst && base &&
|
||||
((inst instanceof base) ||
|
||||
(inst.constructor && (inst.constructor.name == base.name))));
|
||||
}
|
||||
|
||||
function scaleNumberBy1024(number)
|
||||
|
Loading…
Reference in New Issue
Block a user