Title: [225972] trunk/Tools
Revision
225972
Author
nael.ouedra...@crf.canon.fr
Date
2017-12-15 06:27:25 -0800 (Fri, 15 Dec 2017)

Log Message

[GTK] Add proxy option to Minibrowser
https://bugs.webkit.org/show_bug.cgi?id=180750

Reviewed by Michael Catanzaro.

Add command line option to set proxy settings in GTK minibrowser.

* MiniBrowser/gtk/main.c:
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (225971 => 225972)


--- trunk/Tools/ChangeLog	2017-12-15 13:58:59 UTC (rev 225971)
+++ trunk/Tools/ChangeLog	2017-12-15 14:27:25 UTC (rev 225972)
@@ -1,3 +1,15 @@
+2017-12-15  Nael Ouedraogo  <nael.ouedra...@crf.canon.fr>
+
+        [GTK] Add proxy option to Minibrowser
+        https://bugs.webkit.org/show_bug.cgi?id=180750
+
+        Reviewed by Michael Catanzaro.
+
+        Add command line option to set proxy settings in GTK minibrowser.
+
+        * MiniBrowser/gtk/main.c:
+        (main):
+
 2017-12-14  Basuke Suzuki  <basuke.suz...@sony.com>
 
         [webkitpy, Windows] Remove unnecessary debug message

Modified: trunk/Tools/MiniBrowser/gtk/main.c (225971 => 225972)


--- trunk/Tools/MiniBrowser/gtk/main.c	2017-12-15 13:58:59 UTC (rev 225971)
+++ trunk/Tools/MiniBrowser/gtk/main.c	2017-12-15 14:27:25 UTC (rev 225972)
@@ -37,6 +37,7 @@
 #define MINI_BROWSER_ERROR (miniBrowserErrorQuark())
 
 static const gchar **uriArguments = NULL;
+static const gchar **ignoreHosts = NULL;
 static GdkRGBA *backgroundColor;
 static gboolean editorMode;
 static const char *sessionFile;
@@ -45,6 +46,7 @@
 static gboolean automationMode;
 static gboolean fullScreen;
 static gboolean enableIntelligentTrackingPrevention;
+static const char *proxy;
 
 typedef enum {
     MINI_BROWSER_ERROR_INVALID_ABOUT_PATH
@@ -102,6 +104,8 @@
     { "private", 'p', 0, G_OPTION_ARG_NONE, &privateMode, "Run in private browsing mode", NULL },
     { "automation", 0, 0, G_OPTION_ARG_NONE, &automationMode, "Run in automation mode", NULL },
     { "enable-itp", 0, 0, G_OPTION_ARG_NONE, &enableIntelligentTrackingPrevention, "Enable intelligent tracking prevention", NULL },
+    { "proxy", 0, 0, G_OPTION_ARG_STRING, &proxy, "Set proxy", "PROXY" },
+    { "ignore-host", 0, 0, G_OPTION_ARG_STRING_ARRAY, &ignoreHosts, "Set proxy ignore hosts", "HOSTS" },
     { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
     { 0, 0, 0, 0, 0, 0, 0 }
 };
@@ -500,6 +504,12 @@
 
     WebKitWebContext *webContext = (privateMode || automationMode) ? webkit_web_context_new_ephemeral() : webkit_web_context_get_default();
 
+    if (proxy) {
+        WebKitNetworkProxySettings *webkitProxySettings = webkit_network_proxy_settings_new(proxy, ignoreHosts);
+        webkit_web_context_set_network_proxy_settings(webContext, WEBKIT_NETWORK_PROXY_MODE_CUSTOM, webkitProxySettings);
+        webkit_network_proxy_settings_free(webkitProxySettings);
+    }
+
     const gchar *singleprocess = g_getenv("MINIBROWSER_SINGLEPROCESS");
     webkit_web_context_set_process_model(webContext, (singleprocess && *singleprocess) ?
         WEBKIT_PROCESS_MODEL_SHARED_SECONDARY_PROCESS : WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to