Changeset 221026 in webkit


Ignore:
Timestamp:
Aug 22, 2017 11:12:10 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
https://bugs.webkit.org/show_bug.cgi?id=175797
<rdar://problem/29270035>

Patch by Alex Christensen <achristensen@webkit.org> on 2017-08-22
Reviewed by Geoffrey Garen.

Source/WebKit:

  • UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
  • UIProcess/Cocoa/UIDelegate.h:
  • UIProcess/Cocoa/UIDelegate.mm:

(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::showPage):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::registerURLSchemeHandler):
window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
make it so that URLSchemeHandlers are added to WebPages that already have them. The
assertions are no longer valid.

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2Cocoa/UIDelegate.mm: Added.

(-[UITestDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
(-[UITestDelegate _showPage:]):
(-[UITestDelegate webView:startURLSchemeTask:]):
(-[UITestDelegate webView:stopURLSchemeTask:]):
(TEST):

Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r221024 r221026  
     12017-08-22  Alex Christensen  <achristensen@webkit.org>
     2
     3        Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
     4        https://bugs.webkit.org/show_bug.cgi?id=175797
     5        <rdar://problem/29270035>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
     10        * UIProcess/Cocoa/UIDelegate.h:
     11        * UIProcess/Cocoa/UIDelegate.mm:
     12        (WebKit::UIDelegate::setDelegate):
     13        (WebKit::UIDelegate::UIClient::showPage):
     14        * WebProcess/WebPage/WebPage.cpp:
     15        (WebKit::WebPage::registerURLSchemeHandler):
     16        window.open, createWebViewWithConfiguration, and WKURLSchemeHandlers all used together
     17        make it so that URLSchemeHandlers are added to WebPages that already have them.  The
     18        assertions are no longer valid.
     19
    1202017-08-22  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h

    r220443 r221026  
    6262- (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame;
    6363
     64- (void)_showPage:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    6465- (void)_webViewClose:(WKWebView *)webView;
    6566- (void)_webViewFullscreenMayReturnToInline:(WKWebView *)webView;
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h

    r219871 r221026  
    8080    private:
    8181        // API::UIClient
    82         RefPtr<WebKit::WebPageProxy> createNewPage(WebKit::WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, WebKit::NavigationActionData&&) override;
    83         void createNewPageAsync(WebKit::WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, WebKit::NavigationActionData&&, WTF::Function<void(RefPtr<WebKit::WebPageProxy>&&)>&& completionHandler) final;
     82        RefPtr<WebPageProxy> createNewPage(WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, NavigationActionData&&) final;
     83        void createNewPageAsync(WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, NavigationActionData&&, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler) final;
    8484        bool canCreateNewPageAsync() final;
    85         RefPtr<WebKit::WebPageProxy> createNewPageCommon(WebKit::WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, WebKit::NavigationActionData&&, WTF::Function<void(RefPtr<WebKit::WebPageProxy>&&)>&& completionHandler);
     85        void showPage(WebPageProxy*) final;
     86        RefPtr<WebPageProxy> createNewPageCommon(WebPageProxy*, API::FrameInfo&, WebCore::ResourceRequest&&, const WebCore::WindowFeatures&, NavigationActionData&&, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler);
    8687
    8788        void close(WebKit::WebPageProxy*) override;
     
    132133        bool webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures : 1;
    133134        bool webViewCreateWebViewWithConfigurationForNavigationActionWindowFeaturesAsync : 1;
     135        bool showPage : 1;
    134136        bool webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler : 1;
    135137        bool webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler : 1;
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm

    r219871 r221026  
    9595    m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures = [delegate respondsToSelector:@selector(webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:)];
    9696    m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeaturesAsync = [delegate respondsToSelector:@selector(_webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:)];
     97    m_delegateMethods.showPage = [delegate respondsToSelector:@selector(_showPage:)];
    9798    m_delegateMethods.webViewRunJavaScriptAlertPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)];
    9899    m_delegateMethods.webViewRunJavaScriptConfirmPanelWithMessageInitiatedByFrameCompletionHandler = [delegate respondsToSelector:@selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)];
     
    249250
    250251    createNewPageCommon(page, originatingFrameInfo, WTFMove(request), windowFeatures, WTFMove(navigationActionData), WTFMove(completionHandler));
     252}
     253
     254void UIDelegate::UIClient::showPage(WebPageProxy*)
     255{
     256    if (!m_uiDelegate.m_delegateMethods.showPage)
     257        return;
     258    auto delegate = m_uiDelegate.m_delegate.get();
     259    ASSERT(delegate);
     260    [(id <WKUIDelegatePrivate>)delegate _showPage:m_uiDelegate.m_webView];
    251261}
    252262
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r220887 r221026  
    59335933{
    59345934    auto schemeResult = m_schemeToURLSchemeHandlerProxyMap.add(scheme, WebURLSchemeHandlerProxy::create(*this, handlerIdentifier));
    5935     ASSERT(schemeResult.isNewEntry);
    5936 
    5937     auto identifierResult = m_identifierToURLSchemeHandlerProxyMap.add(handlerIdentifier, schemeResult.iterator->value.get());
    5938     ASSERT_UNUSED(identifierResult, identifierResult.isNewEntry);
     5935    m_identifierToURLSchemeHandlerProxyMap.add(handlerIdentifier, schemeResult.iterator->value.get());
    59395936}
    59405937
  • trunk/Tools/ChangeLog

    r221011 r221026  
     12017-08-22  Alex Christensen  <achristensen@webkit.org>
     2
     3        Add UIDelegatePrivate SPI corresponding to WKPageUIClient.showPage
     4        https://bugs.webkit.org/show_bug.cgi?id=175797
     5        <rdar://problem/29270035>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKit2Cocoa/UIDelegate.mm: Added.
     11        (-[UITestDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
     12        (-[UITestDelegate _showPage:]):
     13        (-[UITestDelegate webView:startURLSchemeTask:]):
     14        (-[UITestDelegate webView:stopURLSchemeTask:]):
     15        (TEST):
     16
    1172017-08-22  Jonathan Bedard  <jbedard@apple.com>
    218
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r220964 r221026  
    233233                5C9E59421D3EB5AC00E3C62E /* ApplicationCache.db-shm in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */; };
    234234                5C9E59431D3EB5AC00E3C62E /* ApplicationCache.db-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */; };
     235                5CB40B4E1F4B98D3007DC7B9 /* UIDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */; };
    235236                5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */; };
    236237                5E4B1D2E1D404C6100053621 /* WKScrollViewDelegateCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */; };
     
    13041305                5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ApplicationCache.db-shm"; sourceTree = "<group>"; };
    13051306                5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ApplicationCache.db-wal"; sourceTree = "<group>"; };
     1307                5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIDelegate.mm; sourceTree = "<group>"; };
    13061308                5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; };
    13071309                5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegateCrash.mm; path = ../ios/WKScrollViewDelegateCrash.mm; sourceTree = "<group>"; };
     
    19421944                                2DFF7B6C1DA487AF00814614 /* SnapshotStore.mm */,
    19431945                                515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */,
     1946                                5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */,
    19441947                                7CC3E1FA197E234100BE6252 /* UserContentController.mm */,
    19451948                                7C882E031C80C624006BF731 /* UserContentWorld.mm */,
     
    33133316                                7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */,
    33143317                                7CCE7ED31A411A7E00447C4C /* TypingStyleCrash.mm in Sources */,
     3318                                5CB40B4E1F4B98D3007DC7B9 /* UIDelegate.mm in Sources */,
    33153319                                F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */,
    33163320                                7CCE7EDE1A411A9200447C4C /* URL.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.