js/xpconnect/tests/unit/test_bug845862.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/unit/test_bug845862.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,13 @@
     1.4 +const Cu = Components.utils;
     1.5 +
     1.6 +function run_test() {
     1.7 +  // We rely on the crazy "wantXrays:false also causes values return from the
     1.8 +  // sandbox to be waived" behavior, because it's the simplest way to get
     1.9 +  // waivers out of the sandbox (which has no native objects). :-(
    1.10 +  var sb = new Cu.Sandbox('http://www.example.com', {wantXrays: false});
    1.11 +  Cu.evalInSandbox("this.foo = {}; Object.defineProperty(foo, 'bar', {get: function() {return {};}});", sb);
    1.12 +  do_check_true(sb.foo != XPCNativeWrapper(sb.foo), "sb.foo is waived");
    1.13 +  var desc = Object.getOwnPropertyDescriptor(sb.foo, 'bar');
    1.14 +  var b = desc.get();
    1.15 +  do_check_true(b != XPCNativeWrapper(b), "results from accessor descriptors are waived");
    1.16 +}

mercurial