Allow use of proxies in MiniBrowser
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2020 19:47:29 +0000 (19:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2020 19:47:29 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=207598

For testing purposes, we allow Safari to use a custom HTTP/HTTPS proxy passed through
Source/WebCore:

command line arguments. This gives MiniBrowser the same ability.

$ run-minibrowser --release -WebKit2HTTPProxy "http://127.0.0.1:8080" \
                            -WebKit2HTTPSProxy "http://127.0.0.1:8080"

Patch by Benjamin Nham <nham@apple.com> on 2020-02-13
Reviewed by Antti Koivisto.

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::MacApplication::isMiniBrowser):
(WebCore::IOSApplication::isMiniBrowser):

Source/WebKit:

command line arguments. This gives MiniBrowser the same ability. Example invocation:

$ run-minibrowser --release -WebKit2HTTPProxy "http://127.0.0.1:8080" \
                            -WebKit2HTTPSProxy "http://127.0.0.1:8080"

Patch by Benjamin Nham <nham@apple.com> on 2020-02-13
Reviewed by Antti Koivisto.

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm

index 2b503a0..59b66bf 100644 (file)
@@ -1,3 +1,21 @@
+2020-02-13  Benjamin Nham  <nham@apple.com>
+
+        Allow use of proxies in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=207598
+
+        For testing purposes, we allow Safari to use a custom HTTP/HTTPS proxy passed through
+        command line arguments. This gives MiniBrowser the same ability.
+
+        $ run-minibrowser --release -WebKit2HTTPProxy "http://127.0.0.1:8080" \
+                                    -WebKit2HTTPSProxy "http://127.0.0.1:8080"
+
+        Reviewed by Antti Koivisto.
+
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::MacApplication::isMiniBrowser):
+        (WebCore::IOSApplication::isMiniBrowser):
+
 2020-02-13  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][IFC] LineBreaker should not hold on to the lastWrapOpportunity inline item
index 525534a..fcd320f 100644 (file)
@@ -63,6 +63,7 @@ WEBCORE_EXPORT bool isITunes();
 WEBCORE_EXPORT bool isMicrosoftMessenger();
 WEBCORE_EXPORT bool isMicrosoftMyDay();
 WEBCORE_EXPORT bool isMicrosoftOutlook();
+WEBCORE_EXPORT bool isMiniBrowser();
 bool isQuickenEssentials();
 WEBCORE_EXPORT bool isSafari();
 bool isSolidStateNetworksDownloader();
@@ -86,6 +87,7 @@ WEBCORE_EXPORT bool isSafariViewService();
 WEBCORE_EXPORT bool isIMDb();
 WEBCORE_EXPORT bool isWebBookmarksD();
 WEBCORE_EXPORT bool isDumpRenderTree();
+WEBCORE_EXPORT bool isMiniBrowser();
 bool isMobileStore();
 bool isSpringBoard();
 WEBCORE_EXPORT bool isWebProcess();
index 34b63d1..4a047f0 100644 (file)
@@ -166,6 +166,12 @@ bool MacApplication::isMicrosoftOutlook()
     return isMicrosoftOutlook;
 }
 
+bool MacApplication::isMiniBrowser()
+{
+    static bool isMiniBrowser = applicationBundleIsEqualTo("org.webkit.MiniBrowser"_s);
+    return isMiniBrowser;
+}
+
 bool MacApplication::isQuickenEssentials()
 {
     static bool isQuickenEssentials = applicationBundleIsEqualTo("com.intuit.QuickenEssentials"_s);
@@ -345,6 +351,12 @@ bool IOSApplication::isDataActivation()
     return isDataActivation;
 }
 
+bool IOSApplication::isMiniBrowser()
+{
+    static bool isMiniBrowser = applicationBundleIsEqualTo("org.webkit.MiniBrowser"_s);
+    return isMiniBrowser;
+}
+
 #endif
 
 } // namespace WebCore
index 719647f..6aefc42 100644 (file)
@@ -1,3 +1,21 @@
+2020-02-13  Benjamin Nham  <nham@apple.com>
+
+        Allow use of proxies in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=207598
+
+        For testing purposes, we allow Safari to use a custom HTTP/HTTPS proxy passed through
+        command line arguments. This gives MiniBrowser the same ability. Example invocation:
+
+        $ run-minibrowser --release -WebKit2HTTPProxy "http://127.0.0.1:8080" \
+                                    -WebKit2HTTPSProxy "http://127.0.0.1:8080"
+
+        Reviewed by Antti Koivisto.
+
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::parameters):
+
 2020-02-13  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] -updateSelectionWithExtentPoint:completionHandler: should work without requiring floating cursor
index f154a4e..a64db46 100644 (file)
@@ -374,12 +374,15 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
 
     {
         bool isSafari = false;
+        bool isMiniBrowser = false;
 #if PLATFORM(IOS_FAMILY)
         isSafari = WebCore::IOSApplication::isMobileSafari();
+        isMiniBrowser = WebCore::IOSApplication::isMiniBrowser();
 #elif PLATFORM(MAC)
         isSafari = WebCore::MacApplication::isSafari();
+        isMiniBrowser = WebCore::MacApplication::isMiniBrowser();
 #endif
-        if (isSafari) {
+        if (isSafari || isMiniBrowser) {
             parameters.defaultDataStoreParameters.networkSessionParameters.httpProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPProxyDefaultsKey]);
             parameters.defaultDataStoreParameters.networkSessionParameters.httpsProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPSProxyDefaultsKey]);
         }
index b1f10a3..e1651c8 100644 (file)
@@ -120,15 +120,18 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
     URL httpsProxy = m_configuration->httpsProxy();
     
     bool isSafari = false;
+    bool isMiniBrowser = false;
 #if PLATFORM(IOS_FAMILY)
     isSafari = WebCore::IOSApplication::isMobileSafari();
+    isMiniBrowser = WebCore::IOSApplication::isMiniBrowser();
 #elif PLATFORM(MAC)
     isSafari = WebCore::MacApplication::isSafari();
+    isMiniBrowser = WebCore::MacApplication::isMiniBrowser();
 #endif
     // FIXME: Remove these once Safari adopts _WKWebsiteDataStoreConfiguration.httpProxy and .httpsProxy.
-    if (!httpProxy.isValid() && isSafari)
+    if (!httpProxy.isValid() && (isSafari || isMiniBrowser))
         httpProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPProxyDefaultsKey]);
-    if (!httpsProxy.isValid() && isSafari)
+    if (!httpsProxy.isValid() && (isSafari || isMiniBrowser))
         httpsProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPSProxyDefaultsKey]);
 
     auto resourceLoadStatisticsDirectory = m_configuration->resourceLoadStatisticsDirectory();