diff options
author | Christian Schneider | 2009-11-17 14:56:39 +0000 |
---|---|---|
committer | Christian Schneider | 2009-11-17 14:56:39 +0000 |
commit | f6dee426b69cf8225c2a2511bb73a8977866137c (patch) | |
tree | e607c7e0c943034bd13f86a2619eaf3c760cbb9b | |
parent | 16fcdf0efab6726c2f4b80d827490ea22c7430d5 (diff) | |
download | itools-f6dee426b69cf8225c2a2511bb73a8977866137c.tar.gz itools-f6dee426b69cf8225c2a2511bb73a8977866137c.tar.bz2 itools-f6dee426b69cf8225c2a2511bb73a8977866137c.zip |
Added start/end marker and cut off prepended and appended stuff (Swisslife)
-rw-r--r-- | itjs.php | 2 | ||||
-rw-r--r-- | itjs/boot.js | 10 |
2 files changed, 6 insertions, 6 deletions
@@ -70,7 +70,7 @@ if ($checksum != $_SERVER['HTTP_IF_NONE_MATCH']) if ($_REQUEST['boot']) { $data .= "window.it_boot_init();\n"; - $data .= sprintf("/*sln:% 8d*/", strlen($data) + 16); + $data = sprintf("/*sln:%d*/\n%s/*eln:%d*/", strlen($data), $data, strlen($data)); } echo it_untaint($data); diff --git a/itjs/boot.js b/itjs/boot.js index 0d9a737..6ee8845 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -197,20 +197,20 @@ function it_boot(file, isretry) if (loader.status < 400) // Opera gives back 304 if from cache { // check length cookie - var ln = String(loader.responseText).substr(-16).match(/\*sln:\s*([0-9]+)\*/); - code = loader.responseText; - if (ln && ln[1]-0 == loader.responseText.length) + var ln = String(loader.responseText).match(/\*sln:([0-9]+)[^\n]*\n([\s\S]*\n)\/\*eln:\1/); + code = ln ? ln[2] : loader.responseText; + if (ln && ln[1]-0 == code.length) { it_boot.sequence += "e"; if (!window.env || !!window.env.is_live_server) - 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 + code = "try {" + code + "} 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 = (ln ? "length mismatch: "+ln[1]+" != "+loader.responseText.length : "no length cookie"); + error = (ln ? "length mismatch: " + ln[1] + " != " + code.length : "no length cookie"); } else error = loader.statusText; |