Make exception handler static named function.

This commit is contained in:
Chad Weider 2012-05-28 12:15:22 -07:00
parent bd07589e0f
commit 723f75b016

View file

@ -500,11 +500,7 @@ var padutils = {
} }
}; };
var globalExceptionHandler = undefined; function globalExceptionHandler(msg, url, linenumber) {
function setupGlobalExceptionHandler() {
if (!globalExceptionHandler) {
globalExceptionHandler = function test (msg, url, linenumber)
{
var errorId = randomString(20); var errorId = randomString(20);
if ($("#editorloadingbox").attr("display") != "none"){ if ($("#editorloadingbox").attr("display") != "none"){
//show javascript errors to the user //show javascript errors to the user
@ -522,8 +518,16 @@ function setupGlobalExceptionHandler() {
$.post(url, errObj); $.post(url, errObj);
return false; return false;
}; }
var globalExceptionHandlerSetup = false;
function setupGlobalExceptionHandler() {
if (!globalExceptionHandlerSetup) {
globalExceptionHandlerSetup = true;
window.onerror = globalExceptionHandler; window.onerror = globalExceptionHandler;
} else {
// no-op
// TODO: Throw an exception here.
} }
} }