| 1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
| 1422 |
alexandre_ |
11 |
|
|
|
12 |
|
| 1318 |
alexandre_ |
13 |
dojo.hostenv.name_ = "spidermonkey";
|
|
|
14 |
dojo.hostenv.println = print;
|
|
|
15 |
dojo.hostenv.exit = function (exitcode) {
|
|
|
16 |
quit(exitcode);
|
|
|
17 |
};
|
|
|
18 |
dojo.hostenv.getVersion = function () {
|
|
|
19 |
return version();
|
|
|
20 |
};
|
|
|
21 |
if (typeof line2pc == "undefined") {
|
|
|
22 |
dojo.raise("attempt to use SpiderMonkey host environment when no 'line2pc' global");
|
|
|
23 |
}
|
|
|
24 |
function dj_spidermonkey_current_file(depth) {
|
|
|
25 |
var s = "";
|
|
|
26 |
try {
|
|
|
27 |
throw Error("whatever");
|
|
|
28 |
}
|
|
|
29 |
catch (e) {
|
|
|
30 |
s = e.stack;
|
|
|
31 |
}
|
|
|
32 |
var matches = s.match(/[^@]*\.js/gi);
|
|
|
33 |
if (!matches) {
|
|
|
34 |
dojo.raise("could not parse stack string: '" + s + "'");
|
|
|
35 |
}
|
|
|
36 |
var fname = (typeof depth != "undefined" && depth) ? matches[depth + 1] : matches[matches.length - 1];
|
|
|
37 |
if (!fname) {
|
|
|
38 |
dojo.raise("could not find file name in stack string '" + s + "'");
|
|
|
39 |
}
|
|
|
40 |
return fname;
|
|
|
41 |
}
|
|
|
42 |
if (!dojo.hostenv.library_script_uri_) {
|
|
|
43 |
dojo.hostenv.library_script_uri_ = dj_spidermonkey_current_file(0);
|
|
|
44 |
}
|
|
|
45 |
dojo.hostenv.loadUri = function (uri) {
|
|
|
46 |
var ok = load(uri);
|
|
|
47 |
return 1;
|
|
|
48 |
};
|
|
|
49 |
dojo.requireIf((djConfig["isDebug"] || djConfig["debugAtAllCosts"]), "dojo.debug");
|
|
|
50 |
|