michael@0: // |reftest| skip-if(!xulRuntime.shell) michael@0: // -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: michael@0: function check(v) { michael@0: try { michael@0: serialize(v); michael@0: } catch (exc) { michael@0: return; michael@0: } michael@0: throw new Error("serializing " + uneval(v) + " should have failed with an exception"); michael@0: } michael@0: michael@0: // Unsupported object types. michael@0: check(new Error("oops")); michael@0: check(this); michael@0: check(Math); michael@0: check(function () {}); michael@0: check(Proxy.create({enumerate: function () { return []; }})); michael@0: michael@0: // A failing getter. michael@0: check({get x() { throw new Error("fail"); }}); michael@0: michael@0: reportCompare(0, 0, "ok");