Stop sending list of display-isolated schemes to NetworkProcess
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 19:33:00 +0000 (19:33 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 19:33:00 +0000 (19:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202557

Reviewed by Youenn Fablet.

Source/WebCore:

They are only ever used in the WebProcess in SecurityOrigin::canDisplay.
If someone adds code that uses them in the NetworkProcess, they will hit my new assertion.

No change in behavior.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canDisplay const):
* platform/RuntimeApplicationChecks.h:
(WebCore::isInNetworkProcess):
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::isInNetworkProcess):

Source/WebKit:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const): Deleted.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):

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

Source/WebCore/ChangeLog
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/UIProcess/WebProcessPool.cpp

index 8f73dd4..e17f94b 100644 (file)
@@ -1,5 +1,24 @@
 2019-10-04  Alex Christensen  <achristensen@webkit.org>
 
+        Stop sending list of display-isolated schemes to NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=202557
+
+        Reviewed by Youenn Fablet.
+
+        They are only ever used in the WebProcess in SecurityOrigin::canDisplay.
+        If someone adds code that uses them in the NetworkProcess, they will hit my new assertion.
+
+        No change in behavior.
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::canDisplay const):
+        * platform/RuntimeApplicationChecks.h:
+        (WebCore::isInNetworkProcess):
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::isInNetworkProcess):
+
+2019-10-04  Alex Christensen  <achristensen@webkit.org>
+
         Rename SchemeRegistry to LegacySchemeRegistry
         https://bugs.webkit.org/show_bug.cgi?id=202586
 
index bbe291e..1dbfcdc 100644 (file)
@@ -33,6 +33,7 @@
 #include "LegacySchemeRegistry.h"
 #include "OriginAccessEntry.h"
 #include "PublicSuffix.h"
+#include "RuntimeApplicationChecks.h"
 #include "SecurityPolicy.h"
 #include "TextEncoding.h"
 #include "ThreadableBlobRegistry.h"
@@ -353,6 +354,7 @@ static bool isFeedWithNestedProtocolInHTTPFamily(const URL& url)
 
 bool SecurityOrigin::canDisplay(const URL& url) const
 {
+    ASSERT(!isInNetworkProcess());
     if (m_universalAccess)
         return true;
 
index b556f2f..08ac7b4 100644 (file)
@@ -41,6 +41,7 @@ inline bool isInWebProcess() { return true; }
 #if PLATFORM(COCOA)
 
 bool isInWebProcess();
+bool isInNetworkProcess();
 
 WEBCORE_EXPORT void setApplicationSDKVersion(uint32_t);
 WEBCORE_EXPORT uint32_t applicationSDKVersion();
@@ -103,6 +104,10 @@ WEBCORE_EXPORT bool isDataActivation();
 
 #endif // PLATFORM(IOS_FAMILY)
 
+#else
+
+inline bool isInNetworkProcess() { return false; }
+
 #endif // PLATFORM(COCOA)
 
 } // namespace WebCore
index ba7486a..d1861db 100644 (file)
@@ -90,6 +90,12 @@ bool isInWebProcess()
     return mainBundleIsWebProcess;
 }
 
+bool isInNetworkProcess()
+{
+    static bool mainBundleIsNetworkProcess = [[[NSBundle mainBundle] bundleIdentifier] hasPrefix:@"com.apple.WebKit.Networking"];
+    return mainBundleIsNetworkProcess;
+}
+
 static bool applicationBundleIsEqualTo(const String& bundleIdentifierString)
 {
     return applicationBundleIdentifier() == bundleIdentifierString;
index 689c672..80b4078 100644 (file)
@@ -1,5 +1,25 @@
 2019-10-04  Alex Christensen  <achristensen@webkit.org>
 
+        Stop sending list of display-isolated schemes to NetworkProcess
+        https://bugs.webkit.org/show_bug.cgi?id=202557
+
+        Reviewed by Youenn Fablet.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const): Deleted.
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode const):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
+
+2019-10-04  Alex Christensen  <achristensen@webkit.org>
+
         Rename SchemeRegistry to LegacySchemeRegistry
         https://bugs.webkit.org/show_bug.cgi?id=202586
 
index 6e9b400..3341aed 100644 (file)
@@ -350,9 +350,6 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
     for (auto& scheme : parameters.urlSchemesRegisteredAsNoAccess)
         registerURLSchemeAsNoAccess(scheme);
 
-    for (auto& scheme : parameters.urlSchemesRegisteredAsDisplayIsolated)
-        registerURLSchemeAsDisplayIsolated(scheme);
-
     for (auto& scheme : parameters.urlSchemesRegisteredAsCORSEnabled)
         registerURLSchemeAsCORSEnabled(scheme);
 
@@ -2221,11 +2218,6 @@ void NetworkProcess::registerURLSchemeAsNoAccess(const String& scheme) const
     LegacySchemeRegistry::registerURLSchemeAsNoAccess(scheme);
 }
 
-void NetworkProcess::registerURLSchemeAsDisplayIsolated(const String& scheme) const
-{
-    LegacySchemeRegistry::registerURLSchemeAsDisplayIsolated(scheme);
-}
-
 void NetworkProcess::registerURLSchemeAsCORSEnabled(const String& scheme) const
 {
     LegacySchemeRegistry::registerURLSchemeAsCORSEnabled(scheme);
index 1a342f9..2f70430 100644 (file)
@@ -439,7 +439,6 @@ private:
     void registerURLSchemeAsBypassingContentSecurityPolicy(const String&) const;
     void registerURLSchemeAsLocal(const String&) const;
     void registerURLSchemeAsNoAccess(const String&) const;
-    void registerURLSchemeAsDisplayIsolated(const String&) const;
     void registerURLSchemeAsCORSEnabled(const String&) const;
     void registerURLSchemeAsCanDisplayOnlyIfCanRequest(const String&) const;
 
index 1ef8fbc..51371d6 100644 (file)
@@ -146,7 +146,6 @@ messages -> NetworkProcess LegacyReceiver {
     RegisterURLSchemeAsBypassingContentSecurityPolicy(String scheme)
     RegisterURLSchemeAsLocal(String scheme)
     RegisterURLSchemeAsNoAccess(String scheme)
-    RegisterURLSchemeAsDisplayIsolated(String scheme)
     RegisterURLSchemeAsCORSEnabled(String scheme)
     RegisterURLSchemeAsCanDisplayOnlyIfCanRequest(String scheme)
 
index 9d298a3..6669a1d 100644 (file)
@@ -72,7 +72,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << urlSchemesRegisteredAsBypassingContentSecurityPolicy;
     encoder << urlSchemesRegisteredAsLocal;
     encoder << urlSchemesRegisteredAsNoAccess;
-    encoder << urlSchemesRegisteredAsDisplayIsolated;
     encoder << urlSchemesRegisteredAsCORSEnabled;
     encoder << urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest;
 
@@ -160,8 +159,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
         return false;
     if (!decoder.decode(result.urlSchemesRegisteredAsNoAccess))
         return false;
-    if (!decoder.decode(result.urlSchemesRegisteredAsDisplayIsolated))
-        return false;
     if (!decoder.decode(result.urlSchemesRegisteredAsCORSEnabled))
         return false;
     if (!decoder.decode(result.urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest))
index 358cfce..e63fc9d 100644 (file)
@@ -89,7 +89,6 @@ struct NetworkProcessCreationParameters {
     Vector<String> urlSchemesRegisteredAsBypassingContentSecurityPolicy;
     Vector<String> urlSchemesRegisteredAsLocal;
     Vector<String> urlSchemesRegisteredAsNoAccess;
-    Vector<String> urlSchemesRegisteredAsDisplayIsolated;
     Vector<String> urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest;
     Vector<String> urlSchemesRegisteredAsCORSEnabled;
 
index 8b66de0..ad407e6 100644 (file)
@@ -521,7 +521,6 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
     parameters.urlSchemesRegisteredAsBypassingContentSecurityPolicy = copyToVector(m_schemesToRegisterAsBypassingContentSecurityPolicy);
     parameters.urlSchemesRegisteredAsLocal = copyToVector(m_schemesToRegisterAsLocal);
     parameters.urlSchemesRegisteredAsNoAccess = copyToVector(m_schemesToRegisterAsNoAccess);
-    parameters.urlSchemesRegisteredAsDisplayIsolated = copyToVector(m_schemesToRegisterAsDisplayIsolated);
     parameters.urlSchemesRegisteredAsCORSEnabled = copyToVector(m_schemesToRegisterAsCORSEnabled);
     parameters.urlSchemesRegisteredAsCanDisplayOnlyIfCanRequest = copyToVector(m_schemesToRegisterAsCanDisplayOnlyIfCanRequest);
 
@@ -1494,7 +1493,6 @@ void WebProcessPool::registerURLSchemeAsDisplayIsolated(const String& urlScheme)
 {
     m_schemesToRegisterAsDisplayIsolated.add(urlScheme);
     sendToAllProcesses(Messages::WebProcess::RegisterURLSchemeAsDisplayIsolated(urlScheme));
-    sendToNetworkingProcess(Messages::NetworkProcess::RegisterURLSchemeAsDisplayIsolated(urlScheme));
 }
 
 void WebProcessPool::registerURLSchemeAsCORSEnabled(const String& urlScheme)