Title: [287182] releases/WebKitGTK/webkit-2.34
Revision
287182
Author
[email protected]
Date
2021-12-17 06:20:05 -0800 (Fri, 17 Dec 2021)

Log Message

Merge r283410 - Disable new incumbent-window until it is fully implemented
https://bugs.webkit.org/show_bug.cgi?id=230261
<rdar://problem/83099726>

Reviewed by Chris Dumez and Geoffrey Garen.

LayoutTests/imported/w3c:

* web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
* web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent-expected.txt:

Source/_javascript_Core:

* interpreter/CallFrame.cpp:
(JSC::CallFrame::globalObjectOfClosestCodeBlock):
* runtime/JSObject.cpp:
(JSC::JSObject::getOwnPropertyDescriptor):
* runtime/PropertySlot.h:

Source/WebCore:

This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.

* bindings/js/JSDOMConvertCallbacks.h:
(WebCore::Converter<IDLCallbackFunction<T>>::convert):
(WebCore::Converter<IDLCallbackInterface<T>>::convert):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::callerGlobalObject):
(WebCore::legacyActiveGlobalObjectForAccessor):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::incumbentDOMWindow):
(WebCore::legacyActiveDOMWindowForAccessor):
* bindings/js/JSDOMWindowBase.h:
* bindings/scripts/CodeGeneratorJS.pm:
(GetJSCAttributesForAttribute):
(GenerateCallWith):
* page/Location.idl:

LayoutTests:

* http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/ChangeLog	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,3 +1,13 @@
+2021-10-01  Yusuke Suzuki  <[email protected]>
+
+        Disable new incumbent-window until it is fully implemented
+        https://bugs.webkit.org/show_bug.cgi?id=230261
+        <rdar://problem/83099726>
+
+        Reviewed by Chris Dumez and Geoffrey Garen.
+
+        * http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt:
+
 2021-09-08  Fujii Hironori  <[email protected]>
 
         KeyboardEvent should setDefaultHandled if EventHandler::startKeyboardScrolling returns true

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/http/tests/security/frameNavigation/context-for-location-href-gopd-expected.txt	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,2 +1,2 @@
-document.referrer = http://127.0.0.1:8000/security/frameNavigation/context-for-location-href-gopd.html
+document.referrer = http://127.0.0.1:8000/security/frameNavigation/resources/middle-frame-for-location.html
 

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/ChangeLog (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/ChangeLog	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/ChangeLog	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,3 +1,14 @@
+2021-10-01  Yusuke Suzuki  <[email protected]>
+
+        Disable new incumbent-window until it is fully implemented
+        https://bugs.webkit.org/show_bug.cgi?id=230261
+        <rdar://problem/83099726>
+
+        Reviewed by Chris Dumez and Geoffrey Garen.
+
+        * web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt:
+        * web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent-expected.txt:
+
 2021-09-01  Myles C. Maxfield  <[email protected]>
 
         CSSFontFaceSet.clear() should not clear CSS-connected members

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-settings-objects-expected.txt	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,5 +1,5 @@
 
 PASS The Function instance must be created in the Realm of the node document
 FAIL The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document assert_equals: expected "/html/webappapis/scripting/events/resources/open-window.html" but got "/html/webappapis/scripting/events/open-window.html"
-PASS The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document
+FAIL The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document assert_equals: expected "iframe" but got "parent frame"
 

Modified: releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent-expected.txt (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent-expected.txt	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent-expected.txt	2021-12-17 14:20:05 UTC (rev 287182)
@@ -2,13 +2,13 @@
 
 PASS Sanity check: this all works as expected with no promises involved
 PASS Fulfillment handler on fulfilled promise
-FAIL Fulfillment handler on fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent.html"
+FAIL Fulfillment handler on fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/current/current.html"
 PASS Rejection handler on rejected promise
-FAIL Rejection handler on rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent.html"
+FAIL Rejection handler on rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/current/current.html"
 PASS Fulfillment handler on pending-then-fulfilled promise
-FAIL Fulfillment handler on pending-then-fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent.html"
+FAIL Fulfillment handler on pending-then-fulfilled promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/current/current.html"
 PASS Rejection handler on pending-then-rejected promise
-FAIL Rejection handler on pending-then-rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent.html"
+FAIL Rejection handler on pending-then-rejected promise, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/current/current.html"
 PASS Thenable resolution
-FAIL Thenable resolution, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/promise-job-incumbent.html"
+FAIL Thenable resolution, using backup incumbent settings object stack assert_equals: expected "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/promise-job-incumbent-incumbent.html" but got "http://localhost:8800/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-job-queue/resources/current/current.html"
 

Modified: releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/ChangeLog (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/ChangeLog	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/ChangeLog	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,3 +1,17 @@
+2021-10-01  Yusuke Suzuki  <[email protected]>
+
+        Disable new incumbent-window until it is fully implemented
+        https://bugs.webkit.org/show_bug.cgi?id=230261
+        <rdar://problem/83099726>
+
+        Reviewed by Chris Dumez and Geoffrey Garen.
+
+        * interpreter/CallFrame.cpp:
+        (JSC::CallFrame::globalObjectOfClosestCodeBlock):
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::getOwnPropertyDescriptor):
+        * runtime/PropertySlot.h:
+
 2021-09-17  Mikhail R. Gadelha  <[email protected]>
 
         Fix CellTag being set 32 bits even if the base is not a cell

Modified: releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/interpreter/CallFrame.cpp (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/interpreter/CallFrame.cpp	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/interpreter/CallFrame.cpp	2021-12-17 14:20:05 UTC (rev 287182)
@@ -247,6 +247,8 @@
 
 JSGlobalObject* CallFrame::globalObjectOfClosestCodeBlock(VM& vm, CallFrame* callFrame)
 {
+    // FIXME: We need to handle JSONP interpretation case in ProgramExecutable since it does not have vm.topCallFrame.
+    // rdar://83691438
     JSGlobalObject* globalObject = nullptr;
     StackVisitor::visit(callFrame, vm, [&](StackVisitor& visitor) {
         if (visitor->isWasmFrame()) {

Modified: releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/JSObject.cpp (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/JSObject.cpp	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/JSObject.cpp	2021-12-17 14:20:05 UTC (rev 287182)
@@ -3677,6 +3677,8 @@
         ASSERT_WITH_MESSAGE(slot.isCustom(), "PropertySlot::TypeCustom is required in case of PropertyAttribute::CustomAccessor");
         descriptor.setAccessorDescriptor((slot.attributes() | PropertyAttribute::Accessor) & ~PropertyAttribute::CustomAccessor);
         JSGlobalObject* slotBaseGlobalObject = slot.slotBase()->globalObject(vm);
+        if (slot.attributes() & PropertyAttribute::DOMLegacyAccessor)
+            slotBaseGlobalObject = globalObject;
         if (slot.customGetter())
             descriptor.setGetter(createCustomGetterFunction(slotBaseGlobalObject, vm, propertyName, slot.customGetter(), slot.domAttribute()));
         if (slot.customSetter())

Modified: releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/PropertySlot.h (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/PropertySlot.h	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/_javascript_Core/runtime/PropertySlot.h	2021-12-17 14:20:05 UTC (rev 287182)
@@ -45,6 +45,7 @@
     Accessor          = 1 << 4,  // property is a getter/setter
     CustomAccessor    = 1 << 5,
     CustomValue       = 1 << 6,
+    DOMLegacyAccessor = 1 << 7, // property is a DOM legacy accessor, which holds caller's global object when it is materialized.
     CustomAccessorOrValue = CustomAccessor | CustomValue,
     AccessorOrCustomAccessorOrValue = Accessor | CustomAccessor | CustomValue,
     ReadOnlyOrAccessorOrCustomAccessor = ReadOnly | Accessor | CustomAccessor,

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2021-12-17 14:20:05 UTC (rev 287182)
@@ -1,3 +1,29 @@
+2021-10-01  Yusuke Suzuki  <[email protected]>
+
+        Disable new incumbent-window until it is fully implemented
+        https://bugs.webkit.org/show_bug.cgi?id=230261
+        <rdar://problem/83099726>
+
+        Reviewed by Chris Dumez and Geoffrey Garen.
+
+        This patch disables new incumbent-window until it is fully implemented to avoid compatibility issue.
+
+        * bindings/js/JSDOMConvertCallbacks.h:
+        (WebCore::Converter<IDLCallbackFunction<T>>::convert):
+        (WebCore::Converter<IDLCallbackInterface<T>>::convert):
+        * bindings/js/JSDOMGlobalObject.cpp:
+        (WebCore::callerGlobalObject):
+        (WebCore::legacyActiveGlobalObjectForAccessor):
+        * bindings/js/JSDOMGlobalObject.h:
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::incumbentDOMWindow):
+        (WebCore::legacyActiveDOMWindowForAccessor):
+        * bindings/js/JSDOMWindowBase.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetJSCAttributesForAttribute):
+        (GenerateCallWith):
+        * page/Location.idl:
+
 2021-12-08  Philippe Normand  <[email protected]>
 
         [GStreamer] Fill in client-name property on audio sinks

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMConvertCallbacks.h	2021-12-17 14:20:05 UTC (rev 287182)
@@ -45,11 +45,7 @@
             return nullptr;
         }
 
-        JSDOMGlobalObject* incumbentGlobalObject = &globalObject;
-        if (auto* globalObject = JSC::CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame))
-            incumbentGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(globalObject);
-        
-        return T::create(JSC::asObject(value), incumbentGlobalObject);
+        return T::create(JSC::asObject(value), &callerGlobalObject(globalObject, vm.topCallFrame));
     }
 };
 
@@ -83,11 +79,7 @@
             return nullptr;
         }
 
-        JSDOMGlobalObject* incumbentGlobalObject = &globalObject;
-        if (auto* globalObject = JSC::CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame))
-            incumbentGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(globalObject);
-
-        return T::create(JSC::asObject(value), incumbentGlobalObject);
+        return T::create(JSC::asObject(value), &callerGlobalObject(globalObject, vm.topCallFrame));
     }
 };
 

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp	2021-12-17 14:20:05 UTC (rev 287182)
@@ -60,6 +60,7 @@
 #include <_javascript_Core/JSCustomSetterFunction.h>
 #include <_javascript_Core/JSInternalPromise.h>
 #include <_javascript_Core/StructureInlines.h>
+#include <_javascript_Core/VMEntryScope.h>
 #include <_javascript_Core/VMTrapsInlines.h>
 #include <_javascript_Core/WasmStreamingCompiler.h>
 #include <_javascript_Core/WeakGCMapInlines.h>
@@ -560,4 +561,78 @@
     return nullptr;
 }
 
+static JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame, bool skipFirstFrame, bool lookUpFromVMEntryScope)
+{
+    VM& vm = lexicalGlobalObject.vm();
+    if (callFrame) {
+        class GetCallerGlobalObjectFunctor {
+        public:
+            GetCallerGlobalObjectFunctor(bool skipFirstFrame)
+                : m_skipFirstFrame(skipFirstFrame)
+            { }
+
+            StackVisitor::Status operator()(StackVisitor& visitor) const
+            {
+                if (m_skipFirstFrame) {
+                    if (!m_hasSkippedFirstFrame) {
+                        m_hasSkippedFirstFrame = true;
+                        return StackVisitor::Continue;
+                    }
+                }
+
+                if (auto* codeBlock = visitor->codeBlock())
+                    m_globalObject = codeBlock->globalObject();
+                else {
+                    ASSERT(visitor->callee().rawPtr());
+                    // FIXME: Callee is not an object if the caller is Web Assembly.
+                    // Figure out what to do here. We can probably get the global object
+                    // from the top-most Wasm Instance. https://bugs.webkit.org/show_bug.cgi?id=165721
+                    if (visitor->callee().isCell() && visitor->callee().asCell()->isObject())
+                        m_globalObject = jsCast<JSObject*>(visitor->callee().asCell())->globalObject();
+                }
+                return StackVisitor::Done;
+            }
+
+            JSC::JSGlobalObject* globalObject() const { return m_globalObject; }
+
+        private:
+            bool m_skipFirstFrame { false };
+            mutable bool m_hasSkippedFirstFrame { false };
+            mutable JSC::JSGlobalObject* m_globalObject { nullptr };
+        };
+
+        GetCallerGlobalObjectFunctor iter(skipFirstFrame);
+        callFrame->iterate(vm, iter);
+        if (iter.globalObject())
+            return *jsCast<JSDOMGlobalObject*>(iter.globalObject());
+    }
+
+    // In the case of legacyActiveGlobalObjectForAccessor, it is possible that vm.topCallFrame is nullptr when the script is evaluated as JSONP.
+    // Since we put JSGlobalObject to VMEntryScope, we can retrieve the right globalObject from that.
+    // For callerGlobalObject, we do not check vm.entryScope to keep it the old behavior.
+    if (lookUpFromVMEntryScope) {
+        if (vm.entryScope) {
+            if (auto* result = vm.entryScope->globalObject())
+                return *jsCast<JSDOMGlobalObject*>(result);
+        }
+    }
+
+    // If we cannot find JSGlobalObject in caller frames, we just return the current lexicalGlobalObject.
+    return *jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject);
+}
+
+JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    constexpr bool skipFirstFrame = true;
+    constexpr bool lookUpFromVMEntryScope = false;
+    return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
+}
+
+JSDOMGlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject& lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    constexpr bool skipFirstFrame = false;
+    constexpr bool lookUpFromVMEntryScope = true;
+    return callerGlobalObject(lexicalGlobalObject, callFrame, skipFirstFrame, lookUpFromVMEntryScope);
+}
+
 } // namespace WebCore

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.h (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.h	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMGlobalObject.h	2021-12-17 14:20:05 UTC (rev 287182)
@@ -143,6 +143,8 @@
 };
 
 JSDOMGlobalObject* toJSDOMGlobalObject(ScriptExecutionContext&, DOMWrapperWorld&);
+WEBCORE_EXPORT JSDOMGlobalObject& callerGlobalObject(JSC::JSGlobalObject&, JSC::CallFrame*);
+JSDOMGlobalObject& legacyActiveGlobalObjectForAccessor(JSC::JSGlobalObject&, JSC::CallFrame*);
 
 template<class JSClass>
 JSClass* toJSDOMGlobalObject(JSC::VM& vm, JSC::JSValue value)

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2021-12-17 14:20:05 UTC (rev 287182)
@@ -284,17 +284,12 @@
 
 DOMWindow& incumbentDOMWindow(JSGlobalObject& fallbackGlobalObject, CallFrame& callFrame)
 {
-    if (auto* globalObject = CallFrame::globalObjectOfClosestCodeBlock(fallbackGlobalObject.vm(), &callFrame))
-        return asJSDOMWindow(globalObject)->wrapped();
-    return asJSDOMWindow(&fallbackGlobalObject)->wrapped();
+    return asJSDOMWindow(&callerGlobalObject(fallbackGlobalObject, &callFrame))->wrapped();
 }
 
 DOMWindow& incumbentDOMWindow(JSGlobalObject& fallbackGlobalObject)
 {
-    VM& vm = fallbackGlobalObject.vm();
-    if (auto* globalObject = CallFrame::globalObjectOfClosestCodeBlock(vm, vm.topCallFrame))
-        return asJSDOMWindow(globalObject)->wrapped();
-    return asJSDOMWindow(&fallbackGlobalObject)->wrapped();
+    return asJSDOMWindow(&callerGlobalObject(fallbackGlobalObject, fallbackGlobalObject.vm().topCallFrame))->wrapped();
 }
 
 DOMWindow& activeDOMWindow(JSGlobalObject& lexicalGlobalObject)
@@ -308,6 +303,16 @@
     return asJSDOMWindow(vm.deprecatedVMEntryGlobalObject(&lexicalGlobalObject))->wrapped();
 }
 
+DOMWindow& legacyActiveDOMWindowForAccessor(JSGlobalObject& fallbackGlobalObject, CallFrame& callFrame)
+{
+    return asJSDOMWindow(&legacyActiveGlobalObjectForAccessor(fallbackGlobalObject, &callFrame))->wrapped();
+}
+
+DOMWindow& legacyActiveDOMWindowForAccessor(JSGlobalObject& fallbackGlobalObject)
+{
+    return asJSDOMWindow(&legacyActiveGlobalObjectForAccessor(fallbackGlobalObject, fallbackGlobalObject.vm().topCallFrame))->wrapped();
+}
+
 Document* responsibleDocument(VM& vm, CallFrame& callFrame)
 {
     CallerFunctor functor;

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.h (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.h	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/js/JSDOMWindowBase.h	2021-12-17 14:20:05 UTC (rev 287182)
@@ -126,6 +126,9 @@
 DOMWindow& activeDOMWindow(JSC::JSGlobalObject&);
 DOMWindow& firstDOMWindow(JSC::JSGlobalObject&);
 
+DOMWindow& legacyActiveDOMWindowForAccessor(JSC::JSGlobalObject&, JSC::CallFrame&);
+DOMWindow& legacyActiveDOMWindowForAccessor(JSC::JSGlobalObject&);
+
 // FIXME: This should probably be removed in favor of one of the other DOMWindow accessors. It is intended
 //        to provide the document specfied as the 'responsible document' in the algorithm for document.open()
 //        (https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps steps 4

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-12-17 14:20:05 UTC (rev 287182)
@@ -2055,6 +2055,7 @@
     push(@specials, "JSC::PropertyAttribute::DontEnum") if ($attribute->extendedAttributes->{NotEnumerable} || $isGlobalConstructor);
     push(@specials, "JSC::PropertyAttribute::ReadOnly") if IsReadonly($attribute);
     push(@specials, "JSC::PropertyAttribute::CustomAccessor") unless $isGlobalConstructor or IsJSBuiltin($interface, $attribute);
+    push(@specials, "JSC::PropertyAttribute::DOMLegacyAccessor") if $attribute->extendedAttributes->{LegacyActiveWindowForAccessor};
     push(@specials, "JSC::PropertyAttribute::DOMAttribute") if IsAcceleratedDOMAttribute($interface, $attribute);
     push(@specials, "JSC::PropertyAttribute::DOMJITAttribute") if $attribute->extendedAttributes->{DOMJIT};
     push(@specials, "JSC::PropertyAttribute::Accessor | JSC::PropertyAttribute::Builtin") if  IsJSBuiltin($interface, $attribute);
@@ -5984,6 +5985,11 @@
         AddToImplIncludes("JSDOMWindowBase.h");
         push(@callWithArgs, "incumbentDOMWindow(*$globalObject" . ($callFrameReference ? ", " . $callFrameReference : "") . ")");
     }
+    if ($codeGenerator->ExtendedAttributeContains($callWith, "LegacyActiveWindowForAccessor")) {
+        AddToImplIncludes("DOMWindow.h");
+        AddToImplIncludes("JSDOMWindowBase.h");
+        push(@callWithArgs, "legacyActiveDOMWindowForAccessor(*$globalObject" . ($callFrameReference ? ", " . $callFrameReference : "") . ")");
+    }
     if ($codeGenerator->ExtendedAttributeContains($callWith, "FirstWindow")) {
         AddToImplIncludes("DOMWindow.h");
         AddToImplIncludes("JSDOMWindowBase.h");

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/page/Location.idl (287181 => 287182)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/page/Location.idl	2021-12-17 13:55:55 UTC (rev 287181)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/page/Location.idl	2021-12-17 14:20:05 UTC (rev 287182)
@@ -43,7 +43,7 @@
     LegacyUnforgeable,
     Exposed=Window
 ] interface Location {
-    [SetterCallWith=IncumbentWindow&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow, DoNotCheckSecurityOnSetter] stringifier attribute USVString href;
 
     // FIXME: We should use IncumbentWindow once we found why https://bugs.webkit.org/show_bug.cgi?id=228943 issue occured.
     [CallWith=ActiveWindow&FirstWindow] undefined assign(USVString url);
@@ -51,13 +51,13 @@
     [CallWith=ActiveWindow] undefined reload();
 
     // URI decomposition attributes
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString protocol;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString host;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString hostname;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString port;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString pathname;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString search;
-    [SetterCallWith=IncumbentWindow&FirstWindow] attribute USVString hash;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString protocol;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString host;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString hostname;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString port;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString pathname;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString search;
+    [SetterCallWith=LegacyActiveWindowForAccessor&FirstWindow] attribute USVString hash;
 
     readonly attribute USVString origin;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to