Bug 1511232. Add checks for RELEASE_OR_BETA for now. r=peterv

Once we decide that we're shipping this non-configurability behavior, we can
remove these bits.

Differential Revision: https://phabricator.services.mozilla.com/D16061

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-01-11 12:59:30 +00:00
Родитель d2c80f84e7
Коммит 8e958c733f
1 изменённых файлов: 44 добавлений и 12 удалений

Просмотреть файл

@ -10,6 +10,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
var {AppConstants} = SpecialPowers.Cu.import("resource://gre/modules/AppConstants.jsm", {});
/**
* Test for Bug 1107443, modified when it was backed out in bug 1329323.
* This is now testing the _current_ behavior, not the desired one; expect
@ -18,12 +20,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
*/
var retval = Object.defineProperty(window, "nosuchprop",
{ value: 5, configurable: false });
is(retval, false,
"Should return false when 'failing' to define non-configurable property via Object.defineProperty.")
if (AppConstants.RELEASE_OR_BETA) {
todo_is(retval, false,
"Should return false when 'failing' to define non-configurable property via Object.defineProperty.")
} else {
is(retval, false,
"Should return false 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");
is(desc.configurable, true,
"Property 'nosuchprop' should be configurable");
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");
@ -32,8 +44,13 @@ 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");
is(desc.configurable, true,
"Property 'nosuchprop2' should be configurable");
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");
@ -50,12 +67,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107443
retval = Reflect.defineProperty(window, "nosuchprop4",
{ value: 8, configurable: false });
is(retval, false,
"Should not be able to Reflect.defineProperty if non-configurable");
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");
is(desc.configurable, true,
"Property 'nosuchprop4' should be configurable");
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");
@ -65,8 +92,13 @@ 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");
is(desc.configurable, true,
"Property 'nosuchprop5' should be configurable");
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");