2 var sbMaster = Cu.Sandbox(["http://www.a.com",
5 var sbSubset = Cu.Sandbox(["http://www.d.com",
8 var sbA = Cu.Sandbox("http://www.a.com");
9 var sbB = Cu.Sandbox("http://www.b.com");
10 var sbC = Cu.Sandbox("http://www.c.com");
12 sbMaster.objA = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbA);
13 sbMaster.objB = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbB);
14 sbMaster.objC = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbC);
15 sbMaster.objOwn = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbMaster);
17 sbMaster.objSubset = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbSubset);
18 sbA.objMaster = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbMaster);
19 sbSubset.objMaster = Cu.evalInSandbox("var obj = {prop1:200}; obj", sbMaster);
22 ret = Cu.evalInSandbox("objA.prop1", sbMaster);
23 Assert.equal(ret, 200);
24 ret = Cu.evalInSandbox("objB.prop1", sbMaster);
25 Assert.equal(ret, 200);
26 ret = Cu.evalInSandbox("objSubset.prop1", sbMaster);
27 Assert.equal(ret, 200);
29 function evalAndCatch(str, sb) {
31 ret = Cu.evalInSandbox(str, sb);
32 Assert.ok(false, "unexpected pass")
34 Assert.ok(e.message && e.message.includes("Permission denied to access property"));
38 evalAndCatch("objC.prop1", sbMaster);
39 evalAndCatch("objMaster.prop1", sbA);
40 evalAndCatch("objMaster.prop1", sbSubset);