Bug 1758164 - Align the behavior of defining non-configurable properties on a WindowProxy on Nightly with Release/Beta; r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D141732
This commit is contained in:
@@ -574,28 +574,6 @@ void nsOuterWindowProxy::finalize(JS::GCContext* gcx, JSObject* proxy) const {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IsNonConfigurableReadonlyPrimitiveGlobalProp returns true for
|
||||
* property names that fit the following criteria:
|
||||
*
|
||||
* 1) The ES spec defines a property with that name on globals.
|
||||
* 2) The property is non-configurable.
|
||||
* 3) The property is non-writable (readonly).
|
||||
* 4) The value of the property is a primitive (so doesn't change
|
||||
* observably on when navigation happens).
|
||||
*
|
||||
* Such properties can act as actual non-configurable properties on a
|
||||
* WindowProxy, because they are not affected by navigation.
|
||||
*/
|
||||
#ifndef RELEASE_OR_BETA
|
||||
static bool IsNonConfigurableReadonlyPrimitiveGlobalProp(JSContext* cx,
|
||||
JS::Handle<jsid> id) {
|
||||
return id == GetJSIDByIndex(cx, XPCJSContext::IDX_NAN) ||
|
||||
id == GetJSIDByIndex(cx, XPCJSContext::IDX_UNDEFINED) ||
|
||||
id == GetJSIDByIndex(cx, XPCJSContext::IDX_INFINITY);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool nsOuterWindowProxy::getOwnPropertyDescriptor(
|
||||
JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<Maybe<JS::PropertyDescriptor>> desc) const {
|
||||
@@ -651,7 +629,8 @@ bool nsOuterWindowProxy::getOwnPropertyDescriptor(
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef RELEASE_OR_BETA // To be turned on in bug 1496510.
|
||||
#if 0
|
||||
// See https://github.com/tc39/ecma262/issues/672 for more information.
|
||||
if (desc.isSome() &&
|
||||
!IsNonConfigurableReadonlyPrimitiveGlobalProp(cx, id)) {
|
||||
(*desc).setConfigurable(true);
|
||||
@@ -768,7 +747,8 @@ bool nsOuterWindowProxy::definePropertySameOrigin(
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef RELEASE_OR_BETA // To be turned on in bug 1496510.
|
||||
#if 0
|
||||
// See https://github.com/tc39/ecma262/issues/672 for more information.
|
||||
if (desc.hasConfigurable() && !desc.configurable() &&
|
||||
!IsNonConfigurableReadonlyPrimitiveGlobalProp(cx, id)) {
|
||||
// Give callers a way to detect that they failed to "really" define a
|
||||
|
||||
Reference in New Issue
Block a user