From 0d050f9631d411cd4bdec0a26a9d005349464395 Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Mon, 10 Sep 2007 10:01:58 +0000 Subject: Flags to locate script errors --- itjs/boot.js | 10 ++++++++++ itjs/loader.js | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/itjs/boot.js b/itjs/boot.js index 311f28e..32c8578 100644 --- a/itjs/boot.js +++ b/itjs/boot.js @@ -20,6 +20,11 @@ function it_catcherr(msg, url, line) } } + if (typeof it_boot.sequence != 'undefined') + stacktrace += "it_boot=" + it_boot.sequence + ";"; + if (typeof window.it_loader != 'undefined') + stacktrace += "it_loader=" + it_loader.sequence + ";"; + it_boot_report(msg, url, line, stacktrace); return !window.env || !!window.env.is_live_server; // No env or live server -> suppress error @@ -87,6 +92,8 @@ function it_boot_init() function it_boot(file, isretry) { + it_boot.sequence = isretry ? "r" : "b"; + try { var loader = new XMLHttpRequest(); @@ -112,11 +119,14 @@ 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 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 + + window.setTimeout('it_boot.sequence = "";', 50); } else error = "Incomplete script load @ status " + loader.status; diff --git a/itjs/loader.js b/itjs/loader.js index 6efdbee..3735bca 100644 --- a/itjs/loader.js +++ b/itjs/loader.js @@ -165,6 +165,7 @@ post: function(baseurl, data) readyStateChanged: function() { var loader = this.loader; // Avoid race conditions + it_loader.sequence += "r"; if (loader && (loader.readyState == 4)) { @@ -199,6 +200,7 @@ dataReady: function(data, callid) { var fixkonqueror33gcbug = this.loader; var loadtime = new Date().getTime() - this.starttime; + it_loader.sequence += "e"; this.loader = null; @@ -228,6 +230,8 @@ dataReady: function(data, callid) if (!this.attr.eof && (this.end < this.pos + this.num)) this.load(this.baseurl, this.end, this.pos + this.num - this.end); + + it_loader.sequence += "h"; } this.unlink(); @@ -257,10 +261,12 @@ unlink: function() document.body.removeChild(this.scrpt); this.scrpt = null; } + + it_loader.sequence = ""; }/* NO COMMA */ } // static properties it_loader.instances = 0; - +it_loader.sequence = ""; -- cgit v1.2.3