mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1148750, part 12 - Reject redefinition of non-writable non-configurable data property as writable. This fixes bug 1073808. r=efaust.
This commit is contained in:
parent
296a9c02e1
commit
7189237c72
@ -0,0 +1,8 @@
|
||||
// If Array.of tries to overwrite a non-configurable property, it throws a TypeError.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
function C() {
|
||||
Object.defineProperty(this, 0, {value: "v", configurable: false});
|
||||
}
|
||||
assertThrowsInstanceOf(() => Array.of.call(C, 1, 2, 3), TypeError);
|
@ -0,0 +1,16 @@
|
||||
// Array.of does not overwrite non-configurable properties.
|
||||
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
var obj;
|
||||
function C() {
|
||||
obj = this;
|
||||
Object.defineProperty(this, 0, {value: "v", configurable: false});
|
||||
}
|
||||
try { Array.of.call(C, 1); } catch (e) {}
|
||||
assertDeepEq(Object.getOwnPropertyDescriptor(obj, 0), {
|
||||
configurable: false,
|
||||
enumerable: false,
|
||||
value: "v",
|
||||
writable: false
|
||||
});
|
@ -1443,6 +1443,10 @@ js::NativeDefineProperty(ExclusiveContext* cx, HandleNativeObject obj, HandleId
|
||||
CompletePropertyDescriptor(&desc);
|
||||
} else if (desc.isDataDescriptor()) {
|
||||
// Step 8.
|
||||
bool frozen = !IsConfigurable(shapeAttrs) && !IsWritable(shapeAttrs);
|
||||
if (frozen && desc.hasWritable() && desc.writable() && !skipRedefineChecks)
|
||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||
|
||||
if (desc.hasValue()) {
|
||||
// If any other JSPROP_IGNORE_* attributes are present, copy the
|
||||
// corresponding JSPROP_* attributes from the existing property.
|
||||
|
Loading…
Reference in New Issue
Block a user