diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index d79f9b0c389f..4f9efe0e5a1b 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -1878,13 +1878,6 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative* wrappe return ThrowAndFail(rv, cx, _retval); } - // We have this crazy behavior where wantXrays=false also implies that the - // returned sandbox is implicitly waived. We've stopped advertising it, but - // keep supporting it for now. - if (!options.wantXrays && !xpc::WrapperFactory::WaiveXrayAndWrap(cx, args.rval())) { - return NS_ERROR_UNEXPECTED; - } - *_retval = true; return NS_OK; } diff --git a/js/xpconnect/tests/chrome/test_evalInSandbox.xul b/js/xpconnect/tests/chrome/test_evalInSandbox.xul index 4d78e20594ce..860d5394ef1b 100644 --- a/js/xpconnect/tests/chrome/test_evalInSandbox.xul +++ b/js/xpconnect/tests/chrome/test_evalInSandbox.xul @@ -77,10 +77,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596 ok(Cu.evalInSandbox("('foo' in this.document);", sandbox), "can see expandos"); - ok(("foo" in Cu.evalInSandbox("this.document", sandbox)), - "must see expandos in wrappers returned from the sandbox"); + ok(!("foo" in Cu.evalInSandbox("this.document", sandbox)), + "must not see expandos in wrappers returned from the sandbox"); + ok(("foo" in Cu.waiveXrays(Cu.evalInSandbox("this.document", sandbox))), + "must see expandos in waived wrappers returned from the sandbox"); - ok(("foo" in sandbox.document), + ok(!("foo" in sandbox.document), + "must not see expandos in wrappers obtained from the sandbox"); + ok("foo" in Cu.waiveXrays(sandbox.document), "must see expandos in wrappers obtained from the sandbox"); testDone(); diff --git a/js/xpconnect/tests/unit/test_bug845862.js b/js/xpconnect/tests/unit/test_bug845862.js index 56c0ab1d846e..41d799803fa2 100644 --- a/js/xpconnect/tests/unit/test_bug845862.js +++ b/js/xpconnect/tests/unit/test_bug845862.js @@ -1,11 +1,7 @@ function run_test() { - // We rely on the crazy "wantXrays:false also causes values return from the - // sandbox to be waived" behavior, because it's the simplest way to get - // waivers out of the sandbox (which has no native objects). :-( - var sb = new Cu.Sandbox('http://www.example.com', {wantXrays: false}); + var sb = new Cu.Sandbox('http://www.example.com'); Cu.evalInSandbox("this.foo = {}; Object.defineProperty(foo, 'bar', {get: function() {return {};}});", sb); - Assert.ok(sb.foo != XPCNativeWrapper(sb.foo), "sb.foo is waived"); - var desc = Object.getOwnPropertyDescriptor(sb.foo, 'bar'); + var desc = Object.getOwnPropertyDescriptor(Cu.waiveXrays(sb.foo), 'bar'); var b = desc.get(); Assert.ok(b != XPCNativeWrapper(b), "results from accessor descriptors are waived"); }