Title: [273537] branches/safari-611-branch/Source/WebKit
Revision
273537
Author
[email protected]
Date
2021-02-25 18:52:05 -0800 (Thu, 25 Feb 2021)

Log Message

Cherry-pick r273452. rdar://problem/74753294

    [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload
    https://bugs.webkit.org/show_bug.cgi?id=222377

    Reviewed by Brent Fulgham.

    Getting this default value in the UI process instead of in every WebContent process should be a small speedup,
    since getting this default value is a bit costly on iOS.

    * Shared/WebPageCreationParameters.cpp:
    (WebKit::WebPageCreationParameters::encode const):
    (WebKit::WebPageCreationParameters::decode):
    * Shared/WebPageCreationParameters.h:
    * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added.
    * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
    (WebKit::cachedAllowsRequest):
    (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
    (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::creationParameters):
    * WebKit.xcodeproj/project.pbxproj:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::m_lastNavigationWasAppBound):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-02-26 02:52:05 UTC (rev 273537)
@@ -1,3 +1,57 @@
+2021-02-25  Russell Epstein  <[email protected]>
+
+        Cherry-pick r273452. rdar://problem/74753294
+
+    [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload
+    https://bugs.webkit.org/show_bug.cgi?id=222377
+    
+    Reviewed by Brent Fulgham.
+    
+    Getting this default value in the UI process instead of in every WebContent process should be a small speedup,
+    since getting this default value is a bit costly on iOS.
+    
+    * Shared/WebPageCreationParameters.cpp:
+    (WebKit::WebPageCreationParameters::encode const):
+    (WebKit::WebPageCreationParameters::decode):
+    * Shared/WebPageCreationParameters.h:
+    * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added.
+    * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
+    (WebKit::cachedAllowsRequest):
+    (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
+    (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
+    * UIProcess/WebPageProxy.cpp:
+    (WebKit::WebPageProxy::creationParameters):
+    * WebKit.xcodeproj/project.pbxproj:
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::m_lastNavigationWasAppBound):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-24  Per Arne Vollan  <[email protected]>
+
+            [iOS] Get default value in the UI process for whether synchronous XMLHttpRequest are allowed during unload
+            https://bugs.webkit.org/show_bug.cgi?id=222377
+
+            Reviewed by Brent Fulgham.
+
+            Getting this default value in the UI process instead of in every WebContent process should be a small speedup,
+            since getting this default value is a bit costly on iOS.
+
+            * Shared/WebPageCreationParameters.cpp:
+            (WebKit::WebPageCreationParameters::encode const):
+            (WebKit::WebPageCreationParameters::decode):
+            * Shared/WebPageCreationParameters.h:
+            * Shared/ios/WebPreferencesDefaultValuesIOS.h: Added.
+            * Shared/ios/WebPreferencesDefaultValuesIOS.mm:
+            (WebKit::cachedAllowsRequest):
+            (WebKit::allowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
+            (WebKit::setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload):
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::creationParameters):
+            * WebKit.xcodeproj/project.pbxproj:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::m_lastNavigationWasAppBound):
+
 2021-01-25  Chris Dumez  <[email protected]>
 
         Unreviewed, add missing header includes to address build issues.

Modified: branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.cpp	2021-02-26 02:52:05 UTC (rev 273537)
@@ -177,6 +177,9 @@
 #endif
     
     encoder << textInteractionEnabled;
+#if PLATFORM(IOS)
+    encoder << allowsDeprecatedSynchronousXMLHttpRequestDuringUnload;
+#endif
 }
 
 Optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder)
@@ -559,6 +562,11 @@
     if (!decoder.decode(parameters.textInteractionEnabled))
         return WTF::nullopt;
 
+#if PLATFORM(IOS)
+    if (!decoder.decode(parameters.allowsDeprecatedSynchronousXMLHttpRequestDuringUnload))
+        return WTF::nullopt;
+#endif
+
     return parameters;
 }
 

Modified: branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.h (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.h	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/Shared/WebPageCreationParameters.h	2021-02-26 02:52:05 UTC (rev 273537)
@@ -249,6 +249,10 @@
 #endif
 
     bool textInteractionEnabled { true };
+    
+#if PLATFORM(IOS)
+    bool allowsDeprecatedSynchronousXMLHttpRequestDuringUnload { false };
+#endif
 };
 
 } // namespace WebKit

Copied: branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.h (from rev 273536, branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm) (0 => 273537)


--- branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.h	                        (rev 0)
+++ branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.h	2021-02-26 02:52:05 UTC (rev 273537)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "WebPreferencesDefaultValues.h"
+
+namespace WebKit {
+
+void setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload(bool allowsRequest);
+
+} // namespace WebKit

Modified: branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/Shared/ios/WebPreferencesDefaultValuesIOS.mm	2021-02-26 02:52:05 UTC (rev 273537)
@@ -24,7 +24,7 @@
  */
 
 #import "config.h"
-#import "WebPreferencesDefaultValues.h"
+#import "WebPreferencesDefaultValuesIOS.h"
 
 #if PLATFORM(IOS_FAMILY)
 
@@ -44,10 +44,23 @@
 #endif
 
 #if !PLATFORM(MACCATALYST) && !PLATFORM(WATCHOS)
+static Optional<bool>& cachedAllowsRequest()
+{
+    static NeverDestroyed<Optional<bool>> allowsRequest;
+    return allowsRequest;
+}
+
 bool allowsDeprecatedSynchronousXMLHttpRequestDuringUnload()
 {
-    return [[PAL::getMCProfileConnectionClass() sharedConnection] effectiveBoolValueForSetting:@"allowDeprecatedWebKitSynchronousXHRLoads"] == MCRestrictedBoolExplicitYes;
+    if (!cachedAllowsRequest())
+        cachedAllowsRequest() = [[PAL::getMCProfileConnectionClass() sharedConnection] effectiveBoolValueForSetting:@"allowDeprecatedWebKitSynchronousXHRLoads"] == MCRestrictedBoolExplicitYes;
+    return *cachedAllowsRequest();
 }
+
+void setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload(bool allowsRequest)
+{
+    cachedAllowsRequest() = allowsRequest;
+}
 #endif
 
 } // namespace WebKit

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-02-26 02:52:05 UTC (rev 273537)
@@ -8020,6 +8020,10 @@
     
     parameters.textInteractionEnabled = preferences().textInteractionEnabled();
 
+#if PLATFORM(IOS)
+    parameters.allowsDeprecatedSynchronousXMLHttpRequestDuringUnload = allowsDeprecatedSynchronousXMLHttpRequestDuringUnload();
+#endif
+
     return parameters;
 }
 

Modified: branches/safari-611-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-02-26 02:52:05 UTC (rev 273537)
@@ -5431,6 +5431,7 @@
 		C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorPreferenceObserver.mm; sourceTree = "<group>"; };
 		C18FB51D242F9F76007E9875 /* WebSleepDisablerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSleepDisablerClient.cpp; sourceTree = "<group>"; };
 		C18FB51E242F9F77007E9875 /* WebSleepDisablerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSleepDisablerClient.h; sourceTree = "<group>"; };
+		C19D23DE25E6F02400FA03F3 /* WebPreferencesDefaultValuesIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebPreferencesDefaultValuesIOS.h; path = ios/WebPreferencesDefaultValuesIOS.h; sourceTree = "<group>"; };
 		C1A152D524E5A1D200978C8B /* HandleXPCEndpointMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HandleXPCEndpointMessages.h; sourceTree = "<group>"; };
 		C1A152D624E5A29A00978C8B /* HandleXPCEndpointMessages.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HandleXPCEndpointMessages.mm; sourceTree = "<group>"; };
 		C1C1B30E2540F45600D9100B /* NetworkConnectionToWebProcessMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkConnectionToWebProcessMac.mm; sourceTree = "<group>"; };
@@ -7455,6 +7456,7 @@
 				2DA944991884E4F000ED86DB /* WebIOSEventFactory.h */,
 				2DA9449A1884E4F000ED86DB /* WebIOSEventFactory.mm */,
 				2DA9449B1884E4F000ED86DB /* WebPlatformTouchPointIOS.cpp */,
+				C19D23DE25E6F02400FA03F3 /* WebPreferencesDefaultValuesIOS.h */,
 				F4AC655E22A3140E00A05607 /* WebPreferencesDefaultValuesIOS.mm */,
 				2DA9449C1884E4F000ED86DB /* WebTouchEventIOS.cpp */,
 			);

Modified: branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (273536 => 273537)


--- branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-02-26 02:52:02 UTC (rev 273536)
+++ branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-02-26 02:52:05 UTC (rev 273537)
@@ -341,6 +341,10 @@
 #endif
 #endif
 
+#if PLATFORM(IOS)
+#include "WebPreferencesDefaultValuesIOS.h"
+#endif
+
 namespace WebKit {
 using namespace JSC;
 using namespace WebCore;
@@ -602,6 +606,10 @@
 
     m_page = makeUnique<Page>(WTFMove(pageConfiguration));
 
+#if PLATFORM(IOS)
+    setAllowsDeprecatedSynchronousXMLHttpRequestDuringUnload(parameters.allowsDeprecatedSynchronousXMLHttpRequestDuringUnload);
+#endif
+
     updatePreferences(parameters.store);
 
 #if PLATFORM(IOS_FAMILY) || ENABLE(ROUTING_ARBITRATION)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to