Changeset 241963 in webkit


Ignore:
Timestamp:
Feb 22, 2019 1:17:37 PM (5 years ago)
Author:
Chris Dumez
Message:

Regression(PSON) Unable to preview password-protected documents on iCloud.com
https://bugs.webkit.org/show_bug.cgi?id=194954
<rdar://problem/48127957>

Reviewed by Alex Christensen.

Source/WebKit:

Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related
IPC on iOS.

  • UIProcess/ProvisionalPageProxy.cpp:

(WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
(WebKit::ProvisionalPageProxy::didReceiveMessage):

  • UIProcess/ProvisionalPageProxy.h:
  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
(WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared):

Tools:

Add API test coverage.

  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

(-[PSONNavigationDelegate _webViewDidRequestPasswordForQuickLookDocument:]):
(-[PSONNavigationDelegate _webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:]):
(-[PSONNavigationDelegate _webView:didFinishLoadForQuickLookDocumentInMainFrame:]):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r241962 r241963  
     12019-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON) Unable to preview password-protected documents on iCloud.com
     4        https://bugs.webkit.org/show_bug.cgi?id=194954
     5        <rdar://problem/48127957>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Make sure the ProvisionalPageProxy forwards to the WebPageProxy the QuickLook-related
     10        IPC on iOS.
     11
     12        * UIProcess/ProvisionalPageProxy.cpp:
     13        (WebKit::ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
     14        (WebKit::ProvisionalPageProxy::didReceiveMessage):
     15        * UIProcess/ProvisionalPageProxy.h:
     16        * UIProcess/WebPageProxy.h:
     17        * UIProcess/ios/WebPageProxyIOS.mm:
     18        (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame):
     19        (WebKit::WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared):
     20
    1212019-02-22  Per Arne Vollan  <pvollan@apple.com>
    222
  • trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp

    r241823 r241963  
    328328}
    329329
     330#if USE(QUICK_LOOK)
     331void ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
     332{
     333    m_page.didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
     334}
     335#endif
     336
    330337#if PLATFORM(COCOA)
    331338void ProvisionalPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)
     
    345352        || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name()
    346353        || decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name()
     354#if USE(QUICK_LOOK)
     355        || decoder.messageName() == Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame::name()
     356        || decoder.messageName() == Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame::name()
     357#endif
    347358        )
    348359    {
     
    418429    }
    419430
     431#if USE(QUICK_LOOK)
     432    if (decoder.messageName() == Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame::name()) {
     433        IPC::handleMessage<Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame>(decoder, this, &ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame);
     434        return;
     435    }
     436#endif
     437
    420438    LOG(ProcessSwapping, "Unhandled message %s::%s from provisional process", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
    421439}
  • trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h

    r241823 r241963  
    106106        FrameInfoData&&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
    107107        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
     108#if USE(QUICK_LOOK)
     109    void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
     110#endif
    108111#if PLATFORM(COCOA)
    109112    void registerWebProcessAccessibilityToken(const IPC::DataReference&);
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r241934 r241963  
    14591459        FrameInfoData&&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
    14601460        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
     1461#if USE(QUICK_LOOK)
     1462    void didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&&, const String& fileName);
     1463#endif
    14611464
    14621465    void dumpAdClickAttribution(CompletionHandler<void(const String&)>&&);
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r241934 r241963  
    11601160void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
    11611161{
    1162     pageClient().requestPasswordForQuickLookDocument(fileName, [protectedThis = makeRef(*this)](const String& password) {
    1163         protectedThis->process().send(Messages::WebPage::DidReceivePasswordForQuickLookDocument(password), protectedThis->m_pageID);
     1162    didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
     1163}
     1164
     1165void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&& process, const String& fileName)
     1166{
     1167    pageClient().requestPasswordForQuickLookDocument(fileName, [process = WTFMove(process), pageID = m_pageID](const String& password) {
     1168        process->send(Messages::WebPage::DidReceivePasswordForQuickLookDocument(password), pageID);
    11641169    });
    11651170}
  • trunk/Tools/ChangeLog

    r241950 r241963  
     12019-02-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Regression(PSON) Unable to preview password-protected documents on iCloud.com
     4        https://bugs.webkit.org/show_bug.cgi?id=194954
     5        <rdar://problem/48127957>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add API test coverage.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     12        (-[PSONNavigationDelegate _webViewDidRequestPasswordForQuickLookDocument:]):
     13        (-[PSONNavigationDelegate _webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:]):
     14        (-[PSONNavigationDelegate _webView:didFinishLoadForQuickLookDocumentInMainFrame:]):
     15
    1162019-02-22  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r241950 r241963  
    7171static bool didRepondToPolicyDecisionCall;
    7272
     73#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
     74static bool requestedQuickLookPassword;
     75static bool didStartQuickLookLoad;
     76static bool didFinishQuickLookLoad;
     77#endif
     78
    7379static RetainPtr<NSMutableArray> receivedMessages = adoptNS([@[] mutableCopy]);
    7480bool didReceiveAlert;
     
    99105@end
    100106
    101 @interface PSONNavigationDelegate : NSObject <WKNavigationDelegate> {
     107@interface PSONNavigationDelegate : NSObject <WKNavigationDelegatePrivate> {
    102108    @public void (^decidePolicyForNavigationAction)(WKNavigationAction *, void (^)(WKNavigationActionPolicy));
    103109    @public void (^didStartProvisionalNavigationHandler)();
     
    174180    didPerformClientRedirect = true;
    175181}
     182
     183#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
     184
     185- (void)_webViewDidRequestPasswordForQuickLookDocument:(WKWebView *)webView
     186{
     187    requestedQuickLookPassword = true;
     188}
     189
     190- (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti
     191{
     192    didStartQuickLookLoad = true;
     193}
     194
     195- (void)_webView:(WKWebView *)webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)documentData
     196{
     197    didFinishQuickLookLoad = true;
     198}
     199
     200#endif
    176201
    177202@end
     
    53215346}
    53225347
     5348#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
     5349
     5350TEST(ProcessSwap, QuickLookRequestsPasswordAfterSwap)
     5351{
     5352    auto processPoolConfiguration = psonProcessPoolConfiguration();
     5353    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
     5354
     5355    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
     5356    [webViewConfiguration setProcessPool:processPool.get()];
     5357    auto handler = adoptNS([[PSONScheme alloc] init]);
     5358    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
     5359
     5360    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
     5361
     5362    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     5363    [webView setNavigationDelegate:navigationDelegate.get()];
     5364
     5365    auto* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     5366    [webView loadRequest:request];
     5367
     5368    TestWebKitAPI::Util::run(&done);
     5369    done = false;
     5370
     5371    request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"password-protected" withExtension:@"pages" subdirectory:@"TestWebKitAPI.resources"]];
     5372    [webView loadRequest:request];
     5373
     5374    TestWebKitAPI::Util::run(&didStartQuickLookLoad);
     5375    didStartQuickLookLoad = false;
     5376
     5377    TestWebKitAPI::Util::run(&requestedQuickLookPassword);
     5378    requestedQuickLookPassword = false;
     5379
     5380    TestWebKitAPI::Util::run(&didFinishQuickLookLoad);
     5381    didFinishQuickLookLoad = false;
     5382}
     5383
     5384#endif
     5385
    53235386#endif // WK_API_ENABLED
Note: See TracChangeset for help on using the changeset viewer.