2 * SpiderMonkey host environment
5 if(dojo.config["baseUrl"]){
6 dojo.baseUrl = dojo.config["baseUrl"];
11 dojo._name = 'spidermonkey';
14 dojo.isSpidermonkey = {
15 // summary: Detect spidermonkey
19 dojo.isSpidermonkey = true;
20 dojo.exit = function(exitcode){
24 if(typeof print == "function"){
25 console.debug = print;
28 if(typeof line2pc == 'undefined'){
29 throw new Error("attempt to use SpiderMonkey host environment when no 'line2pc' global");
32 dojo._spidermonkeyCurrentFile = function(depth){
34 // This is a hack that determines the current script file by parsing a
35 // generated stack trace (relying on the non-standard "stack" member variable
36 // of the SpiderMonkey Error object).
38 // If param depth is passed in, it'll return the script file which is that far down
39 // the stack, but that does require that you know how deep your stack is when you are
44 throw Error("whatever");
48 // lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
49 var matches = s.match(/[^@]*\.js/gi);
51 throw Error("could not parse stack string: '" + s + "'");
53 var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
55 throw Error("could not find file name in stack string '" + s + "'");
57 //print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
61 // print(dojo._spidermonkeyCurrentFile(0));
63 dojo._loadUri = function(uri){
64 // spidermonkey load() evaluates the contents into the global scope (which
66 // TODO: sigh, load() does not return a useful value.
67 // Perhaps it is returning the value of the last thing evaluated?
69 // console.debug("spidermonkey load(", uri, ") returned ", ok);
73 //Register any module paths set up in djConfig. Need to do this
74 //in the hostenvs since hostenv_browser can read djConfig from a
75 //script tag's attribute.
76 if(dojo.config["modulePaths"]){
77 for(var param in dojo.config["modulePaths"]){
78 dojo.registerModulePath(param, dojo.config["modulePaths"][param]);