[macOS] API test times out after r241026
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2019 18:53:21 +0000 (18:53 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2019 18:53:21 +0000 (18:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194372

Reviewed by Alex Christensen.

The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026.
A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order
for clients to decide which milestones they would like to listen for.

* WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
(layoutMilestones):
(setUpPageLoaderClient):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h
Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h

index 71754d1..0693d2b 100644 (file)
@@ -1,3 +1,22 @@
+2019-02-07  Per Arne Vollan  <pvollan@apple.com>
+
+        [macOS] API test times out after r241026
+        https://bugs.webkit.org/show_bug.cgi?id=194372
+
+        Reviewed by Alex Christensen.
+
+        The API test TestWebKitAPI.RenderingProgress.FirstMeaningfulPaint times out after r241026.
+        A new function pointer, layoutMilestones, is added to WKBundlePageLoaderClient, in order
+        for clients to decide which milestones they would like to listen for.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h:
+        * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
+        (layoutMilestones):
+        (setUpPageLoaderClient):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::layoutMilestones const):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+
 2019-02-07  Alex Christensen  <achristensen@webkit.org>
 
         Deprecate WKBundlePageSetDefersLoading
index 040f591..737469c 100644 (file)
@@ -63,6 +63,7 @@ typedef void (*WKBundlePageFeaturesUsedInPageCallback)(WKBundlePageRef page, WKA
 typedef void (*WKBundlePageWillLoadURLRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKBundlePageWillLoadDataRequestCallback)(WKBundlePageRef page, WKURLRequestRef request, WKDataRef data, WKStringRef MIMEType, WKStringRef encodingName, WKURLRef unreachableURL, WKTypeRef userData, const void *clientInfo);
 typedef WKStringRef (*WKBundlePageUserAgentForURLCallback)(WKBundleFrameRef frame, WKURLRef url, const void *clientInfo);
+typedef WKLayoutMilestones (*WKBundlePageLayoutMilestonesCallback)(const void* clientInfo);
 
 typedef struct WKBundlePageLoaderClientBase {
     int                                                                     version;
@@ -526,4 +527,68 @@ typedef struct WKBundlePageLoaderClientV9 {
     WKBundlePageWillInjectUserScriptForFrameCallback                        willInjectUserScriptForFrame;
 } WKBundlePageLoaderClientV9;
 
+typedef struct WKBundlePageLoaderClientV10 {
+    WKBundlePageLoaderClientBase                                            base;
+
+    // Version 0.
+    WKBundlePageDidStartProvisionalLoadForFrameCallback                     didStartProvisionalLoadForFrame;
+    WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback  didReceiveServerRedirectForProvisionalLoadForFrame;
+    WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback             didFailProvisionalLoadWithErrorForFrame;
+    WKBundlePageDidCommitLoadForFrameCallback                               didCommitLoadForFrame;
+    WKBundlePageDidFinishDocumentLoadForFrameCallback                       didFinishDocumentLoadForFrame;
+    WKBundlePageDidFinishLoadForFrameCallback                               didFinishLoadForFrame;
+    WKBundlePageDidFailLoadWithErrorForFrameCallback                        didFailLoadWithErrorForFrame;
+    WKBundlePageDidSameDocumentNavigationForFrameCallback                   didSameDocumentNavigationForFrame;
+    WKBundlePageDidReceiveTitleForFrameCallback                             didReceiveTitleForFrame;
+    WKBundlePageDidFirstLayoutForFrameCallback                              didFirstLayoutForFrame;
+    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback              didFirstVisuallyNonEmptyLayoutForFrame;
+    WKBundlePageDidRemoveFrameFromHierarchyCallback                         didRemoveFrameFromHierarchy;
+    WKBundlePageDidDisplayInsecureContentForFrameCallback                   didDisplayInsecureContentForFrame;
+    WKBundlePageDidRunInsecureContentForFrameCallback                       didRunInsecureContentForFrame;
+    WKBundlePageDidClearWindowObjectForFrameCallback                        didClearWindowObjectForFrame;
+    WKBundlePageDidCancelClientRedirectForFrameCallback                     didCancelClientRedirectForFrame;
+    WKBundlePageWillPerformClientRedirectForFrameCallback                   willPerformClientRedirectForFrame;
+    WKBundlePageDidHandleOnloadEventsForFrameCallback                       didHandleOnloadEventsForFrame;
+
+    // Version 1.
+    WKBundlePageDidLayoutForFrameCallback                                   didLayoutForFrame;
+    void *                                                                  didNewFirstVisuallyNonEmptyLayout_unavailable;
+    WKBundlePageDidDetectXSSForFrameCallback                                didDetectXSSForFrame;
+    WKBundlePageShouldGoToBackForwardListItemCallback                       shouldGoToBackForwardListItem;
+    WKBundlePageGlobalObjectIsAvailableForFrameCallback                     globalObjectIsAvailableForFrame;
+    WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback    willDisconnectDOMWindowExtensionFromGlobalObject;
+    WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback        didReconnectDOMWindowExtensionToGlobalObject;
+    WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback        willDestroyGlobalObjectForDOMWindowExtension;
+
+    // Version 2
+    WKBundlePageDidFinishProgressCallback                                   didFinishProgress;
+    WKBundlePageShouldForceUniversalAccessFromLocalURLCallback              shouldForceUniversalAccessFromLocalURL;
+
+    // Version 3
+    void *                                                                  didReceiveIntentForFrame_unavailable;
+    void *                                                                  registerIntentServiceForFrame_unavailable;
+
+    // Version 4
+    WKBundlePageDidLayoutCallback                                           didLayout;
+
+    // Version 5
+    WKBundlePageFeaturesUsedInPageCallback                                  featuresUsedInPage;
+
+    // Version 6
+    WKBundlePageWillLoadURLRequestCallback                                  willLoadURLRequest;
+    WKBundlePageWillLoadDataRequestCallback                                 willLoadDataRequest;
+
+    // Version 7
+    void *                                                                  willDestroyFrame_unavailable;
+
+    // Version 8
+    WKBundlePageUserAgentForURLCallback                                     userAgentForURL;
+
+    // Version 9
+    WKBundlePageWillInjectUserScriptForFrameCallback                        willInjectUserScriptForFrame;
+
+    // Version 10
+    WKBundlePageLayoutMilestonesCallback                                    layoutMilestones;
+} WKBundlePageLoaderClientV10;
+
 #endif // WKBundlePageLoaderClient_h
index 7f18c47..8cdf095 100644 (file)
@@ -192,6 +192,18 @@ static void didReachLayoutMilestone(WKBundlePageRef page, WKLayoutMilestones mil
         [loadDelegate webProcessPlugInBrowserContextController:pluginContextController renderingProgressDidChange:renderingProgressEvents(WebKit::toLayoutMilestones(milestones))];
 }
 
+static WKLayoutMilestones layoutMilestones(const void *clientInfo)
+{
+    auto pluginContextController = (__bridge WKWebProcessPlugInBrowserContextController *)clientInfo;
+    auto loadDelegate = pluginContextController->_loadDelegate.get();
+    
+    if ([loadDelegate respondsToSelector:@selector(webProcessPlugInBrowserContextControllerRenderingProgressEvents:)]) {
+        _WKRenderingProgressEvents milestones = [loadDelegate webProcessPlugInBrowserContextControllerRenderingProgressEvents:pluginContextController];
+        return static_cast<WKLayoutMilestones>(milestones);
+    }
+    return { };
+}
+
 static void didFirstVisuallyNonEmptyLayoutForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo)
 {
     auto pluginContextController = (__bridge WKWebProcessPlugInBrowserContextController *)clientInfo;
@@ -229,10 +241,10 @@ static WKStringRef userAgentForURL(WKBundleFrameRef frame, WKURLRef url, const v
 
 static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebKit::WebPage& page)
 {
-    WKBundlePageLoaderClientV9 client;
+    WKBundlePageLoaderClientV10 client;
     memset(&client, 0, sizeof(client));
 
-    client.base.version = 8;
+    client.base.version = 10;
     client.base.clientInfo = (__bridge void*)contextController;
     client.didStartProvisionalLoadForFrame = didStartProvisionalLoadForFrame;
     client.didReceiveServerRedirectForProvisionalLoadForFrame = didReceiveServerRedirectForProvisionalLoadForFrame;
@@ -250,6 +262,7 @@ static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *co
 
     client.didLayoutForFrame = didLayoutForFrame;
     client.didLayout = didReachLayoutMilestone;
+    client.layoutMilestones = layoutMilestones;
 
     WKBundlePageSetPageLoaderClient(toAPI(&page), &client.base);
 }
index 1805e38..6b0c6c6 100644 (file)
@@ -365,6 +365,11 @@ String InjectedBundlePageLoaderClient::userAgentForURL(WebFrame& frame, const UR
 
 OptionSet<WebCore::LayoutMilestone> InjectedBundlePageLoaderClient::layoutMilestones() const
 {
+    if (m_client.layoutMilestones) {
+        auto milestones = m_client.layoutMilestones(m_client.base.clientInfo);
+        return toLayoutMilestones(milestones);
+    }
+    
     OptionSet<WebCore::LayoutMilestone> milestones;
     if (m_client.didFirstLayoutForFrame)
         milestones.add(WebCore::DidFirstLayout);
index 6d3e492..38e5b40 100644 (file)
@@ -36,7 +36,7 @@ class Object;
 class String;
 
 template<> struct ClientTraits<WKBundlePageLoaderClientBase> {
-    typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8, WKBundlePageLoaderClientV9> Versions;
+    typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8, WKBundlePageLoaderClientV9, WKBundlePageLoaderClientV10> Versions;
 };
 }