Attachment 'jsio-jester.patch'
Download 1 diff --git a/packages/jsio.js b/packages/jsio.js
2 index f5e99b3..87bb01f 100644
3 --- a/packages/jsio.js
4 +++ b/packages/jsio.js
5 @@ -24,6 +24,9 @@
6 case 'node':
7 ENV = new ENV_node();
8 break;
9 + case 'jester':
10 + ENV = new ENV_jester();
11 + break;
12 case 'browser':
13 default:
14 ENV = new ENV_browser();
15 @@ -39,7 +42,11 @@
16 if(!jsio.path.__default__) { jsio.setPath(ENV.getPath()); }
17 }
18
19 - jsio.setEnv(typeof node !== 'undefined' && typeof process !== 'undefined' && process.version ? 'node' : 'browser');
20 +
21 + if (typeof jester !== 'undefined' && jester.magic == 'GNOME JESTER JAVASCRIPT TESTER')
22 + jsio.setEnv('jester');
23 + else
24 + jsio.setEnv(typeof node !== 'undefined' && typeof process !== 'undefined' && process.version ? 'node' : 'browser');
25
26 // DONE
27
28 @@ -54,6 +61,31 @@
29 }
30 */
31
32 + function ENV_jester() {
33 + this.Gio = imports.gi.Gio;
34 + this.global = GLOBAL;
35 + this.getCwd = function() {return __jester_cwd};
36 + this.getPath = function() {return __jester_path};
37 + this.eval = function(src, path) {
38 + return eval(src);
39 + };
40 +
41 + this.findModule = function(possibilities) {
42 + for (var i = 0, possible; possible = possibilities[i]; ++i) {
43 + var f = this.Gio.file_new_for_path(possible.filePath);
44 + var t = f.query_file_type(0, null);
45 + if(t == this.Gio.FileType.REGULAR) {
46 + var [success, contents, len, etag] = f.load_contents(null);
47 + possible.src = contents;
48 + return possible;
49 + }
50 +
51 + }
52 + };
53 +
54 + this.log = print;
55 + }
56 +
57 function ENV_node() {
58 var fs = require('fs');
59
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.