Title: [241963] trunk
Revision
241963
Author
[email protected]
Date
2019-02-22 13:17:37 -0800 (Fri, 22 Feb 2019)

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

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241962 => 241963)


--- trunk/Source/WebKit/ChangeLog	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Source/WebKit/ChangeLog	2019-02-22 21:17:37 UTC (rev 241963)
@@ -1,3 +1,23 @@
+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-22  Per Arne Vollan  <[email protected]>
 
         [iOS] Sandbox should allow mach lookups related to media capturing

Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (241962 => 241963)


--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp	2019-02-22 21:17:37 UTC (rev 241963)
@@ -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: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h (241962 => 241963)


--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h	2019-02-22 21:17:37 UTC (rev 241963)
@@ -105,6 +105,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: trunk/Source/WebKit/UIProcess/WebPageProxy.h (241962 => 241963)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-02-22 21:17:37 UTC (rev 241963)
@@ -1458,6 +1458,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
 
     void dumpAdClickAttribution(CompletionHandler<void(const String&)>&&);
     void clearAdClickAttribution(CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (241962 => 241963)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-02-22 21:17:37 UTC (rev 241963)
@@ -1159,8 +1159,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: trunk/Tools/ChangeLog (241962 => 241963)


--- trunk/Tools/ChangeLog	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Tools/ChangeLog	2019-02-22 21:17:37 UTC (rev 241963)
@@ -1,5 +1,20 @@
 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-22  Chris Dumez  <[email protected]>
+
         REGRESSION(PSON) Scroll position is sometimes not restored on history navigation
         https://bugs.webkit.org/show_bug.cgi?id=194924
         <rdar://problem/48216125>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (241962 => 241963)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-22 20:44:28 UTC (rev 241962)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-22 21:17:37 UTC (rev 241963)
@@ -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;
@@ -5320,4 +5345,42 @@
 #endif
 }
 
+#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