Ticket #5398: loadererror.patch

File loadererror.patch, 1.5 kB (added by jburke, 5 months ago)

Patch by James to break out script attachment into firebug module.

  • _firebug/firebug.js

     
    3535        console.debug(message); 
    3636} 
    3737 
     38dojo.loaderParseError = function(/*String*/url, /*Object*/error){ 
     39        //summary: handles cases when the XHR-loaded, evaled module file fails. 
     40        //Attach a script node so browser reports the error line correctly. 
     41         
     42        var s = dojo.doc.createElement("script"); 
     43        s.type = "text/javascript"; 
     44        s.src = url; 
     45        var head = dojo.doc.getElementsByTagName("head")[0]; 
     46        if(!head){ 
     47                //Some HTML4 cases in some browsers do not have head element. 
     48                head = document.getElementsByTagName("html")[0]; 
     49        } 
     50        head.appendChild(s); 
     51} 
     52 
    3853// FIREBUG LITE 
    3954        // summary: Firebug Lite, the baby brother to Joe Hewitt's Firebug for Mozilla Firefox 
    4055        // description: 
  • _base/_loader/loader.js

     
    108108                        //it is most likely the i18n bundle stuff. 
    109109                        contents = this._scopePrefix + contents + this._scopeSuffix; 
    110110                } 
    111                 var value = d["eval"](contents+"\r\n//@ sourceURL="+uri); 
     111 
     112                try{ 
     113                        var value = d["eval"](contents+"\r\n//@ sourceURL="+uri); 
     114                }catch(e){ 
     115                        if(d.loaderParseError){ 
     116                                d.loaderParseError(uri, e); 
     117                        }else{ 
     118                                throw e; 
     119                        } 
     120                } 
    112121                if(cb){ cb(value); } 
    113122                return true; // Boolean 
    114123        }