WebKit Bugzilla
Attachment 340379 Details for
Bug 185630
: Add an API test to guard against regressions while re-entering setDefersLoading:
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
p1 (text/plain), 25.36 KB, created by
Brady Eidson
on 2018-05-14 16:59:14 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brady Eidson
Created:
2018-05-14 16:59:14 PDT
Size:
25.36 KB
patch
obsolete
>diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 96da9743619..c8f9ced7562 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-14 Brady Eidson <beidson@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 Chris Dumez <cdumez@apple.com> > > Overly aggressive timer throttling in service workers >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 7aa41a8e5f9..23bcfd72c66 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -6380,6 +6380,11 @@ - (BOOL)_completeBackSwipeForTesting > #endif > } > >+- (void)_setDefersLoadingForTesting:(BOOL)defersLoading >+{ >+ _page->setDefersLoadingForTesting(defersLoading); >+} >+ > @end > > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >index 4dcb5d6c919..049d90ad874 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h >@@ -461,6 +461,7 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) { > > - (BOOL)_beginBackSwipeForTesting; > - (BOOL)_completeBackSwipeForTesting; >+- (void)_setDefersLoadingForTesting:(BOOL)defersLoading; > > @end > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index ee2595165ee..9c3b12c126f 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -7691,4 +7691,9 @@ void WebPageProxy::reportPageLoadResult(const ResourceError& error) > } > } > >+void WebPageProxy::setDefersLoadingForTesting(bool defersLoading) >+{ >+ m_process->send(Messages::WebPage::SetDefersLoading(defersLoading), m_pageID); >+} >+ > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index b0f98675be6..4e995e1860d 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1307,6 +1307,8 @@ public: > 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(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 82b20282aa2..888b996a629 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -520,4 +520,6 @@ messages -> WebPage LegacyReceiver { > #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) > OpenGLDisplayMaskChanged(uint32_t displayMask) > #endif >+ >+ SetDefersLoading(bool defersLoading) > } >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 8f237d50a91..b30d9172f94 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2018-05-14 Brady Eidson <beidson@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 <dabates@apple.com> > > [iOS] Add a test to ensure that setTimeout() does not fire more than expected when using UIWebView >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 2c5b20a6fd1..b20baacb181 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -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 */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm >new file mode 100644 >index 00000000000..aea1e35621d >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoading.mm >@@ -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 = adoptNS([[NSData 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 >+ >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm >new file mode 100644 >index 00000000000..ee72d96ba3b >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DoubleDefersLoadingPlugin.mm >@@ -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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185630
:
340364
|
340370
| 340379