File tree Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Original file line number Diff line number Diff line change 9
9
Cu . import ( "resource://gre/modules/XPCOMUtils.jsm" , modules ) ;
10
10
Cu . import ( "resource://gre/modules/AddonManager.jsm" )
11
11
12
- const plugins = { __proto__ : modules } ;
13
- const userContext = { __proto__ : modules } ;
12
+ // Use the `liberator.plugins` in place of the `plugins`.
13
+ const plugins = Object . create ( modules ) ;
14
+
15
+ // Expose userContext to Global-scope.
16
+ Object . defineProperty ( modules , "userContext" , {
17
+ value : Object . create ( modules ) ,
18
+ enumerable : true ,
19
+ writeable : true
20
+ } ) ;
14
21
15
22
const EVAL_ERROR = "__liberator_eval_error" ;
16
23
const EVAL_RESULT = "__liberator_eval_result" ;
Original file line number Diff line number Diff line change 5
5
6
6
/** @scope modules */
7
7
8
- const { XHTML , XUL , NS } = ( function ( ) {
8
+ ( function ( ) {
9
9
function Namespace ( prefix , uri ) {
10
10
this . prefix = prefix ;
11
11
this . uri = uri ;
12
12
}
13
13
Namespace . prototype . toString = function toString ( ) { return this . uri ; } ;
14
- return {
15
- XHTML : new Namespace ( "html" , "http://www.w3.org/1999/xhtml" ) ,
16
- XUL : new Namespace ( "xul" , "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ) ,
17
- NS : new Namespace ( "liberator" , "http://vimperator.org/namespaces/liberator" ) ,
18
- } ;
14
+
15
+ // Expose XHTML,XUL,NS to Global-scope.
16
+ Object . defineProperties ( modules , {
17
+ XHTML : {
18
+ value : Object . freeze (
19
+ new Namespace ( "html" , "http://www.w3.org/1999/xhtml" )
20
+ ) ,
21
+ enumerable : true
22
+ } ,
23
+ XUL : {
24
+ value : Object . freeze (
25
+ new Namespace ( "xul" , "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" )
26
+ ) ,
27
+ enumerable : true
28
+ } ,
29
+ NS : {
30
+ value : Object . freeze (
31
+ new Namespace ( "liberator" , "http://vimperator.org/namespaces/liberator" )
32
+ ) ,
33
+ enumerable : true
34
+ }
35
+ } ) ;
19
36
} ) ( ) ;
20
37
21
38
let Encoder = Components . Constructor ( "@mozilla.org/layout/documentEncoder;1?type=text/plain" , "nsIDocumentEncoder" , "init" ) ;
You can’t perform that action at this time.
0 commit comments