Title: [250472] branches/safari-608.2.40.1-branch/Source/WebKit

Diff

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/ChangeLog (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/ChangeLog	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/ChangeLog	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1,3 +1,79 @@
+2019-09-20  Alan Coon  <[email protected]>
+
+        Apply patch. rdar://problem/55564031
+
+    2019-09-20  Chris Dumez  <[email protected]>
+
+            Regression(r248832): Unable to quicklook HTML files in Mail
+            https://bugs.webkit.org/show_bug.cgi?id=202012
+            <rdar://problem/55285295>
+
+            Reviewed by Geoff Garen and Brent Fulgham.
+
+            r248832 inadvertently reverted the fix for Mail that landed in r247400 by not using
+            the same logic to initialize the sandbox extension if the process had already
+            finished launching or not. In particular, the new code path that happens on process
+            launch unconditionally used '/' as resource directory for the sandbox extension if
+            the client did not provide one. The logic in maybeInitializeSandboxExtensionHandle()
+            would use the file URL's base URL as resource directory when creating a sandbox
+            extension for '/' would fail (which it often does).
+
+            To address the issue, have the logic that runs on process launch call
+            maybeInitializeSandboxExtensionHandle() so avoid duplicating code and make sure
+            both cases now have the Mail fix.
+
+            * UIProcess/AuxiliaryProcessProxy.cpp:
+            (WebKit::AuxiliaryProcessProxy::didFinishLaunching):
+            * UIProcess/AuxiliaryProcessProxy.h:
+            (WebKit::AuxiliaryProcessProxy::isLaunching const):
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
+            (WebKit::WebPageProxy::loadRequestWithNavigationShared):
+            (WebKit::WebPageProxy::loadFile):
+            * UIProcess/WebPageProxy.h:
+            * WebProcess/WebPage/WebPage.messages.in:
+
+2019-09-19  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r250069. rdar://problem/55524978
+
+    Eagerly create and add the m_layerHostingView to WKWebView.
+    https://bugs.webkit.org/show_bug.cgi?id=201942
+    
+    Reviewed by Tim Horton.
+    
+    Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
+    adding it behind a view that should have been added behind our layer hosting view subview. This affected
+    the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
+    Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
+    This ensures proper ordering of subviews when clients add a view behind all existing subviews.
+    
+    * UIProcess/Cocoa/WebViewImpl.mm:
+    (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
+    (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
+    Just set the sublayers of m_layerHostingView's layer here.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-09-18  Timothy Hatcher  <[email protected]>
+
+            Eagerly create and add the m_layerHostingView to WKWebView.
+            https://bugs.webkit.org/show_bug.cgi?id=201942
+
+            Reviewed by Tim Horton.
+
+            Some apps will add subviews to WKWebView, and by the time we add our m_layerHostingView view we might be
+            adding it behind a view that should have been added behind our layer hosting view subview. This affected
+            the Spark email app, due to changes in order of loading delegate calls and when compositing is enabled.
+            Instead of delayed creation of m_layerHostingView, always create it and add it to to the WKWebView.
+            This ensures proper ordering of subviews when clients add a view behind all existing subviews.
+
+            * UIProcess/Cocoa/WebViewImpl.mm:
+            (WebKit::WebViewImpl::WebViewImpl): Create and add m_layerHostingView here.
+            (WebKit::WebViewImpl::setAcceleratedCompositingRootLayer): Remove creation and removal of m_layerHostingView.
+            Just set the sublayers of m_layerHostingView's layer here.
+
 2019-09-11  Alan Coon  <[email protected]>
 
         Apply patch. rdar://problem/55240886

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp	2019-09-28 00:49:50 UTC (rev 250472)
@@ -29,6 +29,8 @@
 #include "AuxiliaryProcessMessages.h"
 #include "LoadParameters.h"
 #include "WebPageMessages.h"
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
 #include <wtf/RunLoop.h>
 
 namespace WebKit {
@@ -183,12 +185,16 @@
             auto bufferSize = message->bufferSize();
             std::unique_ptr<IPC::Decoder> decoder = std::make_unique<IPC::Decoder>(buffer, bufferSize, nullptr, Vector<IPC::Attachment> { });
             LoadParameters loadParameters;
-            String sandboxExtensionPath;
-            if (decoder->decode(loadParameters) && decoder->decode(sandboxExtensionPath)) {
-                SandboxExtension::createHandleForReadByPid(sandboxExtensionPath, processIdentifier(), loadParameters.sandboxExtensionHandle);
-                send(Messages::WebPage::LoadRequest(loadParameters), decoder->destinationID());
-                continue;
-            }
+            URL resourceDirectoryURL;
+            WebCore::PageIdentifier pageID;
+            if (decoder->decode(loadParameters) && decoder->decode(resourceDirectoryURL) && decoder->decode(pageID)) {
+                if (auto* page = WebProcessProxy::webPage(pageID)) {
+                    page->maybeInitializeSandboxExtensionHandle(static_cast<WebProcessProxy&>(*this), loadParameters.request.url(), resourceDirectoryURL, loadParameters.sandboxExtensionHandle);
+                    send(Messages::WebPage::LoadRequest(loadParameters), decoder->destinationID());
+                }
+            } else
+                ASSERT_NOT_REACHED();
+            continue;
         }
 #endif
         m_connection->sendMessage(WTFMove(message), sendOptions);

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h	2019-09-28 00:49:50 UTC (rev 250472)
@@ -98,6 +98,7 @@
         Terminated,
     };
     State state() const;
+    bool isLaunching() const { return state() == State::Launching; }
 
     ProcessID processIdentifier() const { return m_processLauncher ? m_processLauncher->processIdentifier() : 0; }
 

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1351,6 +1351,22 @@
 
     [view addTrackingArea:m_primaryTrackingArea.get()];
 
+    // Create an NSView that will host our layer tree.
+    m_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:[m_view bounds]]);
+    [m_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+    [view addSubview:m_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
+
+    // Create a root layer that will back the NSView.
+    RetainPtr<CALayer> layer = adoptNS([[CALayer alloc] init]);
+    [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
+#ifndef NDEBUG
+    [layer setName:@"Hosting root layer"];
+#endif
+
+    [m_layerHostingView setLayer:layer.get()];
+    [m_layerHostingView setWantsLayer:YES];
+
     m_page->setIntrinsicDeviceScaleFactor(intrinsicDeviceScaleFactor());
 
     if (Class gestureClass = NSClassFromString(@"NSImmediateActionGestureRecognizer")) {
@@ -3765,34 +3781,8 @@
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    if (rootLayer) {
-        if (!m_layerHostingView) {
-            // Create an NSView that will host our layer tree.
-            m_layerHostingView = adoptNS([[WKFlippedView alloc] initWithFrame:[m_view bounds]]);
-            [m_layerHostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+    [m_layerHostingView layer].sublayers = rootLayer ? @[ rootLayer ] : nil;
 
-            [m_view addSubview:m_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
-
-            // Create a root layer that will back the NSView.
-            RetainPtr<CALayer> layer = adoptNS([[CALayer alloc] init]);
-            [layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
-#ifndef NDEBUG
-            [layer setName:@"Hosting root layer"];
-#endif
-
-            [m_layerHostingView setLayer:layer.get()];
-            [m_layerHostingView setWantsLayer:YES];
-        }
-
-        [m_layerHostingView layer].sublayers = [NSArray arrayWithObject:rootLayer];
-    } else if (m_layerHostingView) {
-        [m_layerHostingView removeFromSuperview];
-        [m_layerHostingView setLayer:nil];
-        [m_layerHostingView setWantsLayer:NO];
-
-        m_layerHostingView = nullptr;
-    }
-
     [CATransaction commit];
 }
 

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1049,6 +1049,13 @@
     if (!url.isLocalFile())
         return;
 
+#if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
+    // If the process is still launching then it does not have a PID yet. We will take care of creating the sandbox extension
+    // once the process has finished launching.
+    if (process.isLaunching())
+        return;
+#endif
+
     if (!resourceDirectoryURL.isEmpty()) {
         if (process.hasAssumedReadAccessToURL(resourceDirectoryURL))
             return;
@@ -1159,19 +1166,10 @@
     addPlatformLoadParameters(loadParameters);
 
 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
-    if (processIdentifier() || !url.isLocalFile())
+    if (!process->isLaunching() || !url.isLocalFile())
         process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
-    else {
-        String sandboxExtensionPath;
-        if (!m_pageLoadState.resourceDirectoryURL().isEmpty()) {
-            sandboxExtensionPath = m_pageLoadState.resourceDirectoryURL().fileSystemPath();
-            process->assumeReadAccessToBaseURL(*this, m_pageLoadState.resourceDirectoryURL());
-        } else {
-            sandboxExtensionPath = "/";
-            willAcquireUniversalFileReadSandboxExtension(process);
-        }
-        process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, sandboxExtensionPath), m_pageID);
-    }
+    else
+        process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, m_pageLoadState.resourceDirectoryURL(), m_pageID), m_pageID);
 #else
     process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
 #endif
@@ -1213,26 +1211,19 @@
 
     m_pageLoadState.setPendingAPIRequest(transaction, { navigation->navigationID(), fileURLString }, resourceDirectoryURL);
 
-    String resourceDirectoryPath = resourceDirectoryURL.fileSystemPath();
-
     LoadParameters loadParameters;
     loadParameters.navigationID = navigation->navigationID();
     loadParameters.request = fileURL;
     loadParameters.shouldOpenExternalURLsPolicy = ShouldOpenExternalURLsPolicy::ShouldNotAllow;
     loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
-#if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
-    SandboxExtension::createHandleForReadByPid(resourceDirectoryPath, processIdentifier(), loadParameters.sandboxExtensionHandle);
-#else
-    SandboxExtension::createHandle(resourceDirectoryPath, SandboxExtension::Type::ReadOnly, loadParameters.sandboxExtensionHandle);
-#endif
+    maybeInitializeSandboxExtensionHandle(m_process, fileURL, resourceDirectoryURL, loadParameters.sandboxExtensionHandle);
     addPlatformLoadParameters(loadParameters);
 
-    m_process->assumeReadAccessToBaseURL(*this, resourceDirectoryURL);
 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
-    if (processIdentifier())
+    if (m_process->isLaunching())
+        m_process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, resourceDirectoryURL, m_pageID), m_pageID);
+    else
         m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
-    else
-        m_process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, resourceDirectoryPath), m_pageID);
 #else
     m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
 #endif

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.h (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1567,6 +1567,8 @@
     void setMockCaptureDevicesEnabledOverride(Optional<bool>);
 #endif
 
+    void maybeInitializeSandboxExtensionHandle(WebProcessProxy&, const URL&, const URL& resourceDirectoryURL, SandboxExtension::Handle&);
+
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, WebCore::PageIdentifier, Ref<API::PageConfiguration>&&);
     void platformInitialize();
@@ -1903,8 +1905,6 @@
     void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, uint64_t complexTextInputState);
 #endif
 
-    void maybeInitializeSandboxExtensionHandle(WebProcessProxy&, const URL& url, const URL& resourceDirectoryURL, SandboxExtension::Handle&);
-
 #if USE(AUTOMATIC_TEXT_REPLACEMENT)
     void toggleSmartInsertDelete();
     void toggleAutomaticQuoteSubstitution();

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1554,7 +1554,7 @@
 }
 
 // LoadRequestWaitingForPID should never be sent to the WebProcess. It must always be converted to a LoadRequest message.
-NO_RETURN void WebPage::loadRequestWaitingForPID(LoadParameters&&, const String&)
+NO_RETURN void WebPage::loadRequestWaitingForPID(LoadParameters&&, URL&&, PageIdentifier)
 {
     RELEASE_ASSERT_NOT_REACHED();
 }

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-09-28 00:49:50 UTC (rev 250472)
@@ -1309,7 +1309,7 @@
     void tryClose();
     void platformDidReceiveLoadParameters(const LoadParameters&);
     void loadRequest(LoadParameters&&);
-    void loadRequestWaitingForPID(LoadParameters&&, const String&);
+    NO_RETURN void loadRequestWaitingForPID(LoadParameters&&, URL&&, WebCore::PageIdentifier);
     void loadData(LoadParameters&&);
     void loadAlternateHTML(LoadParameters&&);
     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);

Modified: branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (250471 => 250472)


--- branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-09-28 00:36:02 UTC (rev 250471)
+++ branches/safari-608.2.40.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-09-28 00:49:50 UTC (rev 250472)
@@ -165,7 +165,7 @@
     LoadURLInFrame(URL url, String referrer, uint64_t frameID)
     LoadDataInFrame(IPC::DataReference data, String MIMEType, String encodingName, URL baseURL, uint64_t frameID)
     LoadRequest(struct WebKit::LoadParameters loadParameters)
-    LoadRequestWaitingForPID(struct WebKit::LoadParameters loadParameters, String sandboxExtensionPath)
+    LoadRequestWaitingForPID(struct WebKit::LoadParameters loadParameters, URL resourceDirectoryURL, WebCore::PageIdentifier pageID)
     LoadData(struct WebKit::LoadParameters loadParameters)
     LoadAlternateHTML(struct WebKit::LoadParameters loadParameters)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to