Changeset 202700 in webkit


Ignore:
Timestamp:
Jun 30, 2016 2:17:05 PM (8 years ago)
Author:
BJ Burg
Message:

REGRESSION(r202329): WebInspectorProxy's WKPagePolicyClient callbacks are not being called
https://bugs.webkit.org/show_bug.cgi?id=159308
<rdar://problem/27111764>

Reviewed by Tim Horton.

Adopt WKPageNavigationClient and ditch WKPolicyClient and WKPageLoaderClient.
After r202329, it's not possible to set a WKPolicyClient for a WKPage/WebPageProxy that backs a WKWebView.

  • UIProcess/WebInspectorProxy.cpp:

(WebKit::isMainOrTestInspectorPage): Take a WebCore::ResourceRequest.
(WebKit::processDidCrash): Deleted.
(WebKit::webProcessDidCrash): Rename to match new client callback name.
(WebKit::decidePolicyForNavigationAction): Rework this to take new argument types.
(WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
Install a WKPageNavigationClient.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r202696 r202700  
     12016-06-30  Brian Burg  <bburg@apple.com>
     2
     3        REGRESSION(r202329): WebInspectorProxy's WKPagePolicyClient callbacks are not being called
     4        https://bugs.webkit.org/show_bug.cgi?id=159308
     5        <rdar://problem/27111764>
     6
     7        Reviewed by Tim Horton.
     8
     9        Adopt WKPageNavigationClient and ditch WKPolicyClient and WKPageLoaderClient.
     10        After r202329, it's not possible to set a WKPolicyClient for a WKPage/WebPageProxy that backs a WKWebView.
     11
     12        * UIProcess/WebInspectorProxy.cpp:
     13        (WebKit::isMainOrTestInspectorPage): Take a WebCore::ResourceRequest.
     14        (WebKit::processDidCrash): Deleted.
     15        (WebKit::webProcessDidCrash): Rename to match new client callback name.
     16        (WebKit::decidePolicyForNavigationAction): Rework this to take new argument types.
     17        (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
     18        Install a WKPageNavigationClient.
     19
    1202016-06-30  Chris Dumez  <cdumez@apple.com>
    221
  • trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp

    r202611 r202700  
    2828#include "WebInspectorProxy.h"
    2929
     30#include "APINavigationAction.h"
    3031#include "APIProcessPoolConfiguration.h"
    31 #include "APIURLRequest.h"
    3232#include "WKArray.h"
    3333#include "WKContextMenuItem.h"
     
    355355}
    356356
    357 static bool isMainOrTestInspectorPage(WKURLRequestRef requestRef)
     357static bool isMainOrTestInspectorPage(WebCore::ResourceRequest& request)
    358358{
    359359    // Use URL so we can compare the paths and protocols.
    360     const URL& requestURL = toImpl(requestRef)->resourceRequest().url();
     360    const URL& requestURL = request.url();
    361361    URL mainPageURL(URL(), WebInspectorProxy::inspectorPageURL());
    362362    if (requestURL.protocol() == mainPageURL.protocol() && decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(mainPageURL.path()))
     
    372372}
    373373
    374 static void processDidCrash(WKPageRef, const void* clientInfo)
     374static void webProcessDidCrash(WKPageRef, const void* clientInfo)
    375375{
    376376    WebInspectorProxy* webInspectorProxy = static_cast<WebInspectorProxy*>(const_cast<void*>(clientInfo));
     
    379379}
    380380
    381 static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef requestRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)
     381static void decidePolicyForNavigationAction(WKPageRef pageRef, WKNavigationActionRef navigationActionRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)
    382382{
    383383    // Allow non-main frames to navigate anywhere.
    384     if (!toImpl(frameRef)->isMainFrame()) {
     384    API::FrameInfo* sourceFrame = toImpl(navigationActionRef)->sourceFrame();
     385    if (sourceFrame && !sourceFrame->isMainFrame()) {
    385386        toImpl(listenerRef)->use();
    386387        return;
     
    390391    ASSERT(webInspectorProxy);
    391392
     393    WebCore::ResourceRequest request = toImpl(navigationActionRef)->request();
     394
    392395    // Allow loading of the main inspector file.
    393     if (isMainOrTestInspectorPage(requestRef)) {
     396    if (isMainOrTestInspectorPage(request)) {
    394397        toImpl(listenerRef)->use();
    395398        return;
     
    400403
    401404    // And instead load it in the inspected page.
    402     webInspectorProxy->inspectedPage()->loadRequest(toImpl(requestRef)->resourceRequest());
     405    webInspectorProxy->inspectedPage()->loadRequest(request);
    403406}
    404407
     
    462465    pageLevelMap().set(m_inspectorPage, inspectionLevel());
    463466
    464     WKPagePolicyClientV1 policyClient = {
    465         { 1, this },
    466         nullptr, // decidePolicyForNavigationAction_deprecatedForUseWithV0
    467         nullptr, // decidePolicyForNewWindowAction
    468         nullptr, // decidePolicyForResponse_deprecatedForUseWithV0
    469         nullptr, // unableToImplementPolicy
     467    WKPageNavigationClientV0 navigationClient = {
     468        { 0, this },
    470469        decidePolicyForNavigationAction,
    471         nullptr, // decidePolicyForResponse
    472     };
    473 
    474     WKPageLoaderClientV5 loaderClient = {
    475         { 5, this },
    476         nullptr, // didStartProvisionalLoadForFrame
    477         nullptr, // didReceiveServerRedirectForProvisionalLoadForFrame
    478         nullptr, // didFailProvisionalLoadWithErrorForFrame
    479         nullptr, // didCommitLoadForFrame
    480         nullptr, // didFinishDocumentLoadForFrame
    481         nullptr, // didFinishLoadForFrame
    482         nullptr, // didFailLoadWithErrorForFrame
    483         nullptr, // didSameDocumentNavigationForFrame
    484         nullptr, // didReceiveTitleForFrame
    485         nullptr, // didFirstLayoutForFrame
    486         nullptr, // didFirstVisuallyNonEmptyLayoutForFrame
    487         nullptr, // didRemoveFrameFromHierarchy
    488         nullptr, // didDisplayInsecureContentForFrame
    489         nullptr, // didRunInsecureContentForFrame
    490         nullptr, // canAuthenticateAgainstProtectionSpaceInFrame
    491         nullptr, // didReceiveAuthenticationChallengeInFrame
    492         nullptr, // didStartProgress
    493         nullptr, // didChangeProgress
    494         nullptr, // didFinishProgress
    495         nullptr, // didBecomeUnresponsive
    496         nullptr, // didBecomeResponsive
    497         processDidCrash,
    498         nullptr, // didChangeBackForwardList
    499         nullptr, // shouldGoToBackForwardListItem
    500         nullptr, // didFailToInitializePlugin_deprecatedForUseWithV0
    501         nullptr, // didDetectXSSForFrame
    502         nullptr, // didNewFirstVisuallyNonEmptyLayout_unavailable
    503         nullptr, // willGoToBackForwardListItem
    504         nullptr, // interactionOccurredWhileProcessUnresponsive
    505         nullptr, // pluginDidFail_deprecatedForUseWithV1
    506         nullptr, // didReceiveIntentForFrame_unavailable
    507         nullptr, // registerIntentServiceForFrame_unavailable
    508         nullptr, // didLayout
    509         nullptr, // pluginLoadPolicy_deprecatedForUseWithV2
    510         nullptr, // pluginDidFail
    511         nullptr, // pluginLoadPolicy
    512         nullptr, // webGLLoadPolicy
    513         nullptr, // resolveWebGLLoadPolicy
    514         nullptr, // shouldKeepCurrentBackForwardListItemInList
     470        nullptr, // decidePolicyForNavigationResponse
     471        nullptr, // decidePolicyForPluginLoad
     472        nullptr, // didStartProvisionalNavigation
     473        nullptr, // didReceiveServerRedirectForProvisionalNavigation
     474        nullptr, // didFailProvisionalNavigation
     475        nullptr, // didCommitNavigation
     476        nullptr, // didFinishNavigation
     477        nullptr, // didFailNavigation
     478        nullptr, // didFailProvisionalLoadInSubframe
     479        nullptr, // didFinishDocumentLoad
     480        nullptr, // didSameDocumentNavigation
     481        nullptr, // renderingProgressDidChange
     482        nullptr, // canAuthenticateAgainstProtectionSpace
     483        nullptr, // didReceiveAuthenticationChallenge
     484        webProcessDidCrash,
     485        nullptr, // copyWebCryptoMasterKey
     486
     487        nullptr, // didBeginNavigationGesture
     488        nullptr, // willEndNavigationGesture
     489        nullptr, // didEndNavigationGesture
     490        nullptr, // didRemoveNavigationGestureSnapshot
    515491    };
    516492
    517493    WKPageContextMenuClientV3 contextMenuClient = {
    518494        { 3, this },
    519         0, // getContextMenuFromProposedMenu_deprecatedForUseWithV0
    520         0, // customContextMenuItemSelected
    521         0, // contextMenuDismissed
     495        nullptr, // getContextMenuFromProposedMenu_deprecatedForUseWithV0
     496        nullptr, // customContextMenuItemSelected
     497        nullptr, // contextMenuDismissed
    522498        getContextMenuFromProposedMenu,
    523         0, // showContextMenu
    524         0, // hideContextMenu
     499        nullptr, // showContextMenu
     500        nullptr, // hideContextMenu
    525501    };
    526502
    527     WKPageSetPagePolicyClient(toAPI(m_inspectorPage), &policyClient.base);
    528     WKPageSetPageLoaderClient(toAPI(m_inspectorPage), &loaderClient.base);
     503    WKPageSetPageNavigationClient(toAPI(m_inspectorPage), &navigationClient.base);
    529504    WKPageSetPageContextMenuClient(toAPI(m_inspectorPage), &contextMenuClient.base);
    530505
Note: See TracChangeset for help on using the changeset viewer.