js/src/tests/js1_8_5/extensions/clone-errors.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8_5/extensions/clone-errors.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +// |reftest| skip-if(!xulRuntime.shell)
     1.5 +// -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.6 +// Any copyright is dedicated to the Public Domain.
     1.7 +// http://creativecommons.org/licenses/publicdomain/
     1.8 +
     1.9 +function check(v) {
    1.10 +    try {
    1.11 +        serialize(v);
    1.12 +    } catch (exc) {
    1.13 +        return;
    1.14 +    }
    1.15 +    throw new Error("serializing " + uneval(v) + " should have failed with an exception");
    1.16 +}
    1.17 +
    1.18 +// Unsupported object types.
    1.19 +check(new Error("oops"));
    1.20 +check(this);
    1.21 +check(Math);
    1.22 +check(function () {});
    1.23 +check(Proxy.create({enumerate: function () { return []; }}));
    1.24 +
    1.25 +// A failing getter.
    1.26 +check({get x() { throw new Error("fail"); }});
    1.27 +
    1.28 +reportCompare(0, 0, "ok");

mercurial