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 99Cu . import ( "resource://gre/modules/XPCOMUtils.jsm" , modules ) ;
1010Cu . import ( "resource://gre/modules/AddonManager.jsm" )
1111
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+ } ) ;
1421
1522const EVAL_ERROR = "__liberator_eval_error" ;
1623const EVAL_RESULT = "__liberator_eval_result" ;
Original file line number Diff line number Diff line change 55
66/** @scope modules */
77
8- const { XHTML , XUL , NS } = ( function ( ) {
8+ ( function ( ) {
99 function Namespace ( prefix , uri ) {
1010 this . prefix = prefix ;
1111 this . uri = uri ;
1212 }
1313 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 ( this , {
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+ } ) ;
1936} ) ( ) ;
2037
2138let 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