]>
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
5 * SpiderMonkey host environment
8 if(dojo
.config
["baseUrl"]){
9 dojo
.baseUrl
= dojo
.config
["baseUrl"];
14 dojo
._name
= 'spidermonkey';
17 dojo.isSpidermonkey = {
18 // summary: Detect spidermonkey
22 dojo
.isSpidermonkey
= true;
23 dojo
.exit = function(exitcode
){
27 if(typeof print
== "function"){
28 console
.debug
= print
;
31 if(typeof line2pc
== 'undefined'){
32 throw new Error("attempt to use SpiderMonkey host environment when no 'line2pc' global");
35 dojo
._spidermonkeyCurrentFile = function(depth
){
37 // This is a hack that determines the current script file by parsing a
38 // generated stack trace (relying on the non-standard "stack" member variable
39 // of the SpiderMonkey Error object).
41 // If param depth is passed in, it'll return the script file which is that far down
42 // the stack, but that does require that you know how deep your stack is when you are
47 throw Error("whatever");
51 // lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
52 var matches
= s
.match(/[^@]*\.js/gi);
54 throw Error("could not parse stack string: '" + s
+ "'");
56 var fname
= (typeof depth
!= 'undefined' && depth
) ? matches
[depth
+ 1] : matches
[matches
.length
- 1];
58 throw Error("could not find file name in stack string '" + s
+ "'");
60 //print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
64 // print(dojo._spidermonkeyCurrentFile(0));
66 dojo
._loadUri = function(uri
){
67 // spidermonkey load() evaluates the contents into the global scope (which
69 // TODO: sigh, load() does not return a useful value.
70 // Perhaps it is returning the value of the last thing evaluated?
73 // console.log("spidermonkey load(", uri, ") returned ", ok);
77 //Register any module paths set up in djConfig. Need to do this
78 //in the hostenvs since hostenv_browser can read djConfig from a
79 //script tag's attribute.
80 if(dojo
.config
["modulePaths"]){
81 for(var param
in dojo
.config
["modulePaths"]){
82 dojo
.registerModulePath(param
, dojo
.config
["modulePaths"][param
]);