diff options
author | Michal Klocek <michal.klocek@qt.io> | 2020-02-20 18:00:18 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2020-03-13 14:54:19 +0100 |
commit | 22c3bfa462eb6e3785eeda1a6540b09a9ae9fd67 (patch) | |
tree | b382ce092cb83179029adf67fa56a26400acfd2a | |
parent | 71c3f0a1f8decdd6ba43afb79fa23ee2dc8c743e (diff) |
Add support for qrc proxy pac file
Change-Id: Ic4b70d31c85a31a434644c311eb173cda6a82fbd
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/web_engine_context.cpp | 9 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.pri | 5 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.pro | 15 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac.qrc | 7 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro | 9 | ||||
-rw-r--r-- | tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro | 7 |
6 files changed, 38 insertions, 14 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 708fdaa74..55a9cc4a6 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -221,8 +221,13 @@ bool usingSoftwareDynamicGL() 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 (pac_url.isValid() && (pac_url.isLocalFile() || + !pac_url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive))) { + QFile file; + if (pac_url.isLocalFile()) + file.setFileName(pac_url.toLocalFile()); + else + file.setFileName(pac_url.path().prepend(QChar(':'))); if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { QByteArray ba = file.readAll(); commandLine->RemoveSwitch(switches::kProxyPacUrl); diff --git a/tests/auto/widgets/proxypac/proxypac.pri b/tests/auto/widgets/proxypac/proxypac.pri new file mode 100644 index 000000000..b3b2856c8 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac.pri @@ -0,0 +1,5 @@ +TEMPLATE = app +CONFIG += testcase +QT += testlib network webenginewidgets webengine +HEADERS += $$PWD/proxyserver.h +SOURCES += $$PWD/proxyserver.cpp $$PWD/tst_proxypac.cpp diff --git a/tests/auto/widgets/proxypac/proxypac.pro b/tests/auto/widgets/proxypac/proxypac.pro index 2aacb4366..f2a43d41f 100644 --- a/tests/auto/widgets/proxypac/proxypac.pro +++ b/tests/auto/widgets/proxypac/proxypac.pro @@ -1,13 +1,4 @@ -include(../tests.pri) -QT += webengine -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" - -QT_TOOL_ENV += proxy_pac +TEMPLATE = subdirs +SUBDIRS = proxypac_file proxypac_qrc +CONFIG += ordered diff --git a/tests/auto/widgets/proxypac/proxypac.qrc b/tests/auto/widgets/proxypac/proxypac.qrc new file mode 100644 index 000000000..9047585a0 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac.qrc @@ -0,0 +1,7 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> +<qresource profix="/"> + <file>proxy.pac</file> +</qresource> +</RCC> + diff --git a/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro b/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro new file mode 100644 index 000000000..037123054 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac_file/proxypac_file.pro @@ -0,0 +1,9 @@ +include(../proxypac.pri) + +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" + +QT_TOOL_ENV += proxy_pac + diff --git a/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro b/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro new file mode 100644 index 000000000..a5ab64605 --- /dev/null +++ b/tests/auto/widgets/proxypac/proxypac_qrc/proxypac_qrc.pro @@ -0,0 +1,7 @@ +include(../proxypac.pri) + +proxy_pac.name = QTWEBENGINE_CHROMIUM_FLAGS +proxy_pac.value = --proxy-pac-url="qrc:///proxy.pac" +boot2qt:proxy_pac.value = "--single-process --no-sandbox --proxy-pac-url=qrc:///proxy.pac" +QT_TOOL_ENV += proxy_pac +RESOURCES+= $$PWD/../proxypac.qrc |