Title: [250166] branches/safari-608.2.11.1-branch/Source/WebKit

Diff

Modified: branches/safari-608.2.11.1-branch/Source/WebKit/ChangeLog (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/ChangeLog	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/ChangeLog	2019-09-20 23:54:51 UTC (rev 250166)
@@ -1,79 +1,3 @@
-2019-09-20  Alan Coon  <alanc...@apple.com>
-
-        Apply patch. rdar://problem/55564031
-
-    2019-09-20  Chris Dumez  <cdu...@apple.com>
-
-            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  <kocsen_ch...@apple.com>
-
-        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  <timo...@apple.com>
-
-            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  <alanc...@apple.com>
 
         Apply patch. rdar://problem/55240886

Modified: branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp	2019-09-20 23:54:51 UTC (rev 250166)
@@ -29,8 +29,6 @@
 #include "AuxiliaryProcessMessages.h"
 #include "LoadParameters.h"
 #include "WebPageMessages.h"
-#include "WebPageProxy.h"
-#include "WebProcessProxy.h"
 #include <wtf/RunLoop.h>
 
 namespace WebKit {
@@ -185,16 +183,12 @@
             auto bufferSize = message->bufferSize();
             std::unique_ptr<IPC::Decoder> decoder = std::make_unique<IPC::Decoder>(buffer, bufferSize, nullptr, Vector<IPC::Attachment> { });
             LoadParameters loadParameters;
-            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;
+            String sandboxExtensionPath;
+            if (decoder->decode(loadParameters) && decoder->decode(sandboxExtensionPath)) {
+                SandboxExtension::createHandleForReadByPid(sandboxExtensionPath, processIdentifier(), loadParameters.sandboxExtensionHandle);
+                send(Messages::WebPage::LoadRequest(loadParameters), decoder->destinationID());
+                continue;
+            }
         }
 #endif
         m_connection->sendMessage(WTFMove(message), sendOptions);

Modified: branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/AuxiliaryProcessProxy.h	2019-09-20 23:54:51 UTC (rev 250166)
@@ -98,7 +98,6 @@
         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.11.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-09-20 23:54:51 UTC (rev 250166)
@@ -1351,22 +1351,6 @@
 
     [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")) {
@@ -3781,8 +3765,34 @@
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    [m_layerHostingView layer].sublayers = rootLayer ? @[ rootLayer ] : nil;
+    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_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.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-09-20 23:54:51 UTC (rev 250166)
@@ -1049,13 +1049,6 @@
     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;
@@ -1166,10 +1159,19 @@
     addPlatformLoadParameters(loadParameters);
 
 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
-    if (!process->isLaunching() || !url.isLocalFile())
+    if (processIdentifier() || !url.isLocalFile())
         process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
-    else
-        process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, m_pageLoadState.resourceDirectoryURL(), m_pageID), 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::LoadRequest(loadParameters), m_pageID);
 #endif
@@ -1211,19 +1213,26 @@
 
     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());
-    maybeInitializeSandboxExtensionHandle(m_process, fileURL, resourceDirectoryURL, loadParameters.sandboxExtensionHandle);
+#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
     addPlatformLoadParameters(loadParameters);
 
+    m_process->assumeReadAccessToBaseURL(*this, resourceDirectoryURL);
 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID)
-    if (m_process->isLaunching())
-        m_process->send(Messages::WebPage::LoadRequestWaitingForPID(loadParameters, resourceDirectoryURL, m_pageID), m_pageID);
+    if (processIdentifier())
+        m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
     else
-        m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
+        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.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.h (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/UIProcess/WebPageProxy.h	2019-09-20 23:54:51 UTC (rev 250166)
@@ -1567,8 +1567,6 @@
     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();
@@ -1905,6 +1903,8 @@
     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.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-09-20 23:54:51 UTC (rev 250166)
@@ -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&&, URL&&, PageIdentifier)
+NO_RETURN void WebPage::loadRequestWaitingForPID(LoadParameters&&, const String&)
 {
     RELEASE_ASSERT_NOT_REACHED();
 }

Modified: branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-09-20 23:54:51 UTC (rev 250166)
@@ -1309,7 +1309,7 @@
     void tryClose();
     void platformDidReceiveLoadParameters(const LoadParameters&);
     void loadRequest(LoadParameters&&);
-    NO_RETURN void loadRequestWaitingForPID(LoadParameters&&, URL&&, WebCore::PageIdentifier);
+    void loadRequestWaitingForPID(LoadParameters&&, const String&);
     void loadData(LoadParameters&&);
     void loadAlternateHTML(LoadParameters&&);
     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);

Modified: branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (250165 => 250166)


--- branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-09-20 23:46:45 UTC (rev 250165)
+++ branches/safari-608.2.11.1-branch/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-09-20 23:54:51 UTC (rev 250166)
@@ -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, URL resourceDirectoryURL, WebCore::PageIdentifier pageID)
+    LoadRequestWaitingForPID(struct WebKit::LoadParameters loadParameters, String sandboxExtensionPath)
     LoadData(struct WebKit::LoadParameters loadParameters)
     LoadAlternateHTML(struct WebKit::LoadParameters loadParameters)
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to