diff options
| author | Thomas BrĂ¼derli | 2007-10-02 12:34:59 +0000 | 
|---|---|---|
| committer | Thomas BrĂ¼derli | 2007-10-02 12:34:59 +0000 | 
| commit | 8ddceef470edc16669317965cee69982ff0c6e35 (patch) | |
| tree | 79ed08cbc8ec8114145407c6cb13e369a337f446 /itjs | |
| parent | bbaf65234fc69effce584b6e6b89173693ad907a (diff) | |
| download | itools-8ddceef470edc16669317965cee69982ff0c6e35.tar.gz itools-8ddceef470edc16669317965cee69982ff0c6e35.tar.bz2 itools-8ddceef470edc16669317965cee69982ff0c6e35.zip | |
Check script length with comment cookie
Diffstat (limited to 'itjs')
| -rw-r--r-- | itjs/boot.js | 20 | 
1 files changed, 4 insertions, 16 deletions
| 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; |