Title: [196678] trunk/Source
Revision
196678
Author
[email protected]
Date
2016-02-16 18:34:36 -0800 (Tue, 16 Feb 2016)

Log Message

JSDOMWindow::getOwnPropertySlot should just call getStaticPropertySlot
https://bugs.webkit.org/show_bug.cgi?id=154257

Patch by Gavin Barraclough <[email protected]> on 2016-02-16
Reviewed by Chris Dumez.

Source/_javascript_Core:

* runtime/Lookup.h:
(JSC::getStaticPropertySlot):
(JSC::getStaticFunctionSlot):
(JSC::getStaticValueSlot):
    - this could all do with a little more love.
      But enforce the basic precedence:
        (1) regular storage properties always win over static table properties.
        (2) if properties have been reified, don't consult the static tables.
        (3) only if the property is not present on the object & not reified
            should the static hashtable be consulted.

Source/WebCore:

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
    - JSDOMWindow::getOwnPropertySlot should just call getStaticPropertySlot

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (196677 => 196678)


--- trunk/Source/_javascript_Core/ChangeLog	2016-02-17 02:20:52 UTC (rev 196677)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-02-17 02:34:36 UTC (rev 196678)
@@ -1,5 +1,23 @@
 2016-02-16  Gavin Barraclough  <[email protected]>
 
+        JSDOMWindow::getOwnPropertySlot should just call getStaticPropertySlot
+        https://bugs.webkit.org/show_bug.cgi?id=154257
+
+        Reviewed by Chris Dumez.
+
+        * runtime/Lookup.h:
+        (JSC::getStaticPropertySlot):
+        (JSC::getStaticFunctionSlot):
+        (JSC::getStaticValueSlot):
+            - this could all do with a little more love.
+              But enforce the basic precedence:
+                (1) regular storage properties always win over static table properties.
+                (2) if properties have been reified, don't consult the static tables.
+                (3) only if the property is not present on the object & not reified
+                    should the static hashtable be consulted.
+
+2016-02-16  Gavin Barraclough  <[email protected]>
+
         JSDOMWindow::getOwnPropertySlot should not search photo chain
         https://bugs.webkit.org/show_bug.cgi?id=154102
 

Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (196677 => 196678)


--- trunk/Source/_javascript_Core/runtime/Lookup.h	2016-02-17 02:20:52 UTC (rev 196677)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h	2016-02-17 02:34:36 UTC (rev 196678)
@@ -210,11 +210,16 @@
 template <class ThisImp, class ParentImp>
 inline bool getStaticPropertySlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
 {
-    const HashTableValue* entry = table.entry(propertyName);
+    if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot))
+        return true;
 
-    if (!entry) // not found, forward to parent
-        return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
+    if (thisObj->staticFunctionsReified())
+        return false;
 
+    auto* entry = table.entry(propertyName);
+    if (!entry)
+        return false;
+
     if (entry->attributes() & BuiltinOrFunctionOrAccessor)
         return setUpStaticFunctionSlot(exec, entry, thisObj, propertyName, slot);
 
@@ -238,7 +243,10 @@
     if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot))
         return true;
 
-    const HashTableValue* entry = table.entry(propertyName);
+    if (thisObj->staticFunctionsReified())
+        return false;
+
+    auto* entry = table.entry(propertyName);
     if (!entry)
         return false;
 
@@ -252,11 +260,16 @@
 template <class ThisImp, class ParentImp>
 inline bool getStaticValueSlot(ExecState* exec, const HashTable& table, ThisImp* thisObj, PropertyName propertyName, PropertySlot& slot)
 {
-    const HashTableValue* entry = table.entry(propertyName);
+    if (ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot))
+        return true;
 
-    if (!entry) // not found, forward to parent
-        return ParentImp::getOwnPropertySlot(thisObj, exec, propertyName, slot);
+    if (thisObj->staticFunctionsReified())
+        return false;
 
+    auto* entry = table.entry(propertyName);
+    if (!entry)
+        return false;
+
     ASSERT(!(entry->attributes() & BuiltinOrFunctionOrAccessor));
 
     if (entry->attributes() & ConstantInteger) {

Modified: trunk/Source/WebCore/ChangeLog (196677 => 196678)


--- trunk/Source/WebCore/ChangeLog	2016-02-17 02:20:52 UTC (rev 196677)
+++ trunk/Source/WebCore/ChangeLog	2016-02-17 02:34:36 UTC (rev 196678)
@@ -1,5 +1,16 @@
 2016-02-16  Gavin Barraclough  <[email protected]>
 
+        JSDOMWindow::getOwnPropertySlot should just call getStaticPropertySlot
+        https://bugs.webkit.org/show_bug.cgi?id=154257
+
+        Reviewed by Chris Dumez.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::getOwnPropertySlot):
+            - JSDOMWindow::getOwnPropertySlot should just call getStaticPropertySlot
+
+2016-02-16  Gavin Barraclough  <[email protected]>
+
         JSDOMWindow::getOwnPropertySlot should not search photo chain
         https://bugs.webkit.org/show_bug.cgi?id=154102
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (196677 => 196678)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2016-02-17 02:20:52 UTC (rev 196677)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp	2016-02-17 02:34:36 UTC (rev 196678)
@@ -252,40 +252,32 @@
     // (Particularly, is it correct that this exists here but not in getOwnPropertySlotByIndex?)
     slot.setWatchpointSet(thisObject->m_windowCloseWatchpoints);
 
-    // (2) Regular own properties.
-    // FIXME: we should probably be able to use getStaticPropertySlot here.
-    if (Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
-        return true;
-
     // FIXME: These are all bogus. Keeping these here make some tests pass that check these properties
     // are own properties of the window, but introduces other problems instead (e.g. if you overwrite
     // & delete then the original value is restored!) Should be removed.
     if (propertyName == exec->propertyNames().blur) {
-        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
+        if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
+            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionBlur, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().close) {
-        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
+        if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
+            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionClose, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().focus) {
-        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
+        if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
+            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionFocus, 0>);
         return true;
     }
     if (propertyName == exec->propertyNames().postMessage) {
-        slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
+        if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
+            slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsDOMWindowInstanceFunctionPostMessage, 2>);
         return true;
     }
-
-    if (!thisObject->staticFunctionsReified()) {
-        if (auto* entry = JSDOMWindow::info()->staticPropHashTable->entry(propertyName)) {
-            if (entry->attributes() & BuiltinOrFunctionOrAccessor)
-                return setUpStaticFunctionSlot(exec, entry, thisObject, propertyName, slot);
-            slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());
-            return true;
-        }
-    }
-
+    // (2) Regular own properties.
+    if (getStaticPropertySlot<JSDOMWindow, Base>(exec, *JSDOMWindow::info()->staticPropHashTable, thisObject, propertyName, slot))
+        return true;
     // FIXME: this looks pretty bogus. It seems highly likely that if !canShowModalDialog the
     // funtion should still be present, or should be omitted entirely - present but reads as
     // undefined with unspecified attributes is likely wrong.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to