diff options
-rw-r--r-- | itjs.php | 5 | ||||
-rw-r--r-- | itjs/boot.js | 20 |
2 files changed, 8 insertions, 17 deletions
@@ -44,7 +44,10 @@ if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH']) header("Cache-Control: max-age=900"); if ($_REQUEST['boot']) - $data .= "window.it_boot_init();"; + { + $data .= "window.it_boot_init();\n"; + $data .= sprintf("/*sln:% 8d*/", strlen($data) + 16); + } echo itjs::strip($data); } diff --git a/itjs/boot.js b/itjs/boot.js index 726bcd2..2efa18a 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -6,13 +6,6 @@ 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) @@ -67,7 +60,6 @@ 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; @@ -96,7 +88,6 @@ 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,10 +114,11 @@ function it_boot(file, isretry) { if (loader.status < 400) // Opera gives back 304 if from cache { - if (loader.responseText.length && loader.responseText.lastIndexOf('it_boot_init()') > 0) + // check length cookie + var ln = String(loader.responseText).substr(-16).match(/\*sln:\s*([0-9]+)\*/); + if (ln && ln[1]-0 == loader.responseText.length) { it_boot.sequence += "e"; - 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 @@ -134,11 +126,7 @@ function it_boot(file, isretry) window.setTimeout(code, 0); // Standard compliant version } else - { - error = "Incomplete script @ status " + loader.status; - if (!isretry) // send notification for analyzing - new Image().src = "/itjs/error.gif/" + escape(error) + "|" + escape(file) + "|-1|" + (new Date().getTime() - it_catcherrstart) + "|"; - } + error = (ln ? "length mismatch: "+ln[1]+" != "+loader.responseText.length : "no length cookie"); } else error = loader.statusText; |