Title: [274455] trunk
Revision
274455
Author
commit-qu...@webkit.org
Date
2021-03-15 17:37:11 -0700 (Mon, 15 Mar 2021)

Log Message

REGRESSION(r271642) Another app was relying on DOMWindow reuse
https://bugs.webkit.org/show_bug.cgi?id=223217
<rdar://75186172>

Patch by Alex Christensen <achristen...@webkit.org> on 2021-03-15
Reviewed by Geoff Garen.

Source/WebCore:

We already fixed an app in r273817 but in rdar://75186172 we have another broken app.
It's time for a linkedOnOrAfter check.

* bindings/js/JSWindowProxy.cpp:
(WebCore::JSWindowProxy::setWindow):
* platform/cocoa/VersionChecks.h:

Source/WebKit:

* UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _setLinkedOnOrBeforeEverythingForTesting]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:

Source/WTF:

* Scripts/Preferences/WebPreferencesInternal.yaml:

Tools:

* TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (274454 => 274455)


--- trunk/Source/WTF/ChangeLog	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WTF/ChangeLog	2021-03-16 00:37:11 UTC (rev 274455)
@@ -1,3 +1,13 @@
+2021-03-15  Alex Christensen  <achristen...@webkit.org>
+
+        REGRESSION(r271642) Another app was relying on DOMWindow reuse
+        https://bugs.webkit.org/show_bug.cgi?id=223217
+        <rdar://75186172>
+
+        Reviewed by Geoff Garen.
+
+        * Scripts/Preferences/WebPreferencesInternal.yaml:
+
 2021-03-15  Rob Buis  <rb...@igalia.com>
 
         Turn CSS aspect-ratio on by default

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (274454 => 274455)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-03-16 00:37:11 UTC (rev 274455)
@@ -884,18 +884,6 @@
     WebKit:
       default: true
 
-WindowObjectAlwaysInitializedWithSecurityOriginEnabled:
-  type: bool
-  humanReadableName: "Ensure Window object is initialized with a security origin"
-  humanReadableDescription: "Ensure Window object is initialized with a security origin"
-  defaultValue:
-    WebKitLegacy:
-      default: false
-    WebKit:
-      default: true
-    WebCore:
-      default: true
-
 ZoomOnDoubleTapWhenRoot:
   type: bool
   condition: PLATFORM(IOS_FAMILY)

Modified: trunk/Source/WebCore/ChangeLog (274454 => 274455)


--- trunk/Source/WebCore/ChangeLog	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebCore/ChangeLog	2021-03-16 00:37:11 UTC (rev 274455)
@@ -1,3 +1,18 @@
+2021-03-15  Alex Christensen  <achristen...@webkit.org>
+
+        REGRESSION(r271642) Another app was relying on DOMWindow reuse
+        https://bugs.webkit.org/show_bug.cgi?id=223217
+        <rdar://75186172>
+
+        Reviewed by Geoff Garen.
+
+        We already fixed an app in r273817 but in rdar://75186172 we have another broken app.
+        It's time for a linkedOnOrAfter check.
+
+        * bindings/js/JSWindowProxy.cpp:
+        (WebCore::JSWindowProxy::setWindow):
+        * platform/cocoa/VersionChecks.h:
+
 2021-03-15  John Wilander  <wilan...@apple.com>
 
         PCM: Split attributionReportURL() into attributionReportSourceURL() and attributionReportAttributeOnURL()

Modified: trunk/Source/WebCore/bindings/js/JSWindowProxy.cpp (274454 => 274455)


--- trunk/Source/WebCore/bindings/js/JSWindowProxy.cpp	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebCore/bindings/js/JSWindowProxy.cpp	2021-03-16 00:37:11 UTC (rev 274455)
@@ -42,6 +42,10 @@
 #include <_javascript_Core/JSObject.h>
 #include <_javascript_Core/StrongInlines.h>
 
+#if PLATFORM(COCOA)
+#include "VersionChecks.h"
+#endif
+
 namespace WebCore {
 
 using namespace JSC;
@@ -106,7 +110,11 @@
         auto& localWindow = downcast<DOMWindow>(domWindow);
         auto& windowStructure = *JSDOMWindow::createStructure(vm, nullptr, prototype);
         window = JSDOMWindow::create(vm, &windowStructure, localWindow, this);
-        if (!localWindow.document()->haveInitializedSecurityOrigin() && localWindow.document()->settings().windowObjectAlwaysInitializedWithSecurityOriginEnabled())
+        bool linkedWithNewSDK = true;
+#if PLATFORM(COCOA)
+        linkedWithNewSDK = linkedOnOrAfter(SDKVersion::FirstWithDOMWindowReuseRestriction);
+#endif
+        if (!localWindow.document()->haveInitializedSecurityOrigin() && linkedWithNewSDK)
             localWindow.setAsWrappedWithoutInitializedSecurityOrigin();
     }
 

Modified: trunk/Source/WebCore/platform/cocoa/VersionChecks.h (274454 => 274455)


--- trunk/Source/WebCore/platform/cocoa/VersionChecks.h	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebCore/platform/cocoa/VersionChecks.h	2021-03-16 00:37:11 UTC (rev 274455)
@@ -69,6 +69,7 @@
     FirstThatObservesClassProperty = DYLD_IOS_VERSION_14_5,
     FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_IOS_VERSION_15_0,
     FirstWithoutWeChatScrollingQuirk = DYLD_IOS_VERSION_14_5,
+    FirstWithDOMWindowReuseRestriction  = DYLD_IOS_VERSION_14_5,
 #elif PLATFORM(MAC)
     FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
@@ -89,6 +90,7 @@
     FirstWithDataURLFragmentRemoval = DYLD_MACOSX_VERSION_11_3,
     FirstWithHTMLDocumentSupportedPropertyNames = DYLD_MACOSX_VERSION_11_3,
     FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
+    FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_11_3,
 #endif
 };
 

Modified: trunk/Source/WebKit/ChangeLog (274454 => 274455)


--- trunk/Source/WebKit/ChangeLog	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebKit/ChangeLog	2021-03-16 00:37:11 UTC (rev 274455)
@@ -1,3 +1,15 @@
+2021-03-15  Alex Christensen  <achristen...@webkit.org>
+
+        REGRESSION(r271642) Another app was relying on DOMWindow reuse
+        https://bugs.webkit.org/show_bug.cgi?id=223217
+        <rdar://75186172>
+
+        Reviewed by Geoff Garen.
+
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (+[WKProcessPool _setLinkedOnOrBeforeEverythingForTesting]):
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+
 2021-03-15  John Wilander  <wilan...@apple.com>
 
         PCM: Split attributionReportURL() into attributionReportSourceURL() and attributionReportAttributeOnURL()

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (274454 => 274455)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm	2021-03-16 00:37:11 UTC (rev 274455)
@@ -484,6 +484,11 @@
 #endif
 }
 
++ (void)_setLinkedOnOrBeforeEverythingForTesting
+{
+    setApplicationSDKVersion(0);
+}
+
 + (void)_setLinkedOnOrAfterEverythingForTesting
 {
     setApplicationSDKVersion(std::numeric_limits<uint32_t>::max());

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (274454 => 274455)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2021-03-16 00:37:11 UTC (rev 274455)
@@ -118,6 +118,7 @@
 // Test only. Should be called before any web content processes are launched.
 + (void)_forceGameControllerFramework WK_API_AVAILABLE(macos(10.13), ios(11.0));
 + (void)_setLinkedOnOrAfterEverythingForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
++ (void)_setLinkedOnOrBeforeEverythingForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 - (void)_preconnectToServer:(NSURL *)serverURL WK_API_DEPRECATED_WITH_REPLACEMENT("WKWebView._preconnectToServer", macos(10.13.4, 10.15.4), ios(11.3, 13.4));
 

Modified: trunk/Tools/ChangeLog (274454 => 274455)


--- trunk/Tools/ChangeLog	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Tools/ChangeLog	2021-03-16 00:37:11 UTC (rev 274455)
@@ -1,3 +1,14 @@
+2021-03-15  Alex Christensen  <achristen...@webkit.org>
+
+        REGRESSION(r271642) Another app was relying on DOMWindow reuse
+        https://bugs.webkit.org/show_bug.cgi?id=223217
+        <rdar://75186172>
+
+        Reviewed by Geoff Garen.
+
+        * TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm:
+        (TestWebKitAPI::TEST):
+
 2021-03-15  John Wilander  <wilan...@apple.com>
 
         PCM: Split attributionReportURL() into attributionReportSourceURL() and attributionReportAttributeOnURL()

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm (274454 => 274455)


--- trunk/Tools/TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm	2021-03-16 00:24:05 UTC (rev 274454)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/JSWrapperForNodeInWebFrame.mm	2021-03-16 00:37:11 UTC (rev 274455)
@@ -25,6 +25,7 @@
 
 #import "config.h"
 #import "PlatformUtilities.h"
+#import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebScriptWorld.h>
@@ -98,6 +99,7 @@
 
 TEST(WebKitLegacy, JSDOMWindowWrapperBeforeOriginInitialization)
 {
+    [WKProcessPool _setLinkedOnOrBeforeEverythingForTesting];
     auto webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
     auto frameLoadDelegate = adoptNS([[JSWrapperForNodeFrameLoadDelegate alloc] init]);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to