Diff
Modified: trunk/Source/WebKit/ChangeLog (231784 => 231785)
--- trunk/Source/WebKit/ChangeLog 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/ChangeLog 2018-05-15 03:09:19 UTC (rev 231785)
@@ -1,3 +1,19 @@
+2018-05-14 Brady Eidson <beid...@apple.com>
+
+ Add an API test to guard against regressions while re-entering setDefersLoading:.
+ <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setDefersLoadingForTesting:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setDefersLoadingForTesting):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2018-05-14 Tim Horton <timothy_hor...@apple.com>
Use the system font by default in extra zoom mode
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (231784 => 231785)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-05-15 03:09:19 UTC (rev 231785)
@@ -6380,6 +6380,11 @@
#endif
}
+- (void)_setDefersLoadingForTesting:(BOOL)defersLoading
+{
+ _page->setDefersLoadingForTesting(defersLoading);
+}
+
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (231784 => 231785)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2018-05-15 03:09:19 UTC (rev 231785)
@@ -461,6 +461,7 @@
- (BOOL)_beginBackSwipeForTesting;
- (BOOL)_completeBackSwipeForTesting;
+- (void)_setDefersLoadingForTesting:(BOOL)defersLoading;
@end
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (231784 => 231785)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 03:09:19 UTC (rev 231785)
@@ -7691,4 +7691,9 @@
}
}
+void WebPageProxy::setDefersLoadingForTesting(bool defersLoading)
+{
+ m_process->send(Messages::WebPage::SetDefersLoading(defersLoading), m_pageID);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (231784 => 231785)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-05-15 03:09:19 UTC (rev 231785)
@@ -1307,6 +1307,8 @@
SuspendedPageProxy* suspendedPage() const { return m_suspendedPage.get(); }
void suspendedPageClosed(SuspendedPageProxy&);
+ void setDefersLoadingForTesting(bool);
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (231784 => 231785)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2018-05-15 03:09:19 UTC (rev 231785)
@@ -520,4 +520,6 @@
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
OpenGLDisplayMaskChanged(uint32_t displayMask)
#endif
+
+ SetDefersLoading(bool defersLoading)
}
Modified: trunk/Tools/ChangeLog (231784 => 231785)
--- trunk/Tools/ChangeLog 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Tools/ChangeLog 2018-05-15 03:09:19 UTC (rev 231785)
@@ -1,3 +1,22 @@
+2018-05-14 Brady Eidson <beid...@apple.com>
+
+ Add an API test to guard against regressions while re-entering setDefersLoading:.
+ <rdar://problem/37033737> and https://bugs.webkit.org/show_bug.cgi?id=185630
+
+ Reviewed by Chris Dumez.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm: Added.
+ (-[DoubleDefersNavigationDelegate _webView:navigation:didSameDocumentNavigation:]):
+ (-[DoubleDefersNavigationDelegate webView:didFinishNavigation:]):
+ (-[DefersScheme initWithBytes:]):
+ (-[DefersScheme webView:startURLSchemeTask:]):
+ (-[DefersScheme webView:stopURLSchemeTask:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm: Added.
+ (-[DoubleDefersLoadingPlugIn webProcessPlugIn:didCreateBrowserContextController:]):
+ (-[DoubleDefersLoadingPlugIn webProcessPlugInBrowserContextController:didSameDocumentNavigation:forFrame:]):
+ (-[DoubleDefersLoadingPlugIn dealloc]):
+
2018-05-14 Daniel Bates <daba...@apple.com>
[iOS] Add a test to ensure that setTimeout() does not fire more than expected when using UIWebView
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (231784 => 231785)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-05-15 03:00:27 UTC (rev 231784)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-05-15 03:09:19 UTC (rev 231785)
@@ -85,7 +85,6 @@
2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */; };
2DB647881F4163D60051A89E /* WKWebViewDoesNotLogDuringInitialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DB647871F4161F70051A89E /* WKWebViewDoesNotLogDuringInitialization.mm */; };
2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */; };
- 2DC60E231E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */; };
2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
2DE71AFE1D49C0BD00904094 /* AnimatedResize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DE71AFD1D49C0BD00904094 /* AnimatedResize.mm */; };
2DE71B001D49C3ED00904094 /* blinking-div.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DE71AFF1D49C2F000904094 /* blinking-div.html */; };
@@ -188,6 +187,10 @@
517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
5182C22E1F2BCE540059BA7C /* WKURLSchemeHandler-leaks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5182C22D1F2BCB410059BA7C /* WKURLSchemeHandler-leaks.mm */; };
518C1153205B0504001FF4AE /* ProcessSwapOnNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518C1152205B04F9001FF4AE /* ProcessSwapOnNavigation.mm */; };
+ 518EE51820A78CE200E024F3 /* DoubleDefersLoading.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518EE51620A78CDF00E024F3 /* DoubleDefersLoading.mm */; };
+ 518EE51920A78CE500E024F3 /* DoubleDefersLoadingPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518EE51720A78CDF00E024F3 /* DoubleDefersLoadingPlugin.mm */; };
+ 518EE51B20A78D0000E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518EE51A20A78CFB00E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm */; };
+ 518EE51D20A78D3600E024F3 /* DecidePolicyForNavigationAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518EE51C20A78D3300E024F3 /* DecidePolicyForNavigationAction.mm */; };
5198A2401EA7E59F008910B7 /* InitialWarmedProcessUsed.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */; };
51A5877D1D1B49CD004BA9AF /* IndexedDBMultiProcess-3.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */; };
51A587851D2739E3004BA9AF /* IndexedDBDatabaseProcessKill-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51A587821D272EB5004BA9AF /* IndexedDBDatabaseProcessKill-1.html */; };
@@ -736,7 +739,6 @@
CEBCA1391E3A807A00C73293 /* page-with-csp-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1341E3A803400C73293 /* page-with-csp-iframe.html */; };
CEBCA13A1E3A807A00C73293 /* page-without-csp.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1371E3A803400C73293 /* page-without-csp.html */; };
CEBCA13B1E3A807A00C73293 /* page-without-csp-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */; };
- CEC16EA51EE863C000DE479A /* DecidePolicyForNavigationAction.mm in Sources */ = {isa = PBXBuildFile; fileRef = CEC16EA41EE863BF00DE479A /* DecidePolicyForNavigationAction.mm */; };
D34E08761E4E42E1005FF14A /* WKWebViewGetContents.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */; };
E1220DCA155B28AA0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E1220DC9155B287D0013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.html */; };
E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
@@ -1249,7 +1251,6 @@
2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InteractionDeadlockAfterCrash.mm; sourceTree = "<group>"; };
2DB647871F4161F70051A89E /* WKWebViewDoesNotLogDuringInitialization.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewDoesNotLogDuringInitialization.mm; sourceTree = "<group>"; };
2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; };
- 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DoAfterNextPresentationUpdateAfterCrash.mm; sourceTree = "<group>"; };
2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoLayoutIntegration.mm; sourceTree = "<group>"; };
2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeReversePaginatedWebView.cpp; sourceTree = "<group>"; };
2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "lots-of-text-vertical-lr.html"; sourceTree = "<group>"; };
@@ -1393,6 +1394,10 @@
517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
5182C22D1F2BCB410059BA7C /* WKURLSchemeHandler-leaks.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "WKURLSchemeHandler-leaks.mm"; sourceTree = "<group>"; };
518C1152205B04F9001FF4AE /* ProcessSwapOnNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProcessSwapOnNavigation.mm; sourceTree = "<group>"; };
+ 518EE51620A78CDF00E024F3 /* DoubleDefersLoading.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DoubleDefersLoading.mm; sourceTree = "<group>"; };
+ 518EE51720A78CDF00E024F3 /* DoubleDefersLoadingPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DoubleDefersLoadingPlugin.mm; sourceTree = "<group>"; };
+ 518EE51A20A78CFB00E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DoAfterNextPresentationUpdateAfterCrash.mm; sourceTree = "<group>"; };
+ 518EE51C20A78D3300E024F3 /* DecidePolicyForNavigationAction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DecidePolicyForNavigationAction.mm; sourceTree = "<group>"; };
5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InitialWarmedProcessUsed.mm; sourceTree = "<group>"; };
51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBMultiProcess-3.html"; sourceTree = "<group>"; };
51A587821D272EB5004BA9AF /* IndexedDBDatabaseProcessKill-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBDatabaseProcessKill-1.html"; sourceTree = "<group>"; };
@@ -1891,7 +1896,6 @@
CEBCA1351E3A803400C73293 /* page-with-csp.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-with-csp.html"; sourceTree = "<group>"; };
CEBCA1361E3A803400C73293 /* page-without-csp-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-without-csp-iframe.html"; sourceTree = "<group>"; };
CEBCA1371E3A803400C73293 /* page-without-csp.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "page-without-csp.html"; sourceTree = "<group>"; };
- CEC16EA41EE863BF00DE479A /* DecidePolicyForNavigationAction.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DecidePolicyForNavigationAction.mm; sourceTree = "<group>"; };
D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewGetContents.mm; sourceTree = "<group>"; };
DC69AA621CF77C6500C6272F /* ScopedLambda.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedLambda.cpp; sourceTree = "<group>"; };
E1220D9F155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCacheDisableWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
@@ -2175,9 +2179,11 @@
9999108A1F393C8B008AD455 /* Copying.mm */,
9B7A37C21F8AEBA5004AA228 /* CopyURL.mm */,
2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */,
- CEC16EA41EE863BF00DE479A /* DecidePolicyForNavigationAction.mm */,
+ 518EE51C20A78D3300E024F3 /* DecidePolicyForNavigationAction.mm */,
CEA7F57B20895F5B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm */,
- 2DC60E221E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm */,
+ 518EE51A20A78CFB00E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm */,
+ 518EE51620A78CDF00E024F3 /* DoubleDefersLoading.mm */,
+ 518EE51720A78CDF00E024F3 /* DoubleDefersLoadingPlugin.mm */,
A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
A15502281E05020B00A24C57 /* DuplicateCompletionHandlerCalls.mm */,
F44D06461F395C4D001A0E29 /* EditorStateTests.mm */,
@@ -3523,7 +3529,7 @@
2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */,
F4D4F3B61E4E2BCB00BB2767 /* DataInteractionSimulator.mm in Sources */,
F4D4F3B91E4E36E400BB2767 /* DataInteractionTests.mm in Sources */,
- CEC16EA51EE863C000DE479A /* DecidePolicyForNavigationAction.mm in Sources */,
+ 518EE51D20A78D3600E024F3 /* DecidePolicyForNavigationAction.mm in Sources */,
2D1646E21D1862CD00015A1A /* DeferredViewInWindowStateChange.mm in Sources */,
7CCE7EB91A411A7E00447C4C /* DeviceScaleFactorInDashboardRegions.mm in Sources */,
7CCE7EBA1A411A7E00447C4C /* DeviceScaleFactorOnBack.mm in Sources */,
@@ -3532,7 +3538,7 @@
7CCE7EE91A411AE600447C4C /* DidAssociateFormControls.cpp in Sources */,
7CCE7EEA1A411AE600447C4C /* DidNotHandleKeyDown.cpp in Sources */,
AD57AC211DA7465B00FF1BDE /* DidRemoveFrameFromHiearchyInPageCache.cpp in Sources */,
- 2DC60E231E79F88C00FA6C7D /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */,
+ 518EE51B20A78D0000E024F3 /* DoAfterNextPresentationUpdateAfterCrash.mm in Sources */,
7CCE7EEB1A411AE600447C4C /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
7CCE7EBB1A411A7E00447C4C /* DOMHTMLTableCellCellAbove.mm in Sources */,
2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */,
@@ -3541,6 +3547,7 @@
7CCE7EBD1A411A7E00447C4C /* DOMRangeOfString.mm in Sources */,
7CCE7EEC1A411AE600447C4C /* DOMWindowExtensionBasic.cpp in Sources */,
7CCE7EED1A411AE600447C4C /* DOMWindowExtensionNoCache.cpp in Sources */,
+ 518EE51820A78CE200E024F3 /* DoubleDefersLoading.mm in Sources */,
7CCE7F231A411AF600447C4C /* Download.mm in Sources */,
7CCE7EEE1A411AE600447C4C /* DownloadDecideDestinationCrash.cpp in Sources */,
F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */,
@@ -3876,6 +3883,7 @@
5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */,
A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */,
CEA7F57D2089624B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm in Sources */,
+ 518EE51920A78CE500E024F3 /* DoubleDefersLoadingPlugin.mm in Sources */,
5CB5B3C21FFC55CF00C27BB0 /* FrameHandleSerialization.mm in Sources */,
79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */,
A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm (0 => 231785)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm 2018-05-15 03:09:19 UTC (rev 231785)
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import "Utilities.h"
+#import "WKWebViewConfigurationExtras.h"
+#import <WebKit/WKFoundation.h>
+#import <WebKit/WKNavigationDelegatePrivate.h>
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+#import <wtf/RetainPtr.h>
+
+static bool done;
+
+@interface DoubleDefersNavigationDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation DoubleDefersNavigationDelegate
+
+- (void)_webView:(WKWebView *)webView navigation:(WKNavigation *)navigation didSameDocumentNavigation:(_WKSameDocumentNavigationType)navigationType
+{
+ done = true;
+}
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ done = true;
+}
+
+@end
+
+@interface DefersScheme : NSObject <WKURLSchemeHandler> {
+ const char* _bytes;
+}
+- (instancetype)initWithBytes:(const char*)bytes;
+@end
+
+@implementation DefersScheme
+
+- (instancetype)initWithBytes:(const char*)bytes
+{
+ self = [super init];
+ _bytes = bytes;
+ return self;
+}
+
+- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
+{
+ RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:1 textEncodingName:nil]);
+ [task didReceiveResponse:response.get()];
+
+ RetainPtr<NSData> data = "" alloc] initWithBytesNoCopy:(void *)_bytes length:strlen(_bytes) freeWhenDone:NO]);
+ [task didReceiveData:data.get()];
+
+ [task didFinish];
+}
+
+- (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)task
+{
+}
+
+@end
+
+static const char* testBytes = R"DEFERSRESOURCE(
+Hello<br>
+<div id="fragment">There</div>
+)DEFERSRESOURCE";
+
+
+TEST(WebKit, DoubleDefersLoading)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = retainPtr([WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"DoubleDefersLoadingPlugIn"]);
+
+ _WKProcessPoolConfiguration *processPoolConfiguration = [configuration processPool]._configuration;
+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration]);
+ [processPool _setObject:@"DoubleDefersLoadingPlugIn" forBundleParameter:TestWebKitAPI::Util::TestPlugInClassNameParameter];
+ [configuration setProcessPool:processPool.get()];
+
+ RetainPtr<DefersScheme> handler = adoptNS([[DefersScheme alloc] initWithBytes:testBytes]);
+ [configuration setURLSchemeHandler:handler.get() forURLScheme:@"defers"];
+
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ auto delegate = adoptNS([[DoubleDefersNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:delegate.get()];
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"defers://host/main1.html"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+
+ request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"defers://host/main1.html#fragment"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+
+ [webView _setDefersLoadingForTesting:YES];
+ [webView goBack];
+ [webView _setDefersLoadingForTesting:NO];
+
+ TestWebKitAPI::Util::run(&done);
+ done = false;
+}
+
+#endif // WK_API_ENABLED
+
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm (0 => 231785)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm 2018-05-15 03:09:19 UTC (rev 231785)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#import "config.h"
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKWebProcessPlugIn.h>
+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h>
+#import <WebKit/WKWebProcessPlugInFrame.h>
+#import <WebKit/WKWebProcessPlugInLoadDelegate.h>
+#import <wtf/RetainPtr.h>
+
+@interface DoubleDefersLoadingPlugIn : NSObject <WKWebProcessPlugIn, WKWebProcessPlugInLoadDelegate>
+@end
+
+@implementation DoubleDefersLoadingPlugIn {
+ int _sameDocCount;
+}
+
+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController
+{
+ browserContextController.loadDelegate = self;
+}
+
+- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller didSameDocumentNavigation:(_WKSameDocumentNavigationType)navigationType forFrame:(WKWebProcessPlugInFrame *)frame
+{
+ if (_sameDocCount == 2)
+ [controller _setDefersLoading:NO];
+
+ ++_sameDocCount;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+#endif // WK_API_ENABLED