diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/js1_8_5/regress/regress-591846.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/js1_8_5/regress/regress-591846.js')
-rw-r--r-- | js/src/tests/js1_8_5/regress/regress-591846.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/js/src/tests/js1_8_5/regress/regress-591846.js b/js/src/tests/js1_8_5/regress/regress-591846.js new file mode 100644 index 000000000..68b1feca3 --- /dev/null +++ b/js/src/tests/js1_8_5/regress/regress-591846.js @@ -0,0 +1,64 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +function check(obj, name, value, readonly) { + // Start with a non-configurable, writable data property implemented via + // js::PropertyOp getter and setter. + var pd = Object.getOwnPropertyDescriptor(obj, name); + + assertEq(pd.configurable, false, "non-configurable " + name); + assertEq(pd.writable, !readonly, "writable " + name); + + try { + // Do not allow a transition from js::PropertyOp to writable js::Value + // data property. + Object.defineProperty(obj, name, {writable: true}); + assertEq(0, 1); + } catch (e) { + assertEq('' + e, "TypeError: can't redefine non-configurable property '" + name + "'"); + } + + if (!readonly) { + try { + // Do not allow the property denoted by name to become a true data + // property via a descriptor that preserves the native property's + // writable attribute. + Object.defineProperty(obj, name, {value: value}); + assertEq(0, 1); + } catch (e) { + assertEq('' + e, "TypeError: can't redefine non-configurable property '" + name + "'"); + } + } + + try { + // Do not allow the property to be frozen at some bogus value. + Object.defineProperty(obj, name, {value: "bogus", writable: false}); + assertEq(0, 1); + } catch (e) { + assertEq('' + e, "TypeError: can't redefine non-configurable property '" + name + "'"); + } + + // Now make name non-writable. + Object.defineProperty(obj, name, {writable: false}) + + // Assert that the right getter result "stuck". + assertEq(obj[name], value); + + // Test that it is operationally non-writable now. + obj[name] = "eek!"; + assertEq(obj[name], value); +} + +// Reset RegExp.leftContext to the empty string. +/x/.test('x'); + +var d = Object.getOwnPropertyDescriptor(RegExp, "leftContext"); +assertEq(d.set, undefined); +assertEq(typeof d.get, "function"); +assertEq(d.enumerable, true); +assertEq(d.configurable, false); +assertEq(d.get.call(RegExp), ""); + +reportCompare(0, 0, "ok"); |