Title: [242028] branches/safari-607-branch
Revision
242028
Author
[email protected]
Date
2019-02-24 20:47:27 -0800 (Sun, 24 Feb 2019)

Log Message

Cherry-pick r241963. rdar://problem/48350367

    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:]):

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (242027 => 242028)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-25 04:47:27 UTC (rev 242028)
@@ -1,5 +1,60 @@
 2019-02-24  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r241963. rdar://problem/48350367
+
+    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:]):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-22  Chris Dumez  <[email protected]>
+
+            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.
+
+            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):
+
+2019-02-24  Babak Shafiei  <[email protected]>
+
         Cherry-pick r241950. rdar://problem/48317455
 
     REGRESSION(PSON) Scroll position is sometimes not restored on history navigation

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (242027 => 242028)


--- branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2019-02-25 04:47:27 UTC (rev 242028)
@@ -327,6 +327,13 @@
         WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, WTFMove(reply));
 }
 
+#if USE(QUICK_LOOK)
+void ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
+{
+    m_page.didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
+}
+#endif
+
 #if PLATFORM(COCOA)
 void ProvisionalPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)
 {
@@ -344,6 +351,10 @@
         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessage::name()
         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name()
         || decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name()
+#if USE(QUICK_LOOK)
+        || decoder.messageName() == Messages::WebPageProxy::DidStartLoadForQuickLookDocumentInMainFrame::name()
+        || decoder.messageName() == Messages::WebPageProxy::DidFinishLoadForQuickLookDocumentInMainFrame::name()
+#endif
         )
     {
         m_page.didReceiveMessage(connection, decoder);
@@ -417,6 +428,13 @@
         return;
     }
 
+#if USE(QUICK_LOOK)
+    if (decoder.messageName() == Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame::name()) {
+        IPC::handleMessage<Messages::WebPageProxy::DidRequestPasswordForQuickLookDocumentInMainFrame>(decoder, this, &ProvisionalPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame);
+        return;
+    }
+#endif
+
     LOG(ProcessSwapping, "Unhandled message %s::%s from provisional process", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
 }
 

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h (242027 => 242028)


--- branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/ProvisionalPageProxy.h	2019-02-25 04:47:27 UTC (rev 242028)
@@ -100,6 +100,9 @@
     void decidePolicyForNavigationActionSync(uint64_t frameID, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&,
         FrameInfoData&&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
         WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+#if USE(QUICK_LOOK)
+    void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
+#endif
 #if PLATFORM(COCOA)
     void registerWebProcessAccessibilityToken(const IPC::DataReference&);
 #endif

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h (242027 => 242028)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-25 04:47:27 UTC (rev 242028)
@@ -1444,6 +1444,9 @@
     void decidePolicyForNavigationActionSyncShared(Ref<WebProcessProxy>&&, uint64_t frameID, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&,
         FrameInfoData&&, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
         WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+#if USE(QUICK_LOOK)
+    void didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&&, const String& fileName);
+#endif
 
     // IPC::MessageReceiver
     // Implemented in generated WebPageProxyMessageReceiver.cpp

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (242027 => 242028)


--- branches/safari-607-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-02-25 04:47:27 UTC (rev 242028)
@@ -1157,8 +1157,13 @@
 
 void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName)
 {
-    pageClient().requestPasswordForQuickLookDocument(fileName, [protectedThis = makeRef(*this)](const String& password) {
-        protectedThis->process().send(Messages::WebPage::DidReceivePasswordForQuickLookDocument(password), protectedThis->m_pageID);
+    didRequestPasswordForQuickLookDocumentInMainFrameShared(m_process.copyRef(), fileName);
+}
+
+void WebPageProxy::didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&& process, const String& fileName)
+{
+    pageClient().requestPasswordForQuickLookDocument(fileName, [process = WTFMove(process), pageID = m_pageID](const String& password) {
+        process->send(Messages::WebPage::DidReceivePasswordForQuickLookDocument(password), pageID);
     });
 }
 

Modified: branches/safari-607-branch/Tools/ChangeLog (242027 => 242028)


--- branches/safari-607-branch/Tools/ChangeLog	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Tools/ChangeLog	2019-02-25 04:47:27 UTC (rev 242028)
@@ -1,5 +1,55 @@
 2019-02-24  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r241963. rdar://problem/48350367
+
+    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:]):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-22  Chris Dumez  <[email protected]>
+
+            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.
+
+            Add API test coverage.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+            (-[PSONNavigationDelegate _webViewDidRequestPasswordForQuickLookDocument:]):
+            (-[PSONNavigationDelegate _webView:didStartLoadForQuickLookDocumentInMainFrameWithFileName:uti:]):
+            (-[PSONNavigationDelegate _webView:didFinishLoadForQuickLookDocumentInMainFrame:]):
+
+2019-02-24  Babak Shafiei  <[email protected]>
+
         Cherry-pick r241950. rdar://problem/48317455
 
     REGRESSION(PSON) Scroll position is sometimes not restored on history navigation

Modified: branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (242027 => 242028)


--- branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-25 04:47:23 UTC (rev 242027)
+++ branches/safari-607-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-25 04:47:27 UTC (rev 242028)
@@ -70,6 +70,12 @@
 static int numberOfDecidePolicyCalls;
 static bool didRepondToPolicyDecisionCall;
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+static bool requestedQuickLookPassword;
+static bool didStartQuickLookLoad;
+static bool didFinishQuickLookLoad;
+#endif
+
 static RetainPtr<NSMutableArray> receivedMessages = adoptNS([@[] mutableCopy]);
 bool didReceiveAlert;
 static bool receivedMessage;
@@ -98,7 +104,7 @@
 }
 @end
 
-@interface PSONNavigationDelegate : NSObject <WKNavigationDelegate> {
+@interface PSONNavigationDelegate : NSObject <WKNavigationDelegatePrivate> {
     @public void (^decidePolicyForNavigationAction)(WKNavigationAction *, void (^)(WKNavigationActionPolicy));
     @public void (^didStartProvisionalNavigationHandler)();
     @public void (^didCommitNavigationHandler)();
@@ -174,6 +180,25 @@
     didPerformClientRedirect = true;
 }
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+
+- (void)_webViewDidRequestPasswordForQuickLookDocument:(WKWebView *)webView
+{
+    requestedQuickLookPassword = true;
+}
+
+- (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti
+{
+    didStartQuickLookLoad = true;
+}
+
+- (void)_webView:(WKWebView *)webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)documentData
+{
+    didFinishQuickLookLoad = true;
+}
+
+#endif
+
 @end
 
 static RetainPtr<WKWebView> createdWebView;
@@ -5304,4 +5329,42 @@
     EXPECT_TRUE(hasOverlay([webView layer]));
 }
 
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+
+TEST(ProcessSwap, QuickLookRequestsPasswordAfterSwap)
+{
+    auto processPoolConfiguration = psonProcessPoolConfiguration();
+    auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+
+    auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [webViewConfiguration setProcessPool:processPool.get()];
+    auto handler = adoptNS([[PSONScheme alloc] init]);
+    [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"];
+
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+
+    auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
+    [webView setNavigationDelegate:navigationDelegate.get()];
+
+    auto* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&done);
+    done = false;
+
+    request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"password-protected" withExtension:@"pages" subdirectory:@"TestWebKitAPI.resources"]];
+    [webView loadRequest:request];
+
+    TestWebKitAPI::Util::run(&didStartQuickLookLoad);
+    didStartQuickLookLoad = false;
+
+    TestWebKitAPI::Util::run(&requestedQuickLookPassword);
+    requestedQuickLookPassword = false;
+
+    TestWebKitAPI::Util::run(&didFinishQuickLookLoad);
+    didFinishQuickLookLoad = false;
+}
+
+#endif
+
 #endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to