Title: [219659] trunk
Revision
219659
Author
[email protected]
Date
2017-07-19 11:16:21 -0700 (Wed, 19 Jul 2017)

Log Message

Make cross-origin properties enumerable
https://bugs.webkit.org/show_bug.cgi?id=174576

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Re-sync tests from upstream and rebaseline to improve test coverage.

* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html:
* web-platform-tests/html/browsers/the-window-object/window-indexed-properties-expected.txt:
* web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html:

Source/WebCore:

Makes cross-origin properties enumerable on Window and Location objects
as per:
- https://github.com/whatwg/html/pull/2777

This simplifies our code quite a bit.

No new tests, updated existing tests.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
(WebCore::JSDOMWindow::getOwnPropertyNames):
* bindings/js/JSLocationCustom.cpp:
(WebCore::getOwnPropertySlotCommon):
(WebCore::JSLocation::getOwnPropertyNames):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):

LayoutTests:

Update / rebaseline some tests to reflect behavior change.

* http/tests/security/cross-origin-descriptors-expected.txt:
* http/tests/security/cross-origin-descriptors.html:
* js/dom/getOwnPropertyDescriptor-expected.txt:
* js/resources/getOwnPropertyDescriptor.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219658 => 219659)


--- trunk/LayoutTests/ChangeLog	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/ChangeLog	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,3 +1,17 @@
+2017-07-19  Chris Dumez  <[email protected]>
+
+        Make cross-origin properties enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=174576
+
+        Reviewed by Darin Adler.
+
+        Update / rebaseline some tests to reflect behavior change.
+
+        * http/tests/security/cross-origin-descriptors-expected.txt:
+        * http/tests/security/cross-origin-descriptors.html:
+        * js/dom/getOwnPropertyDescriptor-expected.txt:
+        * js/resources/getOwnPropertyDescriptor.js:
+
 2017-07-19  Matt Lewis  <[email protected]>
 
         Unreviewed, rolling out r219646.

Modified: trunk/LayoutTests/http/tests/security/cross-frame-access-enumeration-expected.txt (219658 => 219659)


--- trunk/LayoutTests/http/tests/security/cross-frame-access-enumeration-expected.txt	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/http/tests/security/cross-frame-access-enumeration-expected.txt	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: line 28: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 28: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match.
 Tests enumeration of Window / Location properties cross origin.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/http/tests/security/cross-origin-descriptors-expected.txt (219658 => 219659)


--- trunk/LayoutTests/http/tests/security/cross-origin-descriptors-expected.txt	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/http/tests/security/cross-origin-descriptors-expected.txt	2017-07-19 18:16:21 UTC (rev 219659)
@@ -6,78 +6,78 @@
 * Location.href
 PASS descriptor.get is undefined.
 PASS descriptor.set is an instance of Function
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Location.replace
 PASS descriptor.value is an instance of Function
 PASS descriptor.writable is false
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 
 * Window.window
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.self
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.location
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is an instance of Function
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.close
 PASS descriptor.value is an instance of Function
 PASS descriptor.writable is false
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.closed
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.focus
 PASS descriptor.value is an instance of Function
 PASS descriptor.writable is false
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.blur
 PASS descriptor.value is an instance of Function
 PASS descriptor.writable is false
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.frames
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.length
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.top
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.opener
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.parent
 PASS descriptor.get is an instance of Function
 PASS descriptor.set is undefined.
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 * Window.postMessage
 PASS descriptor.value is an instance of Function
 PASS descriptor.writable is false
-PASS descriptor.enumerable is false
+PASS descriptor.enumerable is true
 PASS descriptor.configurable is true
 
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/http/tests/security/cross-origin-descriptors.html (219658 => 219659)


--- trunk/LayoutTests/http/tests/security/cross-origin-descriptors.html	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/http/tests/security/cross-origin-descriptors.html	2017-07-19 18:16:21 UTC (rev 219659)
@@ -27,7 +27,7 @@
         shouldBeType("descriptor.value", "Function");
         shouldBeFalse("descriptor.writable");
     }
-    shouldBeFalse("descriptor.enumerable");
+    shouldBeTrue("descriptor.enumerable");
     shouldBeTrue("descriptor.configurable");
 }
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (219658 => 219659)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,3 +1,17 @@
+2017-07-19  Chris Dumez  <[email protected]>
+
+        Make cross-origin properties enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=174576
+
+        Reviewed by Darin Adler.
+
+        Re-sync tests from upstream and rebaseline to improve test coverage.
+
+        * web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
+        * web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html:
+        * web-platform-tests/html/browsers/the-window-object/window-indexed-properties-expected.txt:
+        * web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html:
+
 2017-07-18  Chris Dumez  <[email protected]>
 
         DOMException should have its properties on the prototype

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt (219658 => 219659)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,5 +1,3 @@
-CONSOLE MESSAGE: line 384: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
-CONSOLE MESSAGE: line 384: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
 
 PASS Basic sanity-checking 
 PASS Only whitelisted properties are accessible cross-origin 
@@ -11,7 +9,7 @@
 PASS [[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly 
 PASS [[Delete]] Should throw on cross-origin objects 
 PASS [[DefineOwnProperty]] Should throw for cross-origin objects 
-PASS [[Enumerate]] should return an empty iterator 
+PASS Can only enumerate safelisted properties 
 PASS [[OwnPropertyKeys]] should return all properties from cross-origin objects 
 PASS [[OwnPropertyKeys]] should return the right symbol-named properties for cross-origin objects 
 PASS [[OwnPropertyKeys]] should place the symbols after the property names after the subframe indices 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html (219658 => 219659)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html	2017-07-19 18:16:21 UTC (rev 219659)
@@ -187,14 +187,16 @@
   var isSymbol = (typeof(propName) == "symbol");
   propName = String(propName);
   assert_true(isObject(desc), "property descriptor for " + propName + " should exist");
-  assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should be non-enumerable");
   assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
   if (isSymbol) {
+    assert_equals(desc.enumerable, false, "symbol-property descriptor for " + propName + " should not be enumerable");
     assert_true("value" in desc,
                 "property descriptor for " + propName + " should be a value descriptor");
     assert_equals(desc.value, undefined,
                   "symbol-named cross-origin visible prop " + propName +
                   " should come back as undefined");
+  } else {
+    assert_equals(desc.enumerable, true, "property descriptor for " + propName + " should be enumerable");
   }
   if ('value' in desc)
     assert_equals(desc.writable, expectWritable, "property descriptor for " + propName + " should have writable: " + expectWritable);
@@ -256,15 +258,23 @@
 }, "[[DefineOwnProperty]] Should throw for cross-origin objects");
 
 /*
- * [[Enumerate]]
+ * EnumerateObjectProperties (backed by [[OwnPropertyKeys]])
  */
 
 addTest(function() {
-  for (var prop in C)
-    assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Window");
-  for (var prop in C.location)
-    assert_unreached("Shouldn't have been able to enumerate " + prop + " on cross-origin Location");
-}, "[[Enumerate]] should return an empty iterator");
+  let i = 0;
+  for (var prop in C) {
+    i++;
+    assert_true(whitelistedWindowPropNames.includes(prop), prop + " is not safelisted for a cross-origin Window");
+  }
+  assert_equals(i, whitelistedWindowPropNames.length, "Enumerate all safelisted cross-origin Window properties");
+  i = 0;
+  for (var prop in C.location) {
+    i++;
+    assert_true(whitelistedLocationPropNames.includes(prop), prop + " is not safelisted for a cross-origin Location");
+  }
+  assert_equals(i, whitelistedLocationPropNames.length, "Enumerate all safelisted cross-origin Location properties");
+}, "Can only enumerate safelisted properties");
 
 /*
  * [[OwnPropertyKeys]]
@@ -274,9 +284,15 @@
   assert_array_equals(Object.getOwnPropertyNames(C).sort(),
                       whitelistedWindowPropNames,
                       "Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
+  assert_array_equals(Object.keys(C).sort(),
+                      whitelistedWindowPropNames,
+                      "Object.keys() gives the right answer for cross-origin Window");
   assert_array_equals(Object.getOwnPropertyNames(C.location).sort(),
                       whitelistedLocationPropNames,
                       "Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
+  assert_array_equals(Object.keys(C.location).sort(),
+                      whitelistedLocationPropNames,
+                      "Object.keys() gives the right answer for cross-origin Location");
 }, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
 
 addTest(function() {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-expected.txt (219658 => 219659)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-expected.txt	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties-expected.txt	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,5 +1,6 @@
 
 PASS Indexed properties of the window object (non-strict mode) 
+PASS Ensure indexed properties have the correct configuration 
 FAIL Indexed properties of the window object (non-strict mode) 1 assert_throws: function "() => Object.defineProperty(window, 0, { value: "bar" })" did not throw
 FAIL Indexed properties of the window object (non-strict mode) 2 assert_throws: function "() => Object.defineProperty(window, 1, { value: "bar" })" did not throw
 PASS Indexed properties of the window object (non-strict mode) 3 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html (219658 => 219659)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/window-indexed-properties.html	2017-07-19 18:16:21 UTC (rev 219659)
@@ -17,6 +17,12 @@
   window[-1] = "foo";
   assert_equals(window[-1], "foo");
 });
+test(() => {
+  const desc = Object.getOwnPropertyDescriptor(window, "0");
+  assert_true(desc.configurable);
+  assert_true(desc.enumerable);
+  assert_false(desc.writable);
+}, "Ensure indexed properties have the correct configuration");
 test(function() {
   window[0] = "foo";
   assert_throws(new TypeError(), () => Object.defineProperty(window, 0, { value: "bar" }))

Modified: trunk/LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt (219658 => 219659)


--- trunk/LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt	2017-07-19 18:16:21 UTC (rev 219659)
@@ -128,7 +128,7 @@
 PASS Object.getOwnPropertyDescriptor(global, 0).value is global[0]
 PASS Object.getOwnPropertyDescriptor(global, 0).hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 0).hasOwnProperty('set') is false
-PASS Object.getOwnPropertyDescriptor(global, 0).enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 0).enumerable is true
 PASS Object.getOwnPropertyDescriptor(global, 0).configurable is true
 PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).value is document.getElementsByTagName('div')[0]
 PASS Object.getOwnPropertyDescriptor(document.getElementsByTagName('div'), 0).hasOwnProperty('get') is false

Modified: trunk/LayoutTests/js/resources/getOwnPropertyDescriptor.js (219658 => 219659)


--- trunk/LayoutTests/js/resources/getOwnPropertyDescriptor.js	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/LayoutTests/js/resources/getOwnPropertyDescriptor.js	2017-07-19 18:16:21 UTC (rev 219659)
@@ -44,7 +44,7 @@
 var globalWindowGetter = Object.getOwnPropertyDescriptor(global, 'window').get;
 descriptorShouldBe("global", "'window'", {get: 'globalWindowGetter', set: undefined, enumerable: true, configurable: false});
 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"});
-descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurable: true, value:"global[0]"});
+descriptorShouldBe("global", "0", {writable: true, enumerable: true, configurable: true, value:"global[0]"});
 descriptorShouldBe("document.getElementsByTagName('div')", "0", {writable: false, enumerable: true, configurable: true, value:"document.getElementsByTagName('div')[0]"});
 descriptorShouldBe("document.getElementsByClassName('pass')", "0", {writable: false, enumerable: true, configurable: true, value:"document.getElementsByClassName('pass')[0]"});
 var canvas = document.createElement("canvas");

Modified: trunk/Source/WebCore/ChangeLog (219658 => 219659)


--- trunk/Source/WebCore/ChangeLog	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/Source/WebCore/ChangeLog	2017-07-19 18:16:21 UTC (rev 219659)
@@ -1,3 +1,28 @@
+2017-07-19  Chris Dumez  <[email protected]>
+
+        Make cross-origin properties enumerable
+        https://bugs.webkit.org/show_bug.cgi?id=174576
+
+        Reviewed by Darin Adler.
+
+        Makes cross-origin properties enumerable on Window and Location objects
+        as per:
+        - https://github.com/whatwg/html/pull/2777
+
+        This simplifies our code quite a bit.
+
+        No new tests, updated existing tests.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
+        (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
+        (WebCore::JSDOMWindow::getOwnPropertyNames):
+        * bindings/js/JSLocationCustom.cpp:
+        (WebCore::getOwnPropertySlotCommon):
+        (WebCore::JSLocation::getOwnPropertyNames):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+
 2017-07-18  Carlos Alberto Lopez Perez  <[email protected]>
 
         [EME] Build failure with Clang-3.8 on InitDataRegistry.cpp

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (219658 => 219659)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2017-07-19 18:16:21 UTC (rev 219659)
@@ -88,11 +88,11 @@
     // access below; we should try to find a way to merge the two.
     if (!frame) {
         if (propertyName == exec->propertyNames().closed) {
-            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, jsDOMWindowClosed);
+            slot.setCustom(thisObject, ReadOnly | DontDelete, jsDOMWindowClosed);
             return true;
         }
         if (propertyName == exec->propertyNames().close) {
-            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
+            slot.setCustom(thisObject, ReadOnly | DontDelete, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
             return true;
         }
 
@@ -111,19 +111,19 @@
     // These are the functions we allow access to cross-origin (DoNotCheckSecurity in IDL).
     // Always provide the original function, on a fresh uncached function object.
     if (propertyName == exec->propertyNames().blur) {
-        slot.setCustom(thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
+        slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().close) {
-        slot.setCustom(thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
+        slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().focus) {
-        slot.setCustom(thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
+        slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().postMessage) {
-        slot.setCustom(thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
+        slot.setCustom(thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
         return true;
     }
 
@@ -143,7 +143,7 @@
             || propertyName == exec->propertyNames().top) {
             bool shouldExposeSetter = propertyName == exec->propertyNames().location;
             CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, entry->propertyGetter(), shouldExposeSetter ? entry->propertyPutter() : nullptr);
-            slot.setCustomGetterSetter(thisObject, DontEnum | CustomAccessor, customGetterSetter);
+            slot.setCustomGetterSetter(thisObject, CustomAccessor, customGetterSetter);
             return true;
         }
 
@@ -160,7 +160,7 @@
     // properties that are in Moz but not IE. Since we have some of these, we have to do it
     // the Moz way.
     if (auto* scopedChild = frame->tree().scopedChild(propertyNameToAtomicString(propertyName))) {
-        slot.setValue(thisObject, ReadOnly | DontDelete | DontEnum, toJS(exec, scopedChild->document()->domWindow()));
+        slot.setValue(thisObject, ReadOnly | DontDelete, toJS(exec, scopedChild->document()->domWindow()));
         return true;
     }
 
@@ -230,7 +230,7 @@
     // (1) First, indexed properties.
     // These are also allowed cross-orgin, so come before the access check.
     if (frame && index < frame->tree().scopedChildCount()) {
-        slot.setValue(thisObject, ReadOnly | DontEnum, toJS(state, frame->tree().scopedChild(index)->document()->domWindow()));
+        slot.setValue(thisObject, ReadOnly, toJS(state, frame->tree().scopedChild(index)->document()->domWindow()));
         return true;
     }
 
@@ -295,42 +295,6 @@
     return Base::deletePropertyByIndex(thisObject, exec, propertyName);
 }
 
-uint32_t JSDOMWindow::getEnumerableLength(ExecState* exec, JSObject* object)
-{
-    JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
-    // Only allow the window to enumerated by frames in the same origin.
-    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
-        return 0;
-    return Base::getEnumerableLength(exec, thisObject);
-}
-
-void JSDOMWindow::getStructurePropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
-{
-    JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
-    // Only allow the window to enumerated by frames in the same origin.
-    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
-        return;
-    Base::getStructurePropertyNames(thisObject, exec, propertyNames, mode);
-}
-
-void JSDOMWindow::getGenericPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
-{
-    JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
-    // Only allow the window to enumerated by frames in the same origin.
-    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
-        return;
-    Base::getGenericPropertyNames(thisObject, exec, propertyNames, mode);
-}
-
-void JSDOMWindow::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
-{
-    JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
-    // Only allow the window to enumerated by frames in the same origin.
-    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
-        return;
-    Base::getPropertyNames(thisObject, exec, propertyNames, mode);
-}
-
 // https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
 static void addCrossOriginWindowPropertyNames(ExecState& state, PropertyNameArray& propertyNames)
 {
@@ -375,12 +339,10 @@
 {
     JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
 
-    if (mode.includeDontEnumProperties())
-        addScopedChildrenIndexes(*exec, thisObject->wrapped(), propertyNames);
+    addScopedChildrenIndexes(*exec, thisObject->wrapped(), propertyNames);
 
     if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped(), DoNotReportSecurityError)) {
-        if (mode.includeDontEnumProperties())
-            addCrossOriginWindowOwnPropertyNames(*exec, propertyNames);
+        addCrossOriginWindowOwnPropertyNames(*exec, propertyNames);
         return;
     }
     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);

Modified: trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp (219658 => 219659)


--- trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp	2017-07-19 18:16:21 UTC (rev 219659)
@@ -62,7 +62,7 @@
 
     // We only allow access to Location.replace() cross origin.
     if (propertyName == state.propertyNames().replace) {
-        slot.setCustom(&thisObject, ReadOnly | DontEnum, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);
+        slot.setCustom(&thisObject, ReadOnly, nonCachingStaticFunctionGetter<jsLocationInstanceFunctionReplace, 1>);
         return true;
     }
 
@@ -71,7 +71,7 @@
     if (slot.internalMethodType() == PropertySlot::InternalMethodType::GetOwnProperty && propertyName == state.propertyNames().href) {
         auto* entry = JSLocation::info()->staticPropHashTable->entry(propertyName);
         CustomGetterSetter* customGetterSetter = CustomGetterSetter::create(vm, nullptr, entry->propertyPutter());
-        slot.setCustomGetterSetter(&thisObject, DontEnum | CustomAccessor, customGetterSetter);
+        slot.setCustomGetterSetter(&thisObject, CustomAccessor, customGetterSetter);
         return true;
     }
 
@@ -185,8 +185,7 @@
 {
     JSLocation* thisObject = jsCast<JSLocation*>(object);
     if (!BindingSecurity::shouldAllowAccessToFrame(exec, thisObject->wrapped().frame(), DoNotReportSecurityError)) {
-        if (mode.includeDontEnumProperties())
-            addCrossOriginLocationOwnPropertyNames(*exec, propertyNames);
+        addCrossOriginLocationOwnPropertyNames(*exec, propertyNames);
         return;
     }
     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (219658 => 219659)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-07-19 17:27:10 UTC (rev 219658)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2017-07-19 18:16:21 UTC (rev 219659)
@@ -2556,16 +2556,6 @@
         $structureFlags{"JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero"} = 1;
     }
     
-    # FIXME: Currently only DOMWindow needs to override the getPropertyNames family of functions, but even
-    #        so, it should probably be turned into an extended attribute.
-    if ($interfaceName eq "DOMWindow") {
-        push(@headerContent, "    static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
-        push(@headerContent, "    static void getGenericPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
-        push(@headerContent, "    static void getStructurePropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
-        push(@headerContent, "    static uint32_t getEnumerableLength(JSC::ExecState*, JSC::JSObject*);\n");
-        $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
-    }
-    
     if (InstanceOverridesGetOwnPropertyNames($interface)) {
         push(@headerContent, "    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());\n");
         $structureFlags{"JSC::OverridesGetPropertyNames"} = 1;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to