summaryrefslogtreecommitdiff
path: root/lib/dojo/_base/_loader/hostenv_rhino.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/_base/_loader/hostenv_rhino.js')
-rw-r--r--lib/dojo/_base/_loader/hostenv_rhino.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/dojo/_base/_loader/hostenv_rhino.js b/lib/dojo/_base/_loader/hostenv_rhino.js
index ee9ad8b43..e3aa78524 100644
--- a/lib/dojo/_base/_loader/hostenv_rhino.js
+++ b/lib/dojo/_base/_loader/hostenv_rhino.js
@@ -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