зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
8958aa15a8
Коммит
c1d1b06e41
|
@ -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
|
||||
|
|
|
@ -20,22 +20,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|||
*/
|
||||
var retval = Object.defineProperty(window, "nosuchprop",
|
||||
{ value: 5, configurable: false });
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(retval, null,
|
||||
"Should return null when 'failing' to define non-configurable property via Object.defineProperty.")
|
||||
} else {
|
||||
is(retval, null,
|
||||
"Should return null when 'failing' to define non-configurable property via Object.defineProperty.")
|
||||
}
|
||||
|
||||
var desc = Object.getOwnPropertyDescriptor(window, "nosuchprop");
|
||||
is(typeof(desc), "object", "Should have a property 'nosuchprop' now");
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(desc.configurable, true,
|
||||
"Property 'nosuchprop' should be configurable");
|
||||
} else {
|
||||
is(desc.configurable, true,
|
||||
"Property 'nosuchprop' should be configurable");
|
||||
}
|
||||
is(desc.writable, false, "Property 'nosuchprop' should be readonly");
|
||||
is(desc.value, 5, "Property 'nosuchprop' should have the right value");
|
||||
|
||||
|
@ -44,24 +35,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|||
"secondProp": { value: 2, configurable: false },
|
||||
"thirdProp": { value: 3 },
|
||||
});
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(retval, null,
|
||||
"Should return null when 'failing' to define non-configurable property via Object.defineProperties.")
|
||||
} else {
|
||||
is(retval, null,
|
||||
"Should return null when 'failing' to define non-configurable property via Object.defineProperties.")
|
||||
}
|
||||
// The properties should all be defined.
|
||||
for (var [prop, val] of [["firstProp", 1], ["secondProp", 2], ["thirdProp", 3]]) {
|
||||
desc = Object.getOwnPropertyDescriptor(window, prop);
|
||||
is(typeof(desc), "object", `Should have a property '${prop}' now`);
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(desc.configurable, true,
|
||||
`Property '${prop}' should be configurable`);
|
||||
} else {
|
||||
is(desc.configurable, true,
|
||||
`Property '${prop}' should be configurable`);
|
||||
}
|
||||
is(desc.writable, false, `Property '${prop}' should be readonly`);
|
||||
is(desc.value, val, `Property '${prop}' should have the right value`);
|
||||
}
|
||||
|
@ -71,13 +52,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|||
"Should return object when succesfully defining 'nosuchprop2'");
|
||||
desc = Object.getOwnPropertyDescriptor(window, "nosuchprop2");
|
||||
is(typeof(desc), "object", "Should have a property 'nosuchprop2' now");
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(desc.configurable, true,
|
||||
"Property 'nosuchprop2' should be configurable");
|
||||
} else {
|
||||
is(desc.configurable, true,
|
||||
"Property 'nosuchprop2' should be configurable");
|
||||
}
|
||||
is(desc.writable, false, "Property 'nosuchprop2' should be readonly");
|
||||
is(desc.value, 6, "Property 'nosuchprop2' should have the right value");
|
||||
|
||||
|
@ -94,22 +70,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|||
|
||||
retval = Reflect.defineProperty(window, "nosuchprop4",
|
||||
{ value: 8, configurable: false });
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(retval, false,
|
||||
"Should not be able to Reflect.defineProperty if non-configurable");
|
||||
} else {
|
||||
is(retval, false,
|
||||
"Should not be able to Reflect.defineProperty if non-configurable");
|
||||
}
|
||||
desc = Object.getOwnPropertyDescriptor(window, "nosuchprop4");
|
||||
is(typeof(desc), "object", "Should have a property 'nosuchprop4' now");
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(desc.configurable, true,
|
||||
"Property 'nosuchprop4' should be configurable");
|
||||
} else {
|
||||
is(desc.configurable, true,
|
||||
"Property 'nosuchprop4' should be configurable");
|
||||
}
|
||||
is(desc.writable, false, "Property 'nosuchprop4' should be readonly");
|
||||
is(desc.value, 8, "Property 'nosuchprop4' should have the right value");
|
||||
|
||||
|
@ -119,13 +85,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
|
|||
"Should be able to Reflect.defineProperty with default configurability");
|
||||
desc = Object.getOwnPropertyDescriptor(window, "nosuchprop5");
|
||||
is(typeof(desc), "object", "Should have a property 'nosuchprop5' now");
|
||||
if (AppConstants.RELEASE_OR_BETA) {
|
||||
todo_is(desc.configurable, true,
|
||||
"Property 'nosuchprop5' should be configurable");
|
||||
} else {
|
||||
is(desc.configurable, true,
|
||||
"Property 'nosuchprop5' should be configurable");
|
||||
}
|
||||
is(desc.writable, false, "Property 'nosuchprop5' should be readonly");
|
||||
is(desc.value, 9, "Property 'nosuchprop5' should have the right value");
|
||||
|
||||
|
|
|
@ -1,18 +1,10 @@
|
|||
if (typeof getBuildConfiguration === "undefined") {
|
||||
var getBuildConfiguration = SpecialPowers.Cu.getJSTestingFunctions().getBuildConfiguration;
|
||||
}
|
||||
|
||||
// Global functions are configurable in a browser environment on nightly.
|
||||
var functionDeclarationsConfigurable = typeof document !== "undefined" &&
|
||||
!getBuildConfiguration().release_or_beta;
|
||||
|
||||
var o = { f: "string-f" };
|
||||
with (o) {
|
||||
var desc = Object.getOwnPropertyDescriptor(this, "f");
|
||||
assertEq(desc.value, undefined);
|
||||
assertEq(desc.writable, true);
|
||||
assertEq(desc.enumerable, true);
|
||||
assertEq(desc.configurable, functionDeclarationsConfigurable);
|
||||
assertEq(desc.configurable, false);
|
||||
function f() {
|
||||
return "fun-f";
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[window-opener-unconfigurable.window.html]
|
||||
[Corner case: self.opener is set while it's not configurable]
|
||||
expected:
|
||||
if release_or_beta: PASS # bug 1496510
|
||||
FAIL
|
|
@ -8,28 +8,3 @@
|
|||
[Window method: print]
|
||||
expected:
|
||||
if os == "android": FAIL
|
||||
|
||||
[Window unforgeable attribute: window]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Window unforgeable attribute: document]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Window unforgeable attribute: location]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Window unforgeable attribute: top]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
|
|
|
@ -1,33 +1,13 @@
|
|||
[windowproxy-define-own-property-unforgeable-same-origin.html]
|
||||
[[[DefineOwnProperty\]\] success: "window"]
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] failure: "window"]
|
||||
expected: FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] success: "document"]
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] failure: "document"]
|
||||
expected: FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] success: "location"]
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] failure: "location"]
|
||||
expected: FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] success: "top"]
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[[[DefineOwnProperty\]\] failure: "top"]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -468,33 +468,9 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
|
|||
|
||||
|
||||
[idlharness.https.html?include=(Document|Window)]
|
||||
[Window interface: window must have own property "window"]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Window interface: window must have own property "location"]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Window interface: window must have own property "top"]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Document interface: new Document() must inherit property "oncancel" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: window must have own property "document"]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1510437
|
||||
expected:
|
||||
if release_or_beta: PASS
|
||||
FAIL
|
||||
|
||||
[Document interface: attribute oncancel]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче