Changeset 13356

Show
Ignore:
Timestamp:
04/18/08 18:29:11 (7 months ago)
Author:
alex
Message:

ensure that DOH correctly loads _browserRunner.js when pages don't include Dojo. Fixes #6565. !strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/trunk/doh/runner.js

    r13290 r13356  
    1616 
    1717doh.selfTest = false; 
     18 
     19doh.global = this; 
    1820 
    1921doh.hitch = function(/*Object*/thisObject, /*Function|String*/method /*, ...*/){ 
     
    131133                return function(){ 
    132134                        try{ 
    133                                 cb.apply(scope||dojo.global||_this, arguments); 
     135                                cb.apply(scope||doh.global||_this, arguments); 
    134136                        }catch(e){ 
    135137                                _this.errback(e); 
     
    146148                                return a[0]; 
    147149                        }else if(typeof a[0] == "string"){ 
    148                                 return dojo.global[a[0]]; 
     150                                return doh.global[a[0]]; 
    149151                        } 
    150152                }else if((a[0])&&(a[1])){ 
     
    866868 
    867869(function(){ 
    868         // scop protection 
     870        // scope protection 
    869871        try{ 
    870872                if(typeof dojo != "undefined"){ 
     
    905907                                throw new Error(); 
    906908                        } 
     909 
     910                        if(this["document"]){ 
     911                                // if we survived all of that, we're probably in a browser but 
     912                                // don't have Dojo handy. Load _browserRunner.js using a 
     913                                // document.write() call. 
     914 
     915                                // find runner.js, load _browserRunner relative to it 
     916                                var scripts = document.getElementsByTagName("script"); 
     917                                for(var x=0; x<scripts.length; x++){ 
     918                                        var s = scripts[x].src; 
     919                                        if(s && (s.substr(-9) == "runner.js")){ 
     920                                                document.write("<scri"+"pt src='"+s.substr(0, s.length-9)+"_browserRunner.js' type='text/javascript'></scr"+"ipt>"); 
     921                                        } 
     922                                } 
     923                        } 
    907924                } 
    908925        }catch(e){