]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/_base/configSpidermonkey.js
1 // TODO: this file needs to be converted to the v1.7 loader
6 // SpiderMonkey host environment
8 if(dojo
.config
["baseUrl"]){
9 dojo
.baseUrl
= dojo
.config
["baseUrl"];
14 dojo
._name
= 'spidermonkey';
18 dojo
.isSpidermonkey
= true;
19 dojo
.exit = function(exitcode
){
23 if(typeof print
== "function"){
24 console
.debug
= print
;
27 if(typeof line2pc
== 'undefined'){
28 throw new Error("attempt to use SpiderMonkey host environment when no 'line2pc' global");
31 dojo
._spidermonkeyCurrentFile = function(depth
){
33 // This is a hack that determines the current script file by parsing a
34 // generated stack trace (relying on the non-standard "stack" member variable
35 // of the SpiderMonkey Error object).
37 // If param depth is passed in, it'll return the script file which is that far down
38 // the stack, but that does require that you know how deep your stack is when you are
43 throw Error("whatever");
47 // lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
48 var matches
= s
.match(/[^@]*\.js/gi);
50 throw Error("could not parse stack string: '" + s
+ "'");
52 var fname
= (typeof depth
!= 'undefined' && depth
) ? matches
[depth
+ 1] : matches
[matches
.length
- 1];
54 throw Error("could not find file name in stack string '" + s
+ "'");
56 //print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
60 // print(dojo._spidermonkeyCurrentFile(0));
62 dojo
._loadUri = function(uri
){
63 // spidermonkey load() evaluates the contents into the global scope (which
65 // TODO: sigh, load() does not return a useful value.
66 // Perhaps it is returning the value of the last thing evaluated?
69 // console.log("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
]);