summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/web_engine_context.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index deb67fe6f..79c093fab 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -49,6 +49,7 @@
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/threading/thread_restrictions.h"
#include "cc/base/switches.h"
+#include "chrome/common/chrome_switches.h"
#if QT_CONFIG(webengine_printing_and_pdf)
#include "chrome/browser/printing/print_job_manager.h"
#include "components/printing/browser/features.h"
@@ -212,6 +213,21 @@ bool usingSoftwareDynamicGL()
#endif
}
+void setupProxyPac(base::CommandLine *commandLine){
+ if (commandLine->HasSwitch(switches::kProxyPacUrl)) {
+ QUrl pac_url(toQt(commandLine->GetSwitchValueASCII(switches::kProxyPacUrl)));
+ if (pac_url.isValid() && pac_url.isLocalFile()) {
+ QFile file(pac_url.toLocalFile());
+ if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QByteArray ba = file.readAll();
+ commandLine->RemoveSwitch(switches::kProxyPacUrl);
+ commandLine->AppendSwitchASCII(switches::kProxyPacUrl,
+ ba.toBase64().prepend("data:application/x-javascript-config;base64,").toStdString());
+ }
+ }
+ }
+}
+
scoped_refptr<QtWebEngineCore::WebEngineContext> WebEngineContext::m_handle;
bool WebEngineContext::m_destroyed = false;
@@ -463,7 +479,7 @@ WebEngineContext::WebEngineContext()
#endif
base::CommandLine* parsedCommandLine = commandLine();
-
+ setupProxyPac(parsedCommandLine);
parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE));
// Enable sandboxing on OS X and Linux (Desktop / Embedded) by default.