Regression(r240046) VoiceOver is no longer working after a process swap
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 17:16:33 +0000 (17:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 17:16:33 +0000 (17:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193953
<rdar://problem/47612398>

Reviewed by Alex Christensen.

ProvisionalPageProxy used to forward the RegisterWebProcessAccessibilityToken IPC from
the provisional WebProcess to the WebPageProxy right away. This in turn would notify
the PageClient whose logic would rely on WebPageProxy::process(), which returns the
committed process instead of the provisional one.

To address the issue, the ProvisionalPageProxy now stores the token sent by the
provisional WebProcess and we only call registerWebProcessAccessibilityToken()
on the WebPageProxy *after* we've swapped to the provisional process.

* UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::registerWebProcessAccessibilityToken):
(WebKit::ProvisionalPageProxy::didReceiveMessage):
* UIProcess/ProvisionalPageProxy.h:
(WebKit::ProvisionalPageProxy::takeAccessibilityToken):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::commitProvisionalPage):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
Source/WebKit/UIProcess/ProvisionalPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.cpp

index 4300795..570b1d3 100644 (file)
@@ -1,3 +1,28 @@
+2019-01-29  Chris Dumez  <cdumez@apple.com>
+
+        Regression(r240046) VoiceOver is no longer working after a process swap
+        https://bugs.webkit.org/show_bug.cgi?id=193953
+        <rdar://problem/47612398>
+
+        Reviewed by Alex Christensen.
+
+        ProvisionalPageProxy used to forward the RegisterWebProcessAccessibilityToken IPC from
+        the provisional WebProcess to the WebPageProxy right away. This in turn would notify
+        the PageClient whose logic would rely on WebPageProxy::process(), which returns the
+        committed process instead of the provisional one.
+
+        To address the issue, the ProvisionalPageProxy now stores the token sent by the
+        provisional WebProcess and we only call registerWebProcessAccessibilityToken()
+        on the WebPageProxy *after* we've swapped to the provisional process.
+
+        * UIProcess/ProvisionalPageProxy.cpp:
+        (WebKit::ProvisionalPageProxy::registerWebProcessAccessibilityToken):
+        (WebKit::ProvisionalPageProxy::didReceiveMessage):
+        * UIProcess/ProvisionalPageProxy.h:
+        (WebKit::ProvisionalPageProxy::takeAccessibilityToken):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::commitProvisionalPage):
+
 2019-01-28  Ryosuke Niwa  <rniwa@webkit.org>
 
         User agent string override for navigator.userAgent should be site specific quirks
index 8d44829..a9f2be7 100644 (file)
@@ -284,6 +284,13 @@ void ProvisionalPageProxy::backForwardGoToItem(const WebCore::BackForwardItemIde
     m_page.backForwardGoToItemShared(m_process.copyRef(), identifier, handle);
 }
 
+#if PLATFORM(COCOA)
+void ProvisionalPageProxy::registerWebProcessAccessibilityToken(const IPC::DataReference& data)
+{
+    m_accessibilityToken = data.vector();
+}
+#endif
+
 void ProvisionalPageProxy::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
 {
     ASSERT(decoder.messageReceiverName() == Messages::WebPageProxy::messageReceiverName());
@@ -294,15 +301,19 @@ void ProvisionalPageProxy::didReceiveMessage(IPC::Connection& connection, IPC::D
         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessage::name()
         || decoder.messageName() == Messages::WebPageProxy::LogDiagnosticMessageWithEnhancedPrivacy::name()
         || decoder.messageName() == Messages::WebPageProxy::SetNetworkRequestsInProgress::name()
-#if PLATFORM(COCOA)
-        || decoder.messageName() == Messages::WebPageProxy::RegisterWebProcessAccessibilityToken::name()
-#endif
         )
     {
         m_page.didReceiveMessage(connection, decoder);
         return;
     }
 
+#if PLATFORM(COCOA)
+    if (decoder.messageName() == Messages::WebPageProxy::RegisterWebProcessAccessibilityToken::name()) {
+        IPC::handleMessage<Messages::WebPageProxy::RegisterWebProcessAccessibilityToken>(decoder, this, &ProvisionalPageProxy::registerWebProcessAccessibilityToken);
+        return;
+    }
+#endif
+
     if (decoder.messageName() == Messages::WebPageProxy::StartURLSchemeTask::name()) {
         IPC::handleMessage<Messages::WebPageProxy::StartURLSchemeTask>(decoder, this, &ProvisionalPageProxy::startURLSchemeTask);
         return;
index dd1519e..1d183ad 100644 (file)
@@ -56,6 +56,10 @@ public:
     DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
     std::unique_ptr<DrawingAreaProxy> takeDrawingArea();
 
+#if PLATFORM(COCOA)
+    Vector<uint8_t> takeAccessibilityToken() { return WTFMove(m_accessibilityToken); }
+#endif
+
     void loadData(API::Navigation&, const IPC::DataReference&, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData, Optional<WebsitePoliciesData>&& = WTF::nullopt);
     void loadRequest(API::Navigation&, WebCore::ResourceRequest&&, WebCore::ShouldOpenExternalURLsPolicy, API::Object* userData, Optional<WebsitePoliciesData>&& = WTF::nullopt);
     void goToBackForwardItem(API::Navigation&, WebBackForwardListItem&, Optional<WebsitePoliciesData>&&);
@@ -80,6 +84,9 @@ private:
     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
     void startURLSchemeTask(URLSchemeTaskParameters&&);
     void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, SandboxExtension::Handle&);
+#if PLATFORM(COCOA)
+    void registerWebProcessAccessibilityToken(const IPC::DataReference&);
+#endif
 
     void initializeWebPage();
     void finishInitializingWebPageAfterProcessLaunch();
@@ -95,6 +102,9 @@ private:
     bool m_wasCommitted { false };
     URL m_provisionalLoadURL;
 
+#if PLATFORM(COCOA)
+    Vector<uint8_t> m_accessibilityToken;
+#endif
 #if PLATFORM(IOS_FAMILY)
     ProcessThrottler::ForegroundActivityToken m_suspensionToken;
 #endif
index 47d320f..9717b08 100644 (file)
@@ -2776,6 +2776,12 @@ void WebPageProxy::commitProvisionalPage(uint64_t frameID, uint64_t navigationID
 
     swapToWebProcess(m_provisionalPage->process(), m_provisionalPage->takeDrawingArea(), m_provisionalPage->mainFrame());
 
+#if PLATFORM(COCOA)
+    auto accessibilityToken = m_provisionalPage->takeAccessibilityToken();
+    if (!accessibilityToken.isEmpty())
+        registerWebProcessAccessibilityToken({ accessibilityToken.data(), accessibilityToken.size() });
+#endif
+
     didCommitLoadForFrame(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, containsPluginDocument, forcedHasInsecureContent, userData);
 
     m_provisionalPage = nullptr;