diff options
-rw-r--r-- | src/core/web_engine_context.cpp | 18 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.pro | 4 |
3 files changed, 20 insertions, 5 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. diff --git a/tests/auto/widgets/proxypac/BLACKLIST b/tests/auto/widgets/proxypac/BLACKLIST deleted file mode 100644 index 42e9f8934..000000000 --- a/tests/auto/widgets/proxypac/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# QTBUG-81557 -[proxypac] -* diff --git a/tests/auto/widgets/proxypac/proxypac.pro b/tests/auto/widgets/proxypac/proxypac.pro index 4dbcd9365..2aacb4366 100644 --- a/tests/auto/widgets/proxypac/proxypac.pro +++ b/tests/auto/widgets/proxypac/proxypac.pro @@ -4,8 +4,10 @@ HEADERS += proxyserver.h SOURCES += proxyserver.cpp proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS + +win32:proxy_pac.value = --proxy-pac-url="file:///$$PWD/proxy.pac" +else:proxy_pac.value = --proxy-pac-url="file://$$PWD/proxy.pac" boot2qt:proxy_pac.value = "--single-process --no-sandbox --proxy-pac-url=file://$$PWD/proxy.pac" -else: proxy_pac.value = --proxy-pac-url="file://$$PWD/proxy.pac" QT_TOOL_ENV += proxy_pac |