]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/_base/_loader/hostenv_rhino.js
upgrade Dojo to 1.6.1
[tt-rss.git] / lib / dojo / _base / _loader / hostenv_rhino.js
index ee9ad8b4339ee77982a31ce85648774c861b705f..e3aa78524118133d9da88817907fb01025d8af07 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+       Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
        Available via Academic Free License >= 2.1 OR the modified BSD license.
        see: http://dojotoolkit.org/license for details
 */
@@ -58,6 +58,9 @@ dojo._isLocalUrl = function(/*String*/ uri) {
 
 // see comments in spidermonkey loadUri
 dojo._loadUri = function(uri, cb){
+       if(dojo._loadedUrls[uri]){
+               return true; // Boolean
+       }
        try{
                var local;
                try{
@@ -67,29 +70,32 @@ dojo._loadUri = function(uri, cb){
                        return false;
                }
 
+               dojo._loadedUrls[uri] = true;
                //FIXME: Use Rhino 1.6 native readFile/readUrl if available?
                if(cb){
                        var contents = (local ? readText : readUri)(uri, "UTF-8");
 
                        // patch up the input to eval until https://bugzilla.mozilla.org/show_bug.cgi?id=471005 is fixed.
                        if(!eval("'\u200f'").length){
-                               contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){ 
-                                       return "\\u" + match.charCodeAt(0).toString(16); 
+                               contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
+                                       return "\\u" + match.charCodeAt(0).toString(16);
                                })
                        }
-
-                       cb(eval('('+contents+')'));
+                       contents = /^define\(/.test(contents) ? contents : '('+contents+')';
+                       cb(eval(contents));
                }else{
                        load(uri);
                }
+               dojo._loadedUrls.push(uri);
                return true;
        }catch(e){
+               dojo._loadedUrls[uri] = false;
                console.debug("rhino load('" + uri + "') failed. Exception: " + e);
                return false;
        }
 }
 
-dojo.exit = function(exitcode){ 
+dojo.exit = function(exitcode){
        quit(exitcode);
 }
 
@@ -157,7 +163,7 @@ dojo._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
 dojo.doc = typeof document != "undefined" ? document : null;
 
 dojo.body = function(){
-       return document.body;   
+       return document.body;
 }
 
 // Supply setTimeout/clearTimeout implementations if they aren't already there