1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* See https://bugzilla.mozilla.org/show_bug.cgi?id=769273 */
11 var ifacePointer = Cc["@mozilla.org/supports-interface-pointer;1"]
12 .createInstance(Ci.nsISupportsInterfacePointer);
14 var sb = Cu.Sandbox(global, {wantGlobalProperties: ["ChromeUtils"]});
16 sb.ifacePointer = ifacePointer
18 var refToObjFromSb = Cu.evalInSandbox(`
20 QueryInterface: ChromeUtils.generateQI([]),
21 wrappedJSObject: {foo: "bar"},
24 var a = {prop2:'prop2'};
28 equal(ifacePointer.data.wrappedJSObject.foo, "bar",
29 "Got expected wrapper into sandbox")
32 ok(Cu.isDeadWrapper(sb), "sb should be dead");
33 ok(Cu.isDeadWrapper(ifacePointer.data.wrappedJSObject),
34 "Wrapper retrieved via XPConnect should be dead");
40 Assert.ok(e.toString().indexOf("can't access dead object") > -1);
43 Cu.isDeadWrapper(refToObjFromSb, "ref to object from sb should be dead");
48 Assert.ok(e.toString().indexOf("can't access dead object") > -1);