summaryrefslogtreecommitdiff
path: root/itjs/boot.js
diff options
context:
space:
mode:
Diffstat (limited to 'itjs/boot.js')
-rw-r--r--itjs/boot.js30
1 files changed, 17 insertions, 13 deletions
diff --git a/itjs/boot.js b/itjs/boot.js
index 59652e7..c2c7f31 100644
--- a/itjs/boot.js
+++ b/itjs/boot.js
@@ -6,6 +6,13 @@ var it_catcherrstart = new Date().getTime();
function it_catcherr(msg, url, line)
{
+ // retry it_boot if failed
+ if (it_boot.doretry)
+ {
+ it_boot(it_boot.file, true);
+ return false;
+ }
+
var stacktrace = "";
for (var c = it_catcherr.caller; c != null; c = c.caller)
@@ -22,7 +29,7 @@ function it_catcherr(msg, url, line)
if (typeof it_boot.sequence != 'undefined')
stacktrace += "it_boot=" + it_boot.sequence + ";";
- if (typeof window.it_loader != 'undefined')
+ if (typeof window.it_loader != 'undefined' && it_loader.sequence)
stacktrace += "it_loader=" + it_loader.sequence + ";";
it_boot_report(msg, url, line, stacktrace);
@@ -42,21 +49,14 @@ function it_panic(msg)
if (!document.location.href.match(/[?&]static=/)) // Avoid loop
window.setTimeout("document.location.href = it_boot_addparam(document.location.href, 'static=" + msg + "')", 500);
- return it_catcherr('panic ' + msg, '-', -1);
+ return it_boot_report('panic ' + msg, '-', -1, '');
}
-function it_boot_report(msg, file, line, error)
+function it_boot_report(msg, file, line, more)
{
window.clearTimeout(window.it_domtimer);
window.clearTimeout(window.it_panictimer);
- var more = "";
- if (error && typeof error == 'object')
- for (var k in error)
- more += k + "=" + error[k] + ";";
- else
- more = error;
-
new Image().src = "/itjs/error.gif/" + escape(msg) + "|" + escape(file) + "|" + line + "|" + (new Date().getTime() - it_catcherrstart) + "|" + escape(more);
}
@@ -67,6 +67,7 @@ function it_boot_checkcss(style, key, value)
function it_boot_init()
{
+ it_boot.doretry = false;
window.it_domtimer = null;
var konqueror = navigator.userAgent.match(/konqueror/i);
var doc = document;
@@ -94,6 +95,8 @@ function it_boot_init()
function it_boot(file, isretry)
{
+ it_boot.file = file;
+ it_boot.doretry = false;
it_boot.sequence = isretry ? "r" : "b";
try
@@ -123,14 +126,15 @@ function it_boot(file, isretry)
if (loader.responseText.length && loader.responseText.lastIndexOf('it_boot_init()') > 0)
{
it_boot.sequence += "e";
- var code = "try {" + loader.responseText + "} catch (e) { it_boot_report('Script exec error', '-', -1, e); }"; // Wrapped in try/catch as Konqueror does not support window.onerror
+ it_boot.doretry = !isretry;
+ var code = "try {" + loader.responseText + "} catch (e) { it_catcherr(e.message, it_boot.file, -1); }"; // Wrapped in try/catch as Konqueror does not support window.onerror
if (window.execScript)
window.execScript(code, "javascript"); // IE work-around to get script executed in global scope
else
window.setTimeout(code, 0); // Standard compliant version
}
else
- error = "Incomplete script load @ status " + loader.status;
+ error = "Incomplete script @ status " + loader.status;
}
else
error = loader.statusText;
@@ -138,7 +142,7 @@ function it_boot(file, isretry)
if (error)
{
if (isretry)
- it_boot_report('Load error on retry', file, -1, error);
+ it_panic('load: ' + error);
else
it_boot(file, true);
}