4 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
5 registerCleanupFunction(() => {
6 Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
8 const a = ChromeUtils.import("resource://test/environment_loadscript.jsm", tgt_load);
9 const b = ChromeUtils.import("resource://test/environment_checkscript.jsm", tgt_check);
11 const isShared = Cu.getGlobalForObject(a) === Cu.getGlobalForObject(b);
13 // Check target bindings
14 var tgt_subscript_bound = "";
15 for (var name of ["vu", "vq", "vl", "gt", "ed", "ei", "fo", "fi", "fd"])
16 if (tgt_load.target.hasOwnProperty(name))
17 tgt_subscript_bound += name + ",";
19 // Expected subscript loader behavior is as follows:
20 // - Qualified vars and |this| access occur on target object
21 // - Lexical vars occur on ExtensibleLexicalEnvironment of target object
22 // - Bareword assignments and global |this| access occur on caller's global
23 Assert.equal(tgt_load.bound, "vu,ei,fo,fi,", "Should have expected module binding set");
24 Assert.equal(tgt_subscript_bound, "vq,gt,ed,fd,", "Should have expected subscript binding set");
26 // Components should not share namespace
28 todo_check_eq(tgt_check.bound, "");
29 Assert.equal(tgt_check.bound, "ei,fo,", "Modules should have no shared non-eval bindings");
31 Assert.equal(tgt_check.bound, "", "Modules should have no shared bindings");