Bug 1178639. WindowProxy should generally claim that properties on it are configurable. r=peterv
☠☠ backed out by db5251bae3d4 ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 27 Nov 2018 14:16:50 -0500
changeset 504851 8c8ad4d5dbe94b90b340acd449fac1516b563a07
parent 504850 052522c1bc3b62b1c8589dd58dc8be01d67e239a
child 504852 639b931122292b83f5ee99b646942c7352bef2fc
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1178639
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1178639. WindowProxy should generally claim that properties on it are configurable. r=peterv The one exception are properties that are: 1) Defined in the ES spec. 2) Non-configurable. 3) Readonly. 4) Have values that don't observable change on navigation.
dom/base/nsGlobalWindowOuter.cpp
dom/base/test/test_window_define_nonconfigurable.html
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -531,21 +531,28 @@ nsOuterWindowProxy::getOwnPropertyDescri
     return false;
   }
   if (found) {
     FillPropertyDescriptor(desc, proxy, true);
     return true;
   }
   // else fall through to js::Wrapper
 
-
-  // When we change this to always claim the property is configurable (bug
-  // 1178639), update the comments in nsOuterWindowProxy::defineProperty
-  // accordingly.
-  return js::Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc);
+  bool ok = js::Wrapper::getOwnPropertyDescriptor(cx, proxy, id, desc);
+  if (!ok) {
+    return false;
+  }
+
+#ifndef RELEASE_OR_BETA // To be turned on in bug 1496510.
+  if (!IsNonConfigurableReadonlyPrimitiveGlobalProp(cx, id)) {
+    desc.setConfigurable(true);
+  }
+#endif
+
+  return true;
 }
 
 bool
 nsOuterWindowProxy::defineProperty(JSContext* cx,
                                    JS::Handle<JSObject*> proxy,
                                    JS::Handle<jsid> id,
                                    JS::Handle<JS::PropertyDescriptor> desc,
                                    JS::ObjectOpResult &result) const
--- a/dom/base/test/test_window_define_nonconfigurable.html
+++ b/dom/base/test/test_window_define_nonconfigurable.html
@@ -17,28 +17,28 @@ https://bugzilla.mozilla.org/show_bug.cg
    * fixed.
    */
   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.")
   var desc = Object.getOwnPropertyDescriptor(window, "nosuchprop");
   is(typeof(desc), "object", "Should have a property 'nosuchprop' now");
-  todo_is(desc.configurable, true,
-          "Property 'nosuchprop' should be configurable");
+  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");
 
   retval = Object.defineProperty(window, "nosuchprop2", { value: 6 });
   is(retval, window,
      "Should return object when succesfully defining 'nosuchprop2'");
   desc = Object.getOwnPropertyDescriptor(window, "nosuchprop2");
   is(typeof(desc), "object", "Should have a property 'nosuchprop2' now");
-  todo_is(desc.configurable, true,
-          "Property 'nosuchprop2' should be configurable");
+  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");
 
   retval = Object.defineProperty(window, "nosuchprop3",
                                  { value: 7, configurable: true });
   is(retval, window,
      "Should return object when succesfully defining 'nosuchprop3'");
   desc = Object.getOwnPropertyDescriptor(window, "nosuchprop3");
@@ -49,29 +49,29 @@ https://bugzilla.mozilla.org/show_bug.cg
   is(desc.value, 7, "Property 'nosuchprop3' should have the right value");
 
   retval = Reflect.defineProperty(window, "nosuchprop4",
                                   { value: 8, configurable: false });
   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");
-  todo_is(desc.configurable, true,
-          "Property 'nosuchprop4' should be configurable");
+  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");
 
   retval = Reflect.defineProperty(window, "nosuchprop5",
                                   { value: 9 });
   is(retval, true,
      "Should be able to Reflect.defineProperty with default configurability");
   desc = Object.getOwnPropertyDescriptor(window, "nosuchprop5");
   is(typeof(desc), "object", "Should have a property 'nosuchprop5' now");
-  todo_is(desc.configurable, true,
-          "Property 'nosuchprop5' should be configurable");
+  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");
 
   retval = Reflect.defineProperty(window, "nosuchprop6",
                                   { value: 10, configurable: true });
   is(retval, true,
      "Should be able to Reflect.defineProperty if configurable");
   desc = Object.getOwnPropertyDescriptor(window, "nosuchprop6");