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 testRegExp(b) { michael@0: var a = deserialize(serialize(b)); michael@0: assertEq(a === b, false); michael@0: assertEq(Object.getPrototypeOf(a), RegExp.prototype); michael@0: assertEq(Object.prototype.toString.call(a), "[object RegExp]"); michael@0: for (p in a) michael@0: throw new Error("cloned RegExp should have no enumerable properties"); michael@0: michael@0: assertEq(a.source, b.source); michael@0: assertEq(a.global, b.global); michael@0: assertEq(a.ignoreCase, b.ignoreCase); michael@0: assertEq(a.multiline, b.multiline); michael@0: assertEq(a.sticky, b.sticky); michael@0: assertEq("expando" in a, false); michael@0: } michael@0: michael@0: testRegExp(RegExp("")); michael@0: testRegExp(/(?:)/); michael@0: testRegExp(/^(.*)$/gimy); michael@0: testRegExp(RegExp.prototype); michael@0: michael@0: var re = /\bx\b/gi; michael@0: re.expando = true; michael@0: testRegExp(re); michael@0: re.__proto__ = {}; michael@0: testRegExp(re); michael@0: michael@0: reportCompare(0, 0, 'ok');