summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp2
-rw-r--r--src/core/extensions/extension_system_qt.cpp70
-rw-r--r--src/core/extensions/extension_system_qt.h4
-rw-r--r--src/core/extensions/extension_web_contents_observer_qt.h4
-rw-r--r--src/core/extensions/extensions_browser_api_provider_qt.cpp11
-rw-r--r--src/core/extensions/extensions_browser_api_provider_qt.h3
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp66
-rw-r--r--src/core/extensions/extensions_browser_client_qt.h8
-rw-r--r--src/core/extensions/pdf_web_contents_helper_client_qt.h13
-rw-r--r--src/core/net/client_cert_override.h2
-rw-r--r--src/core/net/client_cert_store_data.cpp5
-rw-r--r--src/core/net/client_cert_store_data.h8
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp26
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h20
-rw-r--r--src/core/net/custom_protocol_handler.h3
-rw-r--r--src/core/net/network_delegate_qt.cpp75
-rw-r--r--src/core/net/network_delegate_qt.h50
-rw-r--r--src/core/net/proxy_config_service_qt.cpp16
-rw-r--r--src/core/net/proxy_config_service_qt.h8
-rw-r--r--src/core/net/qrc_url_scheme_handler.h3
-rw-r--r--src/core/net/restricted_cookie_manager_qt.cpp5
-rw-r--r--src/core/net/restricted_cookie_manager_qt.h6
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.cpp19
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.h20
-rw-r--r--src/core/net/url_request_context_getter_qt.h4
-rw-r--r--src/core/net/url_request_custom_job.cpp6
-rw-r--r--src/core/net/url_request_custom_job.h9
-rw-r--r--src/core/net/url_request_custom_job_delegate.cpp2
-rw-r--r--src/core/net/url_request_custom_job_delegate.h5
-rw-r--r--src/core/net/url_request_custom_job_proxy.h4
-rw-r--r--src/core/net/url_request_notification.cpp19
-rw-r--r--src/core/net/url_request_notification.h3
-rw-r--r--src/core/net/webui_controller_factory_qt.cpp6
-rw-r--r--src/core/net/webui_controller_factory_qt.h5
-rw-r--r--src/core/web_contents_adapter.cpp26
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc4
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h8
-rw-r--r--tests/auto/quick/inspectorserver/BLACKLIST1
-rw-r--r--tests/auto/widgets/origins/tst_origins.cpp137
-rw-r--r--tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp4
-rw-r--r--tests/auto/widgets/qwebenginehistory/resources/page5.html1
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp8
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp78
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp2
-rw-r--r--tests/auto/widgets/schemes/tst_schemes.cpp2
45 files changed, 415 insertions, 366 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index b27de4c23..9e2a4a5b1 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -126,7 +126,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize()
shareContext = new QOpenGLContext;
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
- format.setOption(QSurfaceFormat::ResetNotification);
+// format.setOption(QSurfaceFormat::ResetNotification);
shareContext->setFormat(format);
shareContext->create();
qAddPostRoutine(deleteShareContext);
diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp
index 7278e50c1..fbe98099c 100644
--- a/src/core/extensions/extension_system_qt.cpp
+++ b/src/core/extensions/extension_system_qt.cpp
@@ -102,8 +102,7 @@ namespace extensions {
namespace {
-std::string GenerateId(const base::DictionaryValue *manifest,
- const base::FilePath &path)
+std::string GenerateId(const base::DictionaryValue *manifest, const base::FilePath &path)
{
std::string raw_key;
std::string id_input;
@@ -130,49 +129,36 @@ std::unique_ptr<base::DictionaryValue> ParseManifest(const std::string &manifest
} // namespace
// Dummy Content Verifier Delegate. Added to prevent crashes.
-class ContentVerifierDelegateQt
- : public ContentVerifierDelegate {
- public:
- ~ContentVerifierDelegateQt() override {}
-
- // This should return what verification mode is appropriate for the given
- // extension, if any.
- bool ShouldBeVerified(const Extension& extension) override
+class ContentVerifierDelegateQt : public ContentVerifierDelegate
+{
+public:
+ ~ContentVerifierDelegateQt() override {}
+
+ // This should return what verification mode is appropriate for the given
+ // extension, if any.
+ bool ShouldBeVerified(const Extension &extension) override { return false; }
+
+ // Should return the public key to use for validating signatures via the two
+ // out parameters.
+ ContentVerifierKey GetPublicKey() override { return ContentVerifierKey(); }
+ // This should return a URL that can be used to fetch the
+ // verified_contents.json containing signatures for the given extension
+ // id/version pair.
+ GURL GetSignatureFetchUrl(const std::string &extension_id, const base::Version &version) override { return GURL(); }
+
+ // This should return the set of file paths for images used within the
+ // browser process. (These may get transcoded during the install process).
+ std::set<base::FilePath> GetBrowserImagePaths(const extensions::Extension *extension) override
{
- return false;
+ return std::set<base::FilePath>();
}
- // Should return the public key to use for validating signatures via the two
- // out parameters.
- ContentVerifierKey GetPublicKey() override {
- return ContentVerifierKey();
- }
- // This should return a URL that can be used to fetch the
- // verified_contents.json containing signatures for the given extension
- // id/version pair.
- GURL GetSignatureFetchUrl(const std::string& extension_id,
- const base::Version& version) override {
- return GURL();
- }
-
- // This should return the set of file paths for images used within the
- // browser process. (These may get transcoded during the install process).
- std::set<base::FilePath> GetBrowserImagePaths(
- const extensions::Extension* extension) override {
- return std::set<base::FilePath>();
- }
-
- // Called when the content verifier detects that a read of a file inside
- // an extension did not match its expected hash.
- void VerifyFailed(const std::string& extension_id,
- ContentVerifyJob::FailureReason reason) override {
-
- }
-
- // Called when ExtensionSystem is shutting down.
- void Shutdown() override {
-
- }
+ // Called when the content verifier detects that a read of a file inside
+ // an extension did not match its expected hash.
+ void VerifyFailed(const std::string &extension_id, ContentVerifyJob::FailureReason reason) override {}
+
+ // Called when ExtensionSystem is shutting down.
+ void Shutdown() override {}
};
void ExtensionSystemQt::LoadExtension(std::string extension_id, std::unique_ptr<base::DictionaryValue> manifest, const base::FilePath &directory)
diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h
index 4370f5cc3..04bffb74d 100644
--- a/src/core/extensions/extension_system_qt.h
+++ b/src/core/extensions/extension_system_qt.h
@@ -90,8 +90,8 @@ public:
ManagementPolicy *management_policy() override;
ServiceWorkerManager *service_worker_manager() override;
SharedUserScriptMaster *shared_user_script_master() override;
- StateStore* state_store() override;
- StateStore* rules_store() override;
+ StateStore *state_store() override;
+ StateStore *rules_store() override;
scoped_refptr<ValueStoreFactory> store_factory() override;
InfoMap *info_map() override;
QuotaService *quota_service() override;
diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h
index 5f32562fc..a528b3856 100644
--- a/src/core/extensions/extension_web_contents_observer_qt.h
+++ b/src/core/extensions/extension_web_contents_observer_qt.h
@@ -50,8 +50,8 @@
namespace extensions {
class ExtensionWebContentsObserverQt
- : public ExtensionWebContentsObserver,
- public content::WebContentsUserData<ExtensionWebContentsObserverQt>
+ : public ExtensionWebContentsObserver
+ , public content::WebContentsUserData<ExtensionWebContentsObserverQt>
{
public:
explicit ExtensionWebContentsObserverQt(content::WebContents *web_contents);
diff --git a/src/core/extensions/extensions_browser_api_provider_qt.cpp b/src/core/extensions/extensions_browser_api_provider_qt.cpp
index cc1932c64..731dfb0fd 100644
--- a/src/core/extensions/extensions_browser_api_provider_qt.cpp
+++ b/src/core/extensions/extensions_browser_api_provider_qt.cpp
@@ -42,16 +42,13 @@
#include "extensions/browser/api/generated_api_registration.h"
namespace extensions {
-ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() =
- default;
-ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() =
- default;
+ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() = default;
+ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() = default;
-void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions(
- ExtensionFunctionRegistry* registry) {
+void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions(ExtensionFunctionRegistry *registry)
+{
api::GeneratedFunctionRegistry::RegisterAll(registry);
}
}
-
diff --git a/src/core/extensions/extensions_browser_api_provider_qt.h b/src/core/extensions/extensions_browser_api_provider_qt.h
index 612df3825..f1d10ac95 100644
--- a/src/core/extensions/extensions_browser_api_provider_qt.h
+++ b/src/core/extensions/extensions_browser_api_provider_qt.h
@@ -45,7 +45,8 @@
namespace extensions {
-class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider {
+class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider
+{
public:
ExtensionsBrowserAPIProviderQt();
~ExtensionsBrowserAPIProviderQt() override;
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index eb8c12bff..59c15d2f5 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -97,72 +97,57 @@ void DetermineCharset(const std::string &mime_type,
if (base::StartsWith(mime_type, "text/", base::CompareCase::INSENSITIVE_ASCII)) {
// All of our HTML files should be UTF-8 and for other resource types
// (like images), charset doesn't matter.
- DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast<const char*>(data->front()), data->size())));
+ DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast<const char *>(data->front()), data->size())));
*out_charset = "utf-8";
}
}
// A request for an extension resource in a Chrome .pak file. These are used
// by component extensions.
-class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
+class URLRequestResourceBundleJob : public net::URLRequestSimpleJob
+{
public:
- URLRequestResourceBundleJob(net::URLRequest *request,
- net::NetworkDelegate *network_delegate,
- const base::FilePath &filename,
- int resource_id,
- const std::string &content_security_policy,
- bool send_cors_header)
- : net::URLRequestSimpleJob(request, network_delegate)
- , filename_(filename)
- , resource_id_(resource_id)
- , weak_factory_(this)
+ URLRequestResourceBundleJob(net::URLRequest *request, net::NetworkDelegate *network_delegate,
+ const base::FilePath &filename, int resource_id,
+ const std::string &content_security_policy, bool send_cors_header)
+ : net::URLRequestSimpleJob(request, network_delegate)
+ , filename_(filename)
+ , resource_id_(resource_id)
+ , weak_factory_(this)
{
// Leave cache headers out of resource bundle requests.
response_info_.headers = extensions::BuildHttpHeaders(content_security_policy, send_cors_header, base::Time());
}
- int GetRefCountedData(std::string* mime_type,
- std::string* charset,
- scoped_refptr<base::RefCountedMemory>* data,
+ int GetRefCountedData(std::string *mime_type, std::string *charset, scoped_refptr<base::RefCountedMemory> *data,
net::CompletionOnceCallback callback) const override
{
- const ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ const ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance();
*data = rb.LoadDataResourceBytes(resource_id_);
// Add the Content-Length header now that we know the resource length.
- response_info_.headers->AddHeader(
- base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength,
- base::NumberToString((*data)->size()).c_str()));
+ response_info_.headers->AddHeader(base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength,
+ base::NumberToString((*data)->size()).c_str()));
- std::string* read_mime_type = new std::string;
+ std::string *read_mime_type = new std::string;
base::PostTaskWithTraitsAndReplyWithResult(
- FROM_HERE, {base::MayBlock()},
- base::BindOnce(&net::GetMimeTypeFromFile, filename_,
- base::Unretained(read_mime_type)),
- base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead,
- weak_factory_.GetWeakPtr(), mime_type, charset, *data,
- base::Owned(read_mime_type), std::move(callback)));
+ FROM_HERE, { base::MayBlock() },
+ base::BindOnce(&net::GetMimeTypeFromFile, filename_, base::Unretained(read_mime_type)),
+ base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead, weak_factory_.GetWeakPtr(), mime_type,
+ charset, *data, base::Owned(read_mime_type), std::move(callback)));
return net::ERR_IO_PENDING;
}
- void GetResponseInfo(net::HttpResponseInfo* info) override
- {
- *info = response_info_;
- }
+ void GetResponseInfo(net::HttpResponseInfo *info) override { *info = response_info_; }
private:
~URLRequestResourceBundleJob() override {}
- void OnMimeTypeRead(std::string *out_mime_type,
- std::string *charset,
- scoped_refptr<base::RefCountedMemory> data,
- std::string *read_mime_type,
- net::CompletionOnceCallback callback,
- bool read_result)
+ void OnMimeTypeRead(std::string *out_mime_type, std::string *charset, scoped_refptr<base::RefCountedMemory> data,
+ std::string *read_mime_type, net::CompletionOnceCallback callback, bool read_result)
{
response_info_.headers->AddHeader(
- base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType,
- read_mime_type->c_str()));
+ base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, read_mime_type->c_str()));
*out_mime_type = *read_mime_type;
DetermineCharset(*read_mime_type, data.get(), charset);
int result = read_result ? net::OK : net::ERR_INVALID_URL;
@@ -444,8 +429,7 @@ bool ExtensionsBrowserClientQt::IsBackgroundUpdateAllowed()
return true;
}
-bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported(
- const std::string &min_version)
+bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported(const std::string &min_version)
{
return true;
}
@@ -482,7 +466,7 @@ KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate()
return nullptr;
}
-bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string& app_id)
+bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string &app_id)
{
return false;
}
diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h
index 056e65c9e..41cb2ce20 100644
--- a/src/core/extensions/extensions_browser_client_qt.h
+++ b/src/core/extensions/extensions_browser_client_qt.h
@@ -90,8 +90,7 @@ public:
void GetEarlyExtensionPrefsObservers(content::BrowserContext *context,
std::vector<EarlyExtensionPrefsObserver *> *observers) const override;
ProcessManagerDelegate *GetProcessManagerDelegate() const override;
- std::unique_ptr<ExtensionHostDelegate>
- CreateExtensionHostDelegate() override;
+ std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
bool DidVersionUpdate(content::BrowserContext *context) override;
void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override;
@@ -110,8 +109,7 @@ public:
ExtensionCache *GetExtensionCache() override;
bool IsBackgroundUpdateAllowed() override;
bool IsMinBrowserVersionSupported(const std::string &min_version) override;
- ExtensionWebContentsObserver *GetExtensionWebContentsObserver(
- content::WebContents *web_contents) override;
+ ExtensionWebContentsObserver *GetExtensionWebContentsObserver(content::WebContents *web_contents) override;
KioskDelegate *GetKioskDelegate() override;
// Whether the browser context is associated with Chrome OS lock screen.
@@ -138,7 +136,7 @@ public:
// Returns the locale used by the application.
std::string GetApplicationLocale() override;
- bool IsScreensaverInDemoMode(const std::string& app_id) override;
+ bool IsScreensaverInDemoMode(const std::string &app_id) override;
// Sets the API client.
void SetAPIClientForTest(ExtensionsAPIClient *api_client);
diff --git a/src/core/extensions/pdf_web_contents_helper_client_qt.h b/src/core/extensions/pdf_web_contents_helper_client_qt.h
index a22feb138..9a37375b3 100644
--- a/src/core/extensions/pdf_web_contents_helper_client_qt.h
+++ b/src/core/extensions/pdf_web_contents_helper_client_qt.h
@@ -10,20 +10,21 @@
namespace extensions {
-class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient {
+class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient
+{
public:
PDFWebContentsHelperClientQt();
~PDFWebContentsHelperClientQt() override;
private:
// pdf::PDFWebContentsHelperClient:
- void UpdateContentRestrictions(content::WebContents* contents, int content_restrictions) override;
- void OnPDFHasUnsupportedFeature(content::WebContents* contents) override;
- void OnSaveURL(content::WebContents* contents) override;
+ void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override;
+ void OnPDFHasUnsupportedFeature(content::WebContents *contents) override;
+ void OnSaveURL(content::WebContents *contents) override;
DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelperClientQt);
};
-} // namespace extensions
+} // namespace extensions
-#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_
+#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_
diff --git a/src/core/net/client_cert_override.h b/src/core/net/client_cert_override.h
index 4f2734485..7fd28eaeb 100644
--- a/src/core/net/client_cert_override.h
+++ b/src/core/net/client_cert_override.h
@@ -71,5 +71,3 @@ private:
} // QtWebEngineCore
#endif
-
-
diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp
index 5a62cb6fe..314e64145 100644
--- a/src/core/net/client_cert_store_data.cpp
+++ b/src/core/net/client_cert_store_data.cpp
@@ -59,7 +59,8 @@
namespace {
-class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate {
+class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate
+{
public:
SSLPlatformKeyOverride(const QByteArray &sslKeyInBytes)
{
@@ -126,7 +127,7 @@ scoped_refptr<net::SSLPrivateKey> wrapOpenSSLPrivateKey(const QByteArray &sslKey
net::GetSSLPlatformKeyTaskRunner());
}
-} // namespace
+} // namespace
namespace QtWebEngineCore {
diff --git a/src/core/net/client_cert_store_data.h b/src/core/net/client_cert_store_data.h
index 7f83f4b60..e47a909e4 100644
--- a/src/core/net/client_cert_store_data.h
+++ b/src/core/net/client_cert_store_data.h
@@ -57,8 +57,10 @@ class X509Certificate;
namespace QtWebEngineCore {
-struct ClientCertificateStoreData {
- struct Entry {
+struct ClientCertificateStoreData
+{
+ struct Entry
+ {
QSslKey key;
QSslCertificate certificate;
scoped_refptr<net::X509Certificate> certPtr;
@@ -69,7 +71,7 @@ struct ClientCertificateStoreData {
void remove(const QSslCertificate &certificate);
void clear();
- QVector<Entry*> extraCerts;
+ QVector<Entry *> extraCerts;
};
} // namespace QtWebEngineCore
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 5f7b75f57..dad9a8db5 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -52,7 +52,8 @@
namespace QtWebEngineCore {
-static GURL sourceUrlForCookie(const QNetworkCookie &cookie) {
+static GURL sourceUrlForCookie(const QNetworkCookie &cookie)
+{
QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path());
return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure());
}
@@ -70,11 +71,10 @@ CookieMonsterDelegateQt::~CookieMonsterDelegateQt()
void CookieMonsterDelegateQt::AddStore(net::CookieStore *store)
{
- std::unique_ptr<net::CookieChangeSubscription> sub =
- store->GetChangeDispatcher().AddCallbackForAllChanges(
+ std::unique_ptr<net::CookieChangeSubscription> sub = store->GetChangeDispatcher().AddCallbackForAllChanges(
base::Bind(&CookieMonsterDelegateQt::OnCookieChanged,
- // this object's destruction will deregister the subscription.
- base::Unretained(this)));
+ // this object's destruction will deregister the subscription.
+ base::Unretained(this)));
m_subscriptions.push_back(std::move(sub));
}
@@ -87,7 +87,7 @@ bool CookieMonsterDelegateQt::hasCookieMonster()
void CookieMonsterDelegateQt::getAllCookies(quint64 callbackId)
{
net::CookieMonster::GetCookieListCallback callback =
- base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId);
+ base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId);
base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesOnIOThread, this, std::move(callback)));
@@ -115,9 +115,8 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie
gurl, cookie.toRawForm().toStdString(), std::move(callback)));
}
-void CookieMonsterDelegateQt::SetCookieOnIOThread(
- const GURL& url, const std::string& cookie_line,
- net::CookieMonster::SetCookiesCallback callback)
+void CookieMonsterDelegateQt::SetCookieOnIOThread(const GURL &url, const std::string &cookie_line,
+ net::CookieMonster::SetCookiesCallback callback)
{
net::CookieOptions options;
options.set_include_httponly();
@@ -138,7 +137,7 @@ void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const Q
gurl, cookie.name().toStdString()));
}
-void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name)
+void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name)
{
if (m_cookieMonster) {
net::CookieMonster::GetCookieListCallback callback =
@@ -147,7 +146,8 @@ void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std:
}
}
-void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList)
+void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies,
+ const net::CookieStatusList &statusList)
{
Q_UNUSED(statusList);
if (!m_cookieMonster)
@@ -197,7 +197,7 @@ void CookieMonsterDelegateQt::DeleteAllOnIOThread(net::CookieMonster::DeleteCall
m_cookieMonster->DeleteAllAsync(std::move(callback));
}
-void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster)
+void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster *monster)
{
if (monster == m_cookieMonster)
return;
@@ -246,7 +246,7 @@ bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUr
return m_client->d_func()->canAccessCookies(firstPartyUrl, url);
}
-void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, net::CookieChangeCause cause)
+void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieChangeCause cause)
{
if (!m_client)
return;
diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h
index 2ac04acb4..23b803790 100644
--- a/src/core/net/cookie_monster_delegate_qt.h
+++ b/src/core/net/cookie_monster_delegate_qt.h
@@ -72,13 +72,14 @@ namespace QtWebEngineCore {
// cookies for the file:// scheme, which is disabled by default in Chromium.
// Since qrc:// is similar to file:// and there are some unknowns about how
// to correctly handle file:// cookies, qrc:// should only be used for testing.
-static const char* const kCookieableSchemes[] =
- { "http", "https", "qrc", "ws", "wss" };
+static const char *const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" };
-class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt> {
+class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt>
+{
QPointer<QWebEngineCookieStore> m_client;
net::CookieMonster *m_cookieMonster;
std::vector<std::unique_ptr<net::CookieChangeSubscription>> m_subscriptions;
+
public:
CookieMonsterDelegateQt();
~CookieMonsterDelegateQt();
@@ -91,7 +92,7 @@ public:
void deleteSessionCookies(quint64 callbackId);
void deleteAllCookies(quint64 callbackId);
- void setCookieMonster(net::CookieMonster* monster);
+ void setCookieMonster(net::CookieMonster *monster);
void setClient(QWebEngineCookieStore *client);
bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const;
@@ -102,13 +103,16 @@ public:
private:
void GetAllCookiesOnIOThread(net::CookieMonster::GetCookieListCallback callback);
- void SetCookieOnIOThread(const GURL& url, const std::string& cookie_line, net::CookieMonster::SetCookiesCallback callback);
- void DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name);
+ void SetCookieOnIOThread(const GURL &url, const std::string &cookie_line,
+ net::CookieMonster::SetCookiesCallback callback);
+ void DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name);
void DeleteSessionCookiesOnIOThread(net::CookieMonster::DeleteCallback callback);
void DeleteAllOnIOThread(net::CookieMonster::DeleteCallback callback);
- void GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList);
- void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies, const net::CookieStatusList &statusList);
+ void GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies,
+ const net::CookieStatusList &statusList);
+ void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies,
+ const net::CookieStatusList &statusList);
void SetCookieCallbackOnIOThread(qint64 callbackId, net::CanonicalCookie::CookieInclusionStatus status);
void DeleteCookiesCallbackOnIOThread(qint64 callbackId, uint numCookies);
diff --git a/src/core/net/custom_protocol_handler.h b/src/core/net/custom_protocol_handler.h
index 7b189763c..625afc1d5 100644
--- a/src/core/net/custom_protocol_handler.h
+++ b/src/core/net/custom_protocol_handler.h
@@ -71,7 +71,8 @@ class ProfileAdapter;
// Implements a ProtocolHandler for custom URL schemes.
// If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED.
-class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
+class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler
+{
public:
CustomProtocolHandler(QPointer<ProfileAdapter> profileAdapter);
diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp
index 772ef06aa..7d3801ffe 100644
--- a/src/core/net/network_delegate_qt.cpp
+++ b/src/core/net/network_delegate_qt.cpp
@@ -141,7 +141,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet
// quick peek if deprecated
if (m_profileIOData->isInterceptorDeprecated()) {
- QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->acquireInterceptor();
+ QWebEngineUrlRequestInterceptor *profileInterceptor = m_profileIOData->acquireInterceptor();
if (profileInterceptor && m_profileIOData->isInterceptorDeprecated()) {
profileInterceptor->interceptRequest(requestInfo);
m_profileIOData->releaseInterceptor();
@@ -197,25 +197,19 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet
return net::ERR_IO_PENDING;
}
-void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest*)
-{
-}
+void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest *) {}
-void NetworkDelegateQt::OnCompleted(net::URLRequest */*request*/, bool /*started*/, int /*net_error*/)
-{
-}
+void NetworkDelegateQt::OnCompleted(net::URLRequest * /*request*/, bool /*started*/, int /*net_error*/) {}
-bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest& request,
- const net::CanonicalCookie & /*cookie*/,
- net::CookieOptions*,
- bool allowedFromCaller)
+bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie & /*cookie*/,
+ net::CookieOptions *, bool allowedFromCaller)
{
if (!allowedFromCaller)
return false;
return canSetCookies(request.site_for_cookies(), request.url(), std::string());
}
-bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const net::CookieList&, bool allowedFromCaller)
+bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest &request, const net::CookieList &, bool allowedFromCaller)
{
if (!allowedFromCaller)
return false;
@@ -225,8 +219,8 @@ bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const ne
bool NetworkDelegateQt::OnForcePrivacyMode(const GURL &url, const GURL &site_for_cookies) const
{
return false;
-// FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72)
-// return !canGetCookies(site_for_cookies, url);
+ // FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72)
+ // return !canGetCookies(site_for_cookies, url);
}
bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const
@@ -246,71 +240,64 @@ int NetworkDelegateQt::OnBeforeStartTransaction(net::URLRequest *, net::Completi
return net::OK;
}
-void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info,
- const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers)
-{
-}
+void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info,
+ const net::ProxyRetryInfoMap &proxy_retry_info,
+ net::HttpRequestHeaders *headers)
+{}
-void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers)
-{
-}
+void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) {}
-int NetworkDelegateQt::OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*)
+int NetworkDelegateQt::OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *,
+ scoped_refptr<net::HttpResponseHeaders> *, GURL *)
{
return net::OK;
}
-void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest*, const GURL&)
-{
-}
+void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest *, const GURL &) {}
-void NetworkDelegateQt::OnResponseStarted(net::URLRequest*, int)
-{
-}
+void NetworkDelegateQt::OnResponseStarted(net::URLRequest *, int) {}
-void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest*, int64_t)
-{
-}
+void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest *, int64_t) {}
-void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest*, int64_t)
-{
-}
+void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest *, int64_t) {}
-void NetworkDelegateQt::OnPACScriptError(int, const base::string16&)
-{
-}
+void NetworkDelegateQt::OnPACScriptError(int, const base::string16 &) {}
-net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*)
+net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest *,
+ const net::AuthChallengeInfo &,
+ AuthCallback, net::AuthCredentials *)
{
return AUTH_REQUIRED_RESPONSE_NO_ACTION;
}
-bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const
+bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const
{
return true;
}
-bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const
+bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &,
+ const GURL &) const
{
return false;
}
-bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin& origin) const
+bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin &origin) const
{
return false;
}
-void NetworkDelegateQt::OnCanSendReportingReports(std::set<url::Origin> origins, base::OnceCallback<void(std::set<url::Origin>)> result_callback) const
+void NetworkDelegateQt::OnCanSendReportingReports(std::set<url::Origin> origins,
+ base::OnceCallback<void(std::set<url::Origin>)> result_callback) const
{
std::move(result_callback).Run(std::set<url::Origin>());
}
-bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const
+bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const
{
return false;
}
-bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const
+bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const
{
return false;
}
diff --git a/src/core/net/network_delegate_qt.h b/src/core/net/network_delegate_qt.h
index 53debadcd..f294c6c7c 100644
--- a/src/core/net/network_delegate_qt.h
+++ b/src/core/net/network_delegate_qt.h
@@ -54,36 +54,44 @@ namespace QtWebEngineCore {
class ProfileIODataQt;
-class NetworkDelegateQt : public net::NetworkDelegate {
+class NetworkDelegateQt : public net::NetworkDelegate
+{
ProfileIODataQt *m_profileIOData;
+
public:
NetworkDelegateQt(ProfileIODataQt *data);
// net::NetworkDelegate implementation
- int OnBeforeURLRequest(net::URLRequest* request, net::CompletionOnceCallback callback, GURL* new_url) override;
- void OnURLRequestDestroyed(net::URLRequest* request) override;
- bool OnCanSetCookie(const net::URLRequest& request, const net::CanonicalCookie& cookie, net::CookieOptions* options, bool) override;
- int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback, net::HttpRequestHeaders *headers) override;
- void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info,
- const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override;
+ int OnBeforeURLRequest(net::URLRequest *request, net::CompletionOnceCallback callback, GURL *new_url) override;
+ void OnURLRequestDestroyed(net::URLRequest *request) override;
+ bool OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie &cookie, net::CookieOptions *options,
+ bool) override;
+ int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback,
+ net::HttpRequestHeaders *headers) override;
+ void OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info,
+ const net::ProxyRetryInfoMap &proxy_retry_info, net::HttpRequestHeaders *headers) override;
void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override;
- int OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) override;
- void OnBeforeRedirect(net::URLRequest*, const GURL&) override;
- void OnResponseStarted(net::URLRequest*, int) override;
- void OnNetworkBytesReceived(net::URLRequest*, int64_t) override;
+ int OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *,
+ scoped_refptr<net::HttpResponseHeaders> *, GURL *) override;
+ void OnBeforeRedirect(net::URLRequest *, const GURL &) override;
+ void OnResponseStarted(net::URLRequest *, int) override;
+ void OnNetworkBytesReceived(net::URLRequest *, int64_t) override;
void OnNetworkBytesSent(net::URLRequest *, int64_t) override;
void OnCompleted(net::URLRequest *request, bool started, int net_error) override;
- void OnPACScriptError(int, const base::string16&) override;
- net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*) override;
- bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&, bool) override;
- bool OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const override;
- bool OnForcePrivacyMode(const GURL&, const GURL&) const override;
- bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override;
+ void OnPACScriptError(int, const base::string16 &) override;
+ net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest *, const net::AuthChallengeInfo &,
+ AuthCallback, net::AuthCredentials *) override;
+ bool OnCanGetCookies(const net::URLRequest &, const net::CookieList &, bool) override;
+ bool OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const override;
+ bool OnForcePrivacyMode(const GURL &, const GURL &) const override;
+ bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &,
+ const GURL &) const override;
- bool OnCanQueueReportingReport(const url::Origin& origin) const override;
- void OnCanSendReportingReports(std::set<url::Origin> origins, base::OnceCallback<void(std::set<url::Origin>)> result_callback) const override;
- bool OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const override;
- bool OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const override;
+ bool OnCanQueueReportingReport(const url::Origin &origin) const override;
+ void OnCanSendReportingReports(std::set<url::Origin> origins,
+ base::OnceCallback<void(std::set<url::Origin>)> result_callback) const override;
+ bool OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const override;
+ bool OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const override;
bool canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const;
bool canGetCookies(const GURL &first_party, const GURL &url) const;
diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp
index 00ff1c54d..8016c7e83 100644
--- a/src/core/net/proxy_config_service_qt.cpp
+++ b/src/core/net/proxy_config_service_qt.cpp
@@ -70,14 +70,14 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt
}
ProxyConfigServiceQt::ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService,
- const net::ProxyConfigWithAnnotation& initialConfig, ProxyPrefs::ConfigState initialState)
- : m_baseService(baseService.release()),
- m_usesSystemConfiguration(false),
- m_registeredObserver(false),
- m_prefConfig(initialConfig),
- m_perfState(initialState)
-{
-}
+ const net::ProxyConfigWithAnnotation &initialConfig,
+ ProxyPrefs::ConfigState initialState)
+ : m_baseService(baseService.release())
+ , m_usesSystemConfiguration(false)
+ , m_registeredObserver(false)
+ , m_prefConfig(initialConfig)
+ , m_perfState(initialState)
+{}
ProxyConfigServiceQt::~ProxyConfigServiceQt()
{
diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h
index 09e88d445..4d8619055 100644
--- a/src/core/net/proxy_config_service_qt.h
+++ b/src/core/net/proxy_config_service_qt.h
@@ -51,14 +51,14 @@
#include <QNetworkProxy>
class ProxyConfigServiceQt
- : public net::ProxyConfigService
- , public net::ProxyConfigService::Observer {
+ : public net::ProxyConfigService
+ , public net::ProxyConfigService::Observer
+{
public:
-
static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &);
explicit ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService,
- const net::ProxyConfigWithAnnotation& initialConfig,
+ const net::ProxyConfigWithAnnotation &initialConfig,
ProxyPrefs::ConfigState initialState);
~ProxyConfigServiceQt() override;
diff --git a/src/core/net/qrc_url_scheme_handler.h b/src/core/net/qrc_url_scheme_handler.h
index f6ca92879..586147cdf 100644
--- a/src/core/net/qrc_url_scheme_handler.h
+++ b/src/core/net/qrc_url_scheme_handler.h
@@ -45,7 +45,8 @@
namespace QtWebEngineCore {
-class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler {
+class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler
+{
public:
void requestStarted(QWebEngineUrlRequestJob *) override;
};
diff --git a/src/core/net/restricted_cookie_manager_qt.cpp b/src/core/net/restricted_cookie_manager_qt.cpp
index e01969f4d..7f1ca163e 100644
--- a/src/core/net/restricted_cookie_manager_qt.cpp
+++ b/src/core/net/restricted_cookie_manager_qt.cpp
@@ -58,7 +58,8 @@
namespace QtWebEngineCore {
-class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener {
+class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener
+{
public:
RestrictedCookieManagerListenerQt(const GURL &url,
const GURL &site_for_cookies,
@@ -181,4 +182,4 @@ bool RestrictedCookieManagerQt::allowCookies(const GURL &url, const GURL &site_f
return m_profileIoData->canGetCookies(toQt(site_for_cookies), toQt(url));
}
-} // namespace QtWebEngineCore
+} // namespace QtWebEngineCore
diff --git a/src/core/net/restricted_cookie_manager_qt.h b/src/core/net/restricted_cookie_manager_qt.h
index a277c7c96..9154f671d 100644
--- a/src/core/net/restricted_cookie_manager_qt.h
+++ b/src/core/net/restricted_cookie_manager_qt.h
@@ -85,7 +85,7 @@ public:
CookiesEnabledForCallback callback) override;
// Internal:
- bool allowCookies(const GURL& url, const GURL &site_for_cookies) const;
+ bool allowCookies(const GURL &url, const GURL &site_for_cookies) const;
private:
base::WeakPtr<ProfileIODataQt> m_profileIoData;
@@ -95,6 +95,6 @@ private:
DISALLOW_COPY_AND_ASSIGN(RestrictedCookieManagerQt);
};
-} // namespace QtWebEngineCore
+} // namespace QtWebEngineCore
-#endif // RESTRICTED_COOKIE_MANAGER_QT_H
+#endif // RESTRICTED_COOKIE_MANAGER_QT_H
diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp
index b6cdf68dc..0885475be 100644
--- a/src/core/net/ssl_host_state_delegate_qt.cpp
+++ b/src/core/net/ssl_host_state_delegate_qt.cpp
@@ -67,19 +67,15 @@ bool CertPolicy::Check(const net::X509Certificate &cert, int error) const
return false;
}
-void CertPolicy::Allow(const net::X509Certificate& cert, int error)
+void CertPolicy::Allow(const net::X509Certificate &cert, int error)
{
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
m_allowed[fingerprint] |= error;
}
-SSLHostStateDelegateQt::SSLHostStateDelegateQt()
-{
-}
+SSLHostStateDelegateQt::SSLHostStateDelegateQt() {}
-SSLHostStateDelegateQt::~SSLHostStateDelegateQt()
-{
-}
+SSLHostStateDelegateQt::~SSLHostStateDelegateQt() {}
void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, int error)
{
@@ -87,7 +83,7 @@ void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509C
}
// Clear all allow preferences.
-void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string&)>& host_filter)
+void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string &)> &host_filter)
{
if (host_filter.is_null()) {
m_certPolicyforHost.clear();
@@ -107,9 +103,10 @@ void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string&)
// Queries whether |cert| is allowed for |host| and |error|. Returns true in
// |expired_previous_decision| if a previous user decision expired immediately
// prior to this query, otherwise false.
-content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy(
- const std::string &host, const net::X509Certificate &cert,
- int error, bool */*expired_previous_decision*/)
+content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy(const std::string &host,
+ const net::X509Certificate &cert,
+ int error,
+ bool * /*expired_previous_decision*/)
{
return m_certPolicyforHost[host].Check(cert, error) ? SSLHostStateDelegate::ALLOWED : SSLHostStateDelegate::DENIED;
}
diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h
index 28e239304..e361aa0be 100644
--- a/src/core/net/ssl_host_state_delegate_qt.h
+++ b/src/core/net/ssl_host_state_delegate_qt.h
@@ -45,19 +45,21 @@
namespace QtWebEngineCore {
-class CertPolicy {
+class CertPolicy
+{
public:
CertPolicy();
~CertPolicy();
- bool Check(const net::X509Certificate& cert, int error) const;
- void Allow(const net::X509Certificate& cert, int error);
+ bool Check(const net::X509Certificate &cert, int error) const;
+ void Allow(const net::X509Certificate &cert, int error);
bool HasAllowException() const { return m_allowed.size() > 0; }
private:
std::map<net::SHA256HashValue, int> m_allowed;
};
-class SSLHostStateDelegateQt : public content::SSLHostStateDelegate {
+class SSLHostStateDelegateQt : public content::SSLHostStateDelegate
+{
public:
SSLHostStateDelegateQt();
@@ -65,11 +67,11 @@ public:
// content::SSLHostStateDelegate implementation:
void AllowCert(const std::string &, const net::X509Certificate &cert, int error) override;
- void Clear(const base::Callback<bool(const std::string&)>& host_filter) override;
- CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert,
- int error, bool *expired_previous_decision) override;
- void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override;
- bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override;
+ void Clear(const base::Callback<bool(const std::string &)> &host_filter) override;
+ CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error,
+ bool *expired_previous_decision) override;
+ void HostRanInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
+ bool DidHostRunInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
void RevokeUserAllowExceptions(const std::string &host) override;
bool HasAllowException(const std::string &host) override;
diff --git a/src/core/net/url_request_context_getter_qt.h b/src/core/net/url_request_context_getter_qt.h
index b6135cb16..a6ef6eae0 100644
--- a/src/core/net/url_request_context_getter_qt.h
+++ b/src/core/net/url_request_context_getter_qt.h
@@ -46,11 +46,13 @@ namespace QtWebEngineCore {
class ProfileIODataQt;
-class URLRequestContextGetterQt : public net::URLRequestContextGetter {
+class URLRequestContextGetterQt : public net::URLRequestContextGetter
+{
public:
URLRequestContextGetterQt(ProfileIODataQt *data);
net::URLRequestContext *GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override;
+
private:
virtual ~URLRequestContextGetterQt();
ProfileIODataQt *m_profileIOData;
diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp
index 37f7de256..607e8d232 100644
--- a/src/core/net/url_request_custom_job.cpp
+++ b/src/core/net/url_request_custom_job.cpp
@@ -132,7 +132,7 @@ bool URLRequestCustomJob::GetMimeType(std::string *mimeType) const
return false;
}
-bool URLRequestCustomJob::GetCharset(std::string* charset)
+bool URLRequestCustomJob::GetCharset(std::string *charset)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (m_charset.size() > 0) {
@@ -142,7 +142,7 @@ bool URLRequestCustomJob::GetCharset(std::string* charset)
return false;
}
-void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info)
+void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo *info)
{
// Based on net::URLRequestRedirectJob::StartAsync()
@@ -173,7 +173,7 @@ void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info)
info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(headers));
}
-bool URLRequestCustomJob::IsRedirectResponse(GURL* location, int* http_status_code, bool* /*insecure_scheme_was_upgraded*/)
+bool URLRequestCustomJob::IsRedirectResponse(GURL *location, int *http_status_code, bool * /*insecure_scheme_was_upgraded*/)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (m_redirect.is_valid()) {
diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h
index 19a1a5776..af5a6f8e0 100644
--- a/src/core/net/url_request_custom_job.h
+++ b/src/core/net/url_request_custom_job.h
@@ -53,7 +53,8 @@ class URLRequestCustomJobDelegate;
class URLRequestCustomJobProxy;
// A request job that handles reading custom URL schemes
-class URLRequestCustomJob : public net::URLRequestJob {
+class URLRequestCustomJob : public net::URLRequestJob
+{
public:
URLRequestCustomJob(net::URLRequest *request,
net::NetworkDelegate *networkDelegate,
@@ -61,11 +62,11 @@ public:
QPointer<ProfileAdapter> profileAdapter);
void Start() override;
void Kill() override;
- int ReadRawData(net::IOBuffer *buf, int buf_size) override;
+ int ReadRawData(net::IOBuffer *buf, int buf_size) override;
bool GetMimeType(std::string *mimeType) const override;
bool GetCharset(std::string *charset) override;
- void GetResponseInfo(net::HttpResponseInfo* info) override;
- bool IsRedirectResponse(GURL* location, int* http_status_code, bool* insecure_scheme_was_upgraded) override;
+ void GetResponseInfo(net::HttpResponseInfo *info) override;
+ bool IsRedirectResponse(GURL *location, int *http_status_code, bool *insecure_scheme_was_upgraded) override;
protected:
virtual ~URLRequestCustomJob();
diff --git a/src/core/net/url_request_custom_job_delegate.cpp b/src/core/net/url_request_custom_job_delegate.cpp
index b5a7a55a7..f73296cf0 100644
--- a/src/core/net/url_request_custom_job_delegate.cpp
+++ b/src/core/net/url_request_custom_job_delegate.cpp
@@ -117,7 +117,7 @@ void URLRequestCustomJobDelegate::redirect(const QUrl &url)
void URLRequestCustomJobDelegate::fail(Error error)
{
- int net_error = 0;
+ int net_error = 0;
switch (error) {
case NoError:
break;
diff --git a/src/core/net/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h
index 0ab1a82c7..93ae39e84 100644
--- a/src/core/net/url_request_custom_job_delegate.h
+++ b/src/core/net/url_request_custom_job_delegate.h
@@ -64,7 +64,8 @@ namespace QtWebEngineCore {
class URLRequestCustomJobProxy;
-class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject {
+class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject
+{
Q_OBJECT
public:
~URLRequestCustomJobDelegate();
@@ -84,7 +85,7 @@ public:
QMap<QByteArray, QByteArray> requestHeaders() const;
void reply(const QByteArray &contentType, QIODevice *device);
- void redirect(const QUrl& url);
+ void redirect(const QUrl &url);
void abort();
void fail(Error);
diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h
index aa55db07c..d4cd7e208 100644
--- a/src/core/net/url_request_custom_job_proxy.h
+++ b/src/core/net/url_request_custom_job_proxy.h
@@ -56,8 +56,8 @@ class ProfileAdapter;
// Used to comunicate between URLRequestCustomJob living on the IO thread
// and URLRequestCustomJobDelegate living on the UI thread.
-class URLRequestCustomJobProxy
- : public base::RefCountedThreadSafe<URLRequestCustomJobProxy> {
+class URLRequestCustomJobProxy : public base::RefCountedThreadSafe<URLRequestCustomJobProxy>
+{
public:
URLRequestCustomJobProxy(URLRequestCustomJob *job,
diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp
index 9d309e314..fa6d61f65 100644
--- a/src/core/net/url_request_notification.cpp
+++ b/src/core/net/url_request_notification.cpp
@@ -53,11 +53,13 @@
namespace QtWebEngineCore {
// Calls cancel() when the URLRequest is destroyed.
-class UserData : public base::SupportsUserData::Data {
+class UserData : public base::SupportsUserData::Data
+{
public:
UserData(URLRequestNotification *ptr) : m_ptr(ptr) {}
~UserData() { m_ptr->cancel(); }
static const char key[];
+
private:
URLRequestNotification *m_ptr;
};
@@ -69,13 +71,10 @@ static content::ResourceType fromQt(QWebEngineUrlRequestInfo::ResourceType resou
return static_cast<content::ResourceType>(resourceType);
}
-URLRequestNotification::URLRequestNotification(net::URLRequest *request,
- bool isMainFrameRequest,
- GURL *newUrl,
- QWebEngineUrlRequestInfo &&requestInfo,
- content::ResourceRequestInfo::WebContentsGetter webContentsGetter,
- net::CompletionOnceCallback callback,
- QPointer<ProfileAdapter> adapter)
+URLRequestNotification::URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, GURL *newUrl,
+ QWebEngineUrlRequestInfo &&requestInfo,
+ content::ResourceRequestInfo::WebContentsGetter webContentsGetter,
+ net::CompletionOnceCallback callback, QPointer<ProfileAdapter> adapter)
: m_request(request)
, m_isMainFrameRequest(isMainFrameRequest)
, m_newUrl(newUrl)
@@ -108,7 +107,7 @@ void URLRequestNotification::notify()
if (webContents) {
if (m_profileAdapter && m_profileAdapter->requestInterceptor()) {
- QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor();
+ QWebEngineUrlRequestInterceptor *interceptor = m_profileAdapter->requestInterceptor();
if (!interceptor->property("deprecated").toBool())
interceptor->interceptRequest(m_requestInfo);
}
@@ -152,7 +151,7 @@ void URLRequestNotification::notify()
base::BindOnce(&URLRequestNotification::complete, base::Unretained(this), result));
}
-void URLRequestNotification::cancel()
+void URLRequestNotification::cancel()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
diff --git a/src/core/net/url_request_notification.h b/src/core/net/url_request_notification.h
index 1d9acf12f..673e07bf0 100644
--- a/src/core/net/url_request_notification.h
+++ b/src/core/net/url_request_notification.h
@@ -57,7 +57,8 @@ class ProfileAdapter;
class ProfileIoDataQt;
// Notifies WebContentsAdapterClient of a new URLRequest.
-class URLRequestNotification {
+class URLRequestNotification
+{
public:
URLRequestNotification(net::URLRequest *request,
bool isMainFrameRequest,
diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp
index 2bfd242e7..8c045bb7b 100644
--- a/src/core/net/webui_controller_factory_qt.cpp
+++ b/src/core/net/webui_controller_factory_qt.cpp
@@ -109,7 +109,7 @@ typedef std::unique_ptr<WebUIController> (*WebUIFactoryFunction)(WebUI *web_ui,
// Template for defining WebUIFactoryFunction.
template<class T>
-std::unique_ptr<WebUIController> NewWebUI(WebUI *web_ui, const GURL &/*url*/)
+std::unique_ptr<WebUIController> NewWebUI(WebUI *web_ui, const GURL & /*url*/)
{
return std::unique_ptr<WebUIController>(new T(web_ui));
}
@@ -130,8 +130,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co
return &NewWebUI<QuotaInternalsUI>;
if (url.SchemeIs(content::kChromeDevToolsScheme)) {
-// if (!DevToolsUIBindings::IsValidFrontendURL(url))
-// return nullptr;
+ // if (!DevToolsUIBindings::IsValidFrontendURL(url))
+ // return nullptr;
return &NewWebUI<DevToolsUI>;
}
if (url.host() == chrome::kChromeUIAccessibilityHost)
diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h
index 20ea62193..1cc76349b 100644
--- a/src/core/net/webui_controller_factory_qt.h
+++ b/src/core/net/webui_controller_factory_qt.h
@@ -55,7 +55,8 @@ class RefCountedMemory;
namespace QtWebEngineCore {
-class WebUIControllerFactoryQt : public content::WebUIControllerFactory {
+class WebUIControllerFactoryQt : public content::WebUIControllerFactory
+{
public:
content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) override;
bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) override;
@@ -76,4 +77,4 @@ private:
} // namespace QtWebEngineCore
-#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_
+#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 3ad2d54d2..4cfcf6acd 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -134,7 +134,7 @@ namespace QtWebEngineCore {
static const int kTestWindowWidth = 800;
static const int kTestWindowHeight = 600;
-static const int kHistoryStreamVersion = 3;
+static const int kHistoryStreamVersion = 4;
static QVariant fromJSValue(const base::Value *result)
{
@@ -279,6 +279,9 @@ static void serializeNavigationHistory(content::NavigationController &controller
output << entry->GetIsOverridingUserAgent();
output << static_cast<qint64>(entry->GetTimestamp().ToInternalValue());
output << entry->GetHttpStatusCode();
+ // kHistoryStreamVersion >= 4
+ content::FaviconStatus &favicon = entry->GetFavicon();
+ output << (favicon.valid ? toQt(favicon.url) : QUrl());
}
}
}
@@ -287,8 +290,8 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
{
int version;
input >> version;
- if (version != kHistoryStreamVersion) {
- // We do not try to decode previous history stream versions.
+ if (version < 3 || version > kHistoryStreamVersion) {
+ // We do not try to decode history stream versions before 3.
// Make sure that our history is cleared and mark the rest of the stream as invalid.
input.setStatus(QDataStream::ReadCorruptData);
*currentIndex = -1;
@@ -301,7 +304,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
entries->reserve(count);
// Logic taken from SerializedNavigationEntry::ReadFromPickle and ToNavigationEntries.
for (int i = 0; i < count; ++i) {
- QUrl virtualUrl, referrerUrl, originalRequestUrl;
+ QUrl virtualUrl, referrerUrl, originalRequestUrl, iconUrl;
QString title;
QByteArray pageState;
qint32 transitionType, referrerPolicy;
@@ -319,6 +322,9 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
input >> isOverridingUserAgent;
input >> timestamp;
input >> httpStatusCode;
+ // kHistoryStreamVersion >= 4
+ if (version >= 4)
+ input >> iconUrl;
// If we couldn't unpack the entry successfully, abort everything.
if (input.status() != QDataStream::Ok) {
@@ -351,6 +357,14 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
entry->SetIsOverridingUserAgent(isOverridingUserAgent);
entry->SetTimestamp(base::Time::FromInternalValue(timestamp));
entry->SetHttpStatusCode(httpStatusCode);
+ if (iconUrl.isValid()) {
+ // Note: we don't set .image below as we don't have it and chromium will refetch favicon
+ // anyway. However, we set .url and .valid to let QWebEngineHistory items restored from
+ // a stream receive valid icon URLs via our getNavigationEntryIconUrl calls.
+ content::FaviconStatus &favicon = entry->GetFavicon();
+ favicon.url = toGurl(iconUrl);
+ favicon.valid = true;
+ }
entries->push_back(std::move(entry));
}
}
@@ -778,7 +792,7 @@ QUrl WebContentsAdapter::iconUrl() const
{
CHECK_INITIALIZED(QUrl());
if (content::NavigationEntry* entry = m_webContents->GetController().GetVisibleEntry()) {
- content::FaviconStatus favicon = entry->GetFavicon();
+ content::FaviconStatus &favicon = entry->GetFavicon();
if (favicon.valid)
return toQt(favicon.url);
}
@@ -935,7 +949,7 @@ QUrl WebContentsAdapter::getNavigationEntryIconUrl(int index)
content::NavigationEntry *entry = m_webContents->GetController().GetEntryAtIndex(index);
if (!entry)
return QUrl();
- content::FaviconStatus favicon = entry->GetFavicon();
+ content::FaviconStatus &favicon = entry->GetFavicon();
return favicon.valid ? toQt(favicon.url) : QUrl();
}
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
index 5d32fa6c7..1b8320c0c 100644
--- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -75,7 +75,7 @@
\li Visual Studio 2017 version 15.8 or later
\li Active Template Library (ATL), usually included in the Visual Studio
installation
- \li Windows 10 SDK
+ \li Windows 10 SDK version 10.0.18362 or later
\endlist
\QWE can only be built on 64-bit Windows, with a x64-bit toolchain.
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index 27fca6f8a..8d98799a3 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -118,8 +118,12 @@ public:
qint64 receivedBytes() const;
QUrl url() const;
QString mimeType() const;
- QString Q_DECL_DEPRECATED path() const;
- void Q_DECL_DEPRECATED setPath(QString path);
+#if QT_DEPRECATED_SINCE(5, 14)
+ QT_DEPRECATED_VERSION_X(5, 14, "Use downloadDirectory() and downloadFileName() instead")
+ QString path() const;
+ QT_DEPRECATED_VERSION_X(5, 14, "Use setDownloadDirectory() and setDownloadFileName() instead")
+ void setPath(QString path);
+#endif
bool isFinished() const;
bool isPaused() const;
SavePageFormat savePageFormat() const;
diff --git a/tests/auto/quick/inspectorserver/BLACKLIST b/tests/auto/quick/inspectorserver/BLACKLIST
index f80823bf3..92c76505a 100644
--- a/tests/auto/quick/inspectorserver/BLACKLIST
+++ b/tests/auto/quick/inspectorserver/BLACKLIST
@@ -3,3 +3,4 @@ osx
[openRemoteDebuggingSession]
osx
+msvc-2019
diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp
index 990ca70a7..c63f4d690 100644
--- a/tests/auto/widgets/origins/tst_origins.cpp
+++ b/tests/auto/widgets/origins/tst_origins.cpp
@@ -206,8 +206,9 @@ class tst_Origins final : public QObject {
private Q_SLOTS:
void initTestCase();
- void cleanup();
void cleanupTestCase();
+ void init();
+ void cleanup();
void jsUrlCanon();
void jsUrlRelative();
@@ -228,12 +229,12 @@ private Q_SLOTS:
void redirect();
private:
- bool load(const QUrl &url)
+ bool verifyLoad(const QUrl &url)
{
QSignalSpy spy(m_page, &QWebEnginePage::loadFinished);
m_page->load(url);
- return (!spy.empty() || spy.wait(20000))
- && spy.front().value(0).toBool();
+ [&spy]() { QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty(), 90000); }();
+ return !spy.isEmpty() && spy.front().value(0).toBool();
}
QVariant eval(const QString &code)
@@ -252,26 +253,32 @@ void tst_Origins::initTestCase()
QtWarningMsg,
QRegularExpression("Please register the custom scheme 'tst'.*"));
- m_page = new QWebEnginePage(&m_profile, nullptr);
m_handler = new TstUrlSchemeHandler(&m_profile);
}
-void tst_Origins::cleanup()
+void tst_Origins::cleanupTestCase()
{
- m_handler->requests().clear();
+ QVERIFY(!m_page);
+ delete m_handler;
}
-void tst_Origins::cleanupTestCase()
+void tst_Origins::init()
+{
+ m_page = new QWebEnginePage(&m_profile, nullptr);
+}
+
+void tst_Origins::cleanup()
{
- delete m_handler;
delete m_page;
+ m_page = nullptr;
+ m_handler->requests().clear();
}
// Test URL parsing and canonicalization in Blink. The implementation of this
// part is mostly shared between Blink and Chromium proper.
void tst_Origins::jsUrlCanon()
{
- QVERIFY(load(QSL("about:blank")));
+ QVERIFY(verifyLoad(QSL("about:blank")));
// Standard schemes are biased towards the authority part.
QCOMPARE(eval(QSL("new URL(\"http:foo/bar\").href")), QVariant(QSL("http://foo/bar")));
@@ -333,7 +340,7 @@ void tst_Origins::jsUrlCanon()
// Test relative URL resolution.
void tst_Origins::jsUrlRelative()
{
- QVERIFY(load(QSL("about:blank")));
+ QVERIFY(verifyLoad(QSL("about:blank")));
// Schemes with hosts, like http, work as expected.
QCOMPARE(eval(QSL("new URL('bar', 'http://foo').href")), QVariant(QSL("http://foo/bar")));
@@ -382,7 +389,7 @@ void tst_Origins::jsUrlRelative()
// blink::SecurityOrigin as opposed to GURL and url::Origin.
void tst_Origins::jsUrlOrigin()
{
- QVERIFY(load(QSL("about:blank")));
+ QVERIFY(verifyLoad(QSL("about:blank")));
// For network protocols the origin string must include the domain and port.
QCOMPARE(eval(QSL("new URL(\"http://foo.com/page.html\").origin")), QVariant(QSL("http://foo.com")));
@@ -448,15 +455,15 @@ void tst_Origins::subdirWithAccess()
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
- QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
- QVERIFY(load(QSL("qrc:/resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
- QVERIFY(load(QSL("tst:/resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
}
@@ -474,15 +481,15 @@ void tst_Origins::subdirWithoutAccess()
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
- QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant());
QCOMPARE(eval(QSL("msg[1]")), QVariant());
- QVERIFY(load(QSL("qrc:/resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
- QVERIFY(load(QSL("tst:/resources/subdir/index.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
QCOMPARE(eval(QSL("msg[1]")), QVariant(QSL("world")));
}
@@ -497,7 +504,7 @@ void tst_Origins::subdirWithoutAccess()
// file: scheme.
void tst_Origins::mixedSchemes()
{
- QVERIFY(load(QSL("file:" THIS_DIR "resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
@@ -505,7 +512,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("qrc:/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
@@ -513,7 +520,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("tst:/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('file:" THIS_DIR "resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("cannotLoad")));
eval(QSL("setIFrameUrl('qrc:/resources/mixedSchemes_frame.html')"));
@@ -521,7 +528,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('tst:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
- QVERIFY(load(QSL("PathSyntax:/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax:/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')"));
@@ -531,7 +538,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("PathSyntax-LocalAccessAllowed:/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-LocalAccessAllowed:/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')"));
@@ -541,7 +548,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('PathSyntax:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
eval(QSL("setIFrameUrl('PathSyntax-Local:/resources/mixedSchemes_frame.html')"));
@@ -551,7 +558,7 @@ void tst_Origins::mixedSchemes()
eval(QSL("setIFrameUrl('PathSyntax-NoAccessAllowed:/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("HostSyntax://a/resources/mixedSchemes.html")));
+ QVERIFY(verifyLoad(QSL("HostSyntax://a/resources/mixedSchemes.html")));
eval(QSL("setIFrameUrl('HostSyntax://a/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
eval(QSL("setIFrameUrl('HostSyntax://b/resources/mixedSchemes_frame.html')"));
@@ -561,13 +568,13 @@ void tst_Origins::mixedSchemes()
// Like mixedSchemes but adds a Content-Security-Policy: frame-src 'none' header.
void tst_Origins::mixedSchemesWithCsp()
{
- QVERIFY(load(QSL("HostSyntax://a/resources/mixedSchemesWithCsp.html")));
+ QVERIFY(verifyLoad(QSL("HostSyntax://a/resources/mixedSchemesWithCsp.html")));
eval(QSL("setIFrameUrl('HostSyntax://a/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
eval(QSL("setIFrameUrl('HostSyntax://b/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadButNotAccess")));
- QVERIFY(load(QSL("HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemesWithCsp.html")));
+ QVERIFY(verifyLoad(QSL("HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemesWithCsp.html")));
eval(QSL("setIFrameUrl('HostSyntax-ContentSecurityPolicyIgnored://a/resources/mixedSchemes_frame.html')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("canLoadAndAccess")));
eval(QSL("setIFrameUrl('HostSyntax-ContentSecurityPolicyIgnored://b/resources/mixedSchemes_frame.html')"));
@@ -582,7 +589,7 @@ void tst_Origins::mixedSchemesWithCsp()
// schemes with the CorsEnabled flag.
void tst_Origins::mixedXHR()
{
- QVERIFY(load(QSL("file:" THIS_DIR "resources/mixedXHR.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/mixedXHR.html")));
eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')"));
@@ -594,7 +601,7 @@ void tst_Origins::mixedXHR()
eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
- QVERIFY(load(QSL("qrc:/resources/mixedXHR.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/mixedXHR.html")));
eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')"));
@@ -606,7 +613,7 @@ void tst_Origins::mixedXHR()
eval(QSL("sendXHR('cors:/resources/mixedXHR.txt')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
- QVERIFY(load(QSL("tst:/resources/mixedXHR.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/mixedXHR.html")));
eval(QSL("sendXHR('file:" THIS_DIR "resources/mixedXHR.txt')"));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("error")));
eval(QSL("sendXHR('qrc:/resources/mixedXHR.txt')"));
@@ -672,18 +679,18 @@ void tst_Origins::webSocket()
m_page->setWebChannel(&channel);
QVERIFY(echoServer.listen());
- QVERIFY(load(QSL("file:" THIS_DIR "resources/websocket.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/websocket.html")));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
- QVERIFY(load(QSL("qrc:/resources/websocket.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/websocket.html")));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
// Unregistered schemes can also open WebSockets (since Chromium 71)
- QVERIFY(load(QSL("tst:/resources/websocket.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/websocket.html")));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
// Even an insecure registered scheme can open WebSockets.
- QVERIFY(load(QSL("PathSyntax:/resources/websocket.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax:/resources/websocket.html")));
QTRY_COMPARE(eval(QSL("result")), QVariant(QSL("ok")));
}
#endif
@@ -691,26 +698,26 @@ void tst_Origins::webSocket()
// one page, there is not much need for security restrictions.
void tst_Origins::dedicatedWorker()
{
- QVERIFY(load(QSL("file:" THIS_DIR "resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/dedicatedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));
- QVERIFY(load(QSL("qrc:/resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/dedicatedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));
// Unregistered schemes can also create Workers (since Chromium 71)
- QVERIFY(load(QSL("tst:/resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/dedicatedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));
// Even an insecure registered scheme can create Workers.
- QVERIFY(load(QSL("PathSyntax:/resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax:/resources/dedicatedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));
// But not if the NoAccessAllowed flag is set.
- QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/dedicatedWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/dedicatedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("cannot be accessed from origin 'null'")));
@@ -722,31 +729,31 @@ void tst_Origins::sharedWorker()
{
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
- QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
- QTRY_VERIFY(eval(QSL("done")).toBool());
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
+ QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("cannot be accessed from origin 'null'")));
}
{
ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
- QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
- QTRY_VERIFY(eval(QSL("done")).toBool());
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
+ QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QCOMPARE(eval(QSL("result")), QVariant(42));
}
- QVERIFY(load(QSL("qrc:/resources/sharedWorker.html")));
- QTRY_VERIFY(eval(QSL("done")).toBool());
+ QVERIFY(verifyLoad(QSL("qrc:/resources/sharedWorker.html")));
+ QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QCOMPARE(eval(QSL("result")), QVariant(42));
// Unregistered schemes should not create SharedWorkers.
- QVERIFY(load(QSL("PathSyntax:/resources/sharedWorker.html")));
- QTRY_VERIFY(eval(QSL("done")).toBool());
+ QVERIFY(verifyLoad(QSL("PathSyntax:/resources/sharedWorker.html")));
+ QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QCOMPARE(eval(QSL("result")), QVariant(42));
- QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/sharedWorker.html")));
- QTRY_VERIFY(eval(QSL("done")).toBool());
+ QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/sharedWorker.html")));
+ QTRY_VERIFY_WITH_TIMEOUT(eval(QSL("done")).toBool(), 10000);
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("denied to origin 'null'")));
}
@@ -754,41 +761,41 @@ void tst_Origins::sharedWorker()
// Service workers have to be explicitly enabled for a scheme.
void tst_Origins::serviceWorker()
{
- QVERIFY(load(QSL("file:" THIS_DIR "resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("file:" THIS_DIR "resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("The URL protocol of the current origin ('file://') is not supported.")));
- QVERIFY(load(QSL("qrc:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("The URL protocol of the current origin ('qrc:') is not supported.")));
- QVERIFY(load(QSL("tst:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("Cannot read property 'register' of undefined")));
- QVERIFY(load(QSL("PathSyntax:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("Cannot read property 'register' of undefined")));
- QVERIFY(load(QSL("PathSyntax-Secure:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-Secure:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("The URL protocol of the current origin ('pathsyntax-secure:') is not supported.")));
- QVERIFY(load(QSL("PathSyntax-ServiceWorkersAllowed:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-ServiceWorkersAllowed:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("Cannot read property 'register' of undefined")));
- QVERIFY(load(QSL("PathSyntax-Secure-ServiceWorkersAllowed:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-Secure-ServiceWorkersAllowed:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("error")), QVariant());
- QVERIFY(load(QSL("PathSyntax-NoAccessAllowed:/resources/serviceWorker.html")));
+ QVERIFY(verifyLoad(QSL("PathSyntax-NoAccessAllowed:/resources/serviceWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
.contains(QSL("Cannot read property 'register' of undefined")));
@@ -797,40 +804,40 @@ void tst_Origins::serviceWorker()
// Support for view-source must be enabled explicitly.
void tst_Origins::viewSource()
{
- QVERIFY(load(QSL("view-source:file:" THIS_DIR "resources/viewSource.html")));
+ QVERIFY(verifyLoad(QSL("view-source:file:" THIS_DIR "resources/viewSource.html")));
#ifdef Q_OS_WIN
QCOMPARE(m_page->requestedUrl().toString(), QSL("file:///" THIS_DIR "resources/viewSource.html"));
#else
QCOMPARE(m_page->requestedUrl().toString(), QSL("file://" THIS_DIR "resources/viewSource.html"));
#endif
- QVERIFY(load(QSL("view-source:qrc:/resources/viewSource.html")));
+ QVERIFY(verifyLoad(QSL("view-source:qrc:/resources/viewSource.html")));
QCOMPARE(m_page->requestedUrl().toString(), QSL("qrc:/resources/viewSource.html"));
- QVERIFY(load(QSL("view-source:tst:/resources/viewSource.html")));
+ QVERIFY(verifyLoad(QSL("view-source:tst:/resources/viewSource.html")));
QCOMPARE(m_page->requestedUrl().toString(), QSL("about:blank"));
- QVERIFY(load(QSL("view-source:PathSyntax:/resources/viewSource.html")));
+ QVERIFY(verifyLoad(QSL("view-source:PathSyntax:/resources/viewSource.html")));
QCOMPARE(m_page->requestedUrl().toString(), QSL("about:blank"));
- QVERIFY(load(QSL("view-source:PathSyntax-ViewSourceAllowed:/resources/viewSource.html")));
+ QVERIFY(verifyLoad(QSL("view-source:PathSyntax-ViewSourceAllowed:/resources/viewSource.html")));
QCOMPARE(m_page->requestedUrl().toString(), QSL("pathsyntax-viewsourceallowed:/resources/viewSource.html"));
}
void tst_Origins::createObjectURL()
{
// Legal for registered custom schemes.
- QVERIFY(load(QSL("qrc:/resources/createObjectURL.html")));
+ QVERIFY(verifyLoad(QSL("qrc:/resources/createObjectURL.html")));
QVERIFY(eval(QSL("result")).toString().startsWith(QSL("blob:qrc:")));
// Also legal for unregistered schemes (since Chromium 71)
- QVERIFY(load(QSL("tst:/resources/createObjectURL.html")));
+ QVERIFY(verifyLoad(QSL("tst:/resources/createObjectURL.html")));
QVERIFY(eval(QSL("result")).toString().startsWith(QSL("blob:tst:")));
}
void tst_Origins::redirect()
{
- QVERIFY(load(QSL("redirect1:/resources/redirect.html")));
+ QVERIFY(verifyLoad(QSL("redirect1:/resources/redirect.html")));
QTRY_COMPARE(m_handler->requests().size(), 7);
QCOMPARE(m_handler->requests()[0], QUrl(QStringLiteral("redirect1:/resources/redirect.html")));
QCOMPARE(m_handler->requests()[1], QUrl(QStringLiteral("redirect2:/resources/redirect.html")));
diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
index 4a5b4e3eb..d34e3cefe 100644
--- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
+++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp
@@ -77,7 +77,9 @@ private Q_SLOTS:
void downloadToDefaultLocation();
void downloadToNonExistentDir();
void downloadToReadOnlyDir();
+#if QT_DEPRECATED_SINCE(5, 14)
void downloadPathValidation();
+#endif
void downloadToDirectoryWithFileName();
private:
@@ -1135,6 +1137,7 @@ void tst_QWebEngineDownloadItem::downloadToReadOnlyDir()
QFile(m_profile->downloadPath()).setPermissions(QFileDevice::WriteOwner);
}
+#if QT_DEPRECATED_SINCE(5, 14)
void tst_QWebEngineDownloadItem::downloadPathValidation()
{
const QString fileName = "test.txt";
@@ -1251,6 +1254,7 @@ void tst_QWebEngineDownloadItem::downloadPathValidation()
#endif // !defined(Q_OS_WIN)
QDir::setCurrent(oldPath);
}
+#endif
void tst_QWebEngineDownloadItem::downloadToDirectoryWithFileName()
{
diff --git a/tests/auto/widgets/qwebenginehistory/resources/page5.html b/tests/auto/widgets/qwebenginehistory/resources/page5.html
index 859355279..cad6d964e 100644
--- a/tests/auto/widgets/qwebenginehistory/resources/page5.html
+++ b/tests/auto/widgets/qwebenginehistory/resources/page5.html
@@ -1 +1,2 @@
+<link rel="icon" href="qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png">
<title>page5</title><body><h1>page5</h1></body>
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index 6209401cb..bdb486793 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -51,6 +51,7 @@ public Q_SLOTS:
private Q_SLOTS:
void title();
void lastVisited();
+ void iconUrl();
void count();
void back();
void forward();
@@ -126,6 +127,11 @@ void tst_QWebEngineHistory::lastVisited()
QVERIFY(qAbs(hist->itemAt(0).lastVisited().secsTo(QDateTime::currentDateTime())) < 60);
}
+void tst_QWebEngineHistory::iconUrl()
+{
+ QTRY_COMPARE(hist->currentItem().iconUrl(), QUrl("qrc:/qt-project.org/qmessagebox/images/qtlogo-64.png"));
+}
+
/**
* Check QWebEngineHistory::count() method
*/
@@ -336,6 +342,7 @@ void tst_QWebEngineHistory::serialize_3()
QDateTime lastVisited(a.lastVisited());
QUrl originalUrl(a.originalUrl());
QUrl url(a.url());
+ QUrl iconUrl(a.iconUrl());
save << *hist;
QVERIFY(save.status() == QDataStream::Ok);
@@ -351,6 +358,7 @@ void tst_QWebEngineHistory::serialize_3()
QTRY_COMPARE(b.lastVisited(), lastVisited);
QTRY_COMPARE(b.originalUrl(), originalUrl);
QTRY_COMPARE(b.url(), url);
+ QTRY_COMPARE(b.iconUrl(), iconUrl);
//Check if all data was read
QVERIFY(load.atEnd());
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 931dbf7f0..27aa7a1f7 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -158,6 +158,7 @@ private Q_SLOTS:
void setHtmlWithStylesheetResource();
void setHtmlWithBaseURL();
void setHtmlWithJSAlert();
+ void setHtmlWithModuleImport();
void baseUrl_data();
void baseUrl();
void scrollPosition();
@@ -322,7 +323,7 @@ void tst_QWebEnginePage::acceptNavigationRequest()
page.setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
"<input type='text'><input type='submit'></form></body></html>"), QUrl());
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
evaluateJavaScriptSync(&page, "tstform.submit();");
QTRY_COMPARE(loadSpy.count(), 2);
@@ -388,7 +389,7 @@ void tst_QWebEnginePage::geolocationRequestJS()
QSignalSpy spyLoadFinished(newPage, SIGNAL(loadFinished(bool)));
newPage->setHtml(QString("<html><body>test</body></html>"), QUrl("qrc://secure/origin"));
- QTRY_COMPARE(spyLoadFinished.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spyLoadFinished.count(), 1, 20000);
// Geolocation is only enabled for visible WebContents.
view.show();
@@ -415,7 +416,7 @@ void tst_QWebEnginePage::loadFinished()
page.load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
"<head><meta http-equiv='refresh' content='1'></head>foo \">"
"<frame src=\"data:text/html,bar\"></frameset>"));
- QTRY_COMPARE(spyLoadFinished.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spyLoadFinished.count(), 1, 20000);
QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue);
QTRY_VERIFY_WITH_TIMEOUT(spyLoadStarted.count() > 1, 100);
@@ -475,9 +476,9 @@ void tst_QWebEnginePage::pasteImage()
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setImage(origImage);
QWebEnginePage *page = m_view->page();
- page->load(QUrl("qrc:///resources/pasteimage.html"));
QSignalSpy spyFinished(m_view, &QWebEngineView::loadFinished);
- QVERIFY(spyFinished.wait());
+ page->load(QUrl("qrc:///resources/pasteimage.html"));
+ QTRY_VERIFY_WITH_TIMEOUT(!spyFinished.isEmpty(), 20000);
page->triggerAction(QWebEnginePage::Paste);
QTRY_VERIFY(evaluateJavaScriptSync(page,
"window.myImageDataURL ? window.myImageDataURL.length : 0").toInt() > 0);
@@ -568,11 +569,11 @@ void tst_QWebEnginePage::acceptNavigationRequestNavigationType()
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
page.load(QUrl("qrc:///resources/script.html"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
QTRY_COMPARE(page.navigations.count(), 1);
page.load(QUrl("qrc:///resources/content.html"));
- QTRY_COMPARE(loadSpy.count(), 2);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 2, 20000);
QTRY_COMPARE(page.navigations.count(), 2);
page.triggerAction(QWebEnginePage::Stop);
@@ -587,7 +588,7 @@ void tst_QWebEnginePage::acceptNavigationRequestNavigationType()
QTRY_COMPARE(page.navigations.count(), 4);
page.load(QUrl("qrc:///resources/reload.html"));
- QTRY_COMPARE(loadSpy.count(), 6);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 6, 20000);
QTRY_COMPARE(page.navigations.count(), 6);
QList<QWebEnginePage::NavigationType> expectedList;
@@ -613,7 +614,7 @@ void tst_QWebEnginePage::popupFormSubmission()
page.setHtml("<form name='form1' method=get action='' target='myNewWin'>"
" <input type='hidden' name='foo' value='bar'>"
"</form>");
- QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000);
page.runJavaScript("window.open('', 'myNewWin', 'width=500,height=300,toolbar=0');");
evaluateJavaScriptSync(&page, "document.form1.submit();");
@@ -666,8 +667,8 @@ void tst_QWebEnginePage::multipleProfilesAndLocalStorage()
page1.setHtml(QString("<html><body> </body></html>"), QUrl("http://wwww.example.com"));
page2.setHtml(QString("<html><body> </body></html>"), QUrl("http://wwww.example.com"));
- QTRY_COMPARE(loadSpy1.count(), 1);
- QTRY_COMPARE(loadSpy2.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy1.count(), 1, 20000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy2.count(), 1, 20000);
evaluateJavaScriptSync(&page1, "localStorage.setItem('test', 'value1');");
evaluateJavaScriptSync(&page2, "localStorage.setItem('test', 'value2');");
@@ -727,7 +728,7 @@ void tst_QWebEnginePage::textSelection()
page->setView(&view);
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
page->setHtml(content);
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
// these actions must exist
QVERIFY(page->action(QWebEnginePage::SelectAll) != 0);
@@ -759,7 +760,7 @@ void tst_QWebEnginePage::backActionUpdate()
QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool)));
QUrl url = QUrl("qrc:///resources/framedindex.html");
page->load(url);
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
QVERIFY(!action->isEnabled());
QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(10, 10));
QEXPECT_FAIL("", "Behavior change: Load signals are emitted only for the main frame in QtWebEngine.", Continue);
@@ -782,8 +783,8 @@ void tst_QWebEnginePage::localStorageVisibility()
QSignalSpy loadSpy2(&webPage2, &QWebEnginePage::loadFinished);
webPage1.setHtml(QString("<html><body>test</body></html>"), QUrl("http://www.example.com/"));
webPage2.setHtml(QString("<html><body>test</body></html>"), QUrl("http://www.example.com/"));
- QTRY_COMPARE(loadSpy1.count(), 1);
- QTRY_COMPARE(loadSpy2.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy1.count(), 1, 20000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy2.count(), 1, 20000);
// The attribute determines the visibility of the window.localStorage object.
QVERIFY(evaluateJavaScriptSync(&webPage1, QString("(window.localStorage != undefined)")).toBool());
@@ -900,7 +901,7 @@ void tst_QWebEnginePage::testJSPrompt()
bool res;
QSignalSpy loadSpy(&page, SIGNAL(loadFinished(bool)));
page.setHtml(QStringLiteral("<html><body></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
// OK + QString()
res = evaluateJavaScriptSync(&page,
@@ -1037,7 +1038,7 @@ void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks()
CallbackSpy<bool> spy5;
QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool)));
m_view->setHtml(QString("<html><head></head><body><div>abcdefg abcdefg abcdefg abcdefg abcdefg</div></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
m_page->findText("abcde", 0, spy1.ref());
m_page->findText("abcd", 0, spy2.ref());
m_page->findText("abc", 0, spy3.ref());
@@ -1339,7 +1340,7 @@ void tst_QWebEnginePage::loadSignalsOrder()
QSignalSpy spyLoadSpy(&loadSpy, &SpyForLoadSignalsOrder::started);
QVERIFY(spyLoadSpy.wait(500));
page.load(url);
- QTRY_VERIFY(loadSpy.isFinished());
+ QTRY_VERIFY_WITH_TIMEOUT(loadSpy.isFinished(), 20000);
}
void tst_QWebEnginePage::renderWidgetHostViewNotShowTopLevel()
@@ -1486,7 +1487,7 @@ void tst_QWebEnginePage::getUserMediaRequest()
QVERIFY(QTest::qWaitForWindowExposed(&view));
}
- QTRY_VERIFY_WITH_TIMEOUT(page.loadSucceeded(), 20000);
+ QTRY_VERIFY_WITH_TIMEOUT(page.loadSucceeded(), 60000);
page.settings()->setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true);
// 1. Rejecting request on C++ side should reject promise on JS side.
@@ -1827,7 +1828,7 @@ void tst_QWebEnginePage::runJavaScriptDisabled()
// Settings changes take effect asynchronously. The load and wait ensure
// that the settings are applied by the time we start to execute JavaScript.
page.load(QStringLiteral("about:blank"));
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 20000);
QCOMPARE(evaluateJavaScriptSyncInWorld(&page, QStringLiteral("1+1"), QWebEngineScript::MainWorld),
QVariant());
QCOMPARE(evaluateJavaScriptSyncInWorld(&page, QStringLiteral("1+1"), QWebEngineScript::ApplicationWorld),
@@ -1953,7 +1954,7 @@ void tst_QWebEnginePage::symmetricUrl()
// loading is _not_ immediate, so the text isn't set just yet.
QVERIFY(toPlainTextSync(view.page()).isEmpty());
- QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 20000);
QCOMPARE(view.history()->count(), 1);
QCOMPARE(toPlainTextSync(view.page()), QString("Test"));
@@ -2283,6 +2284,41 @@ void tst_QWebEnginePage::setHtmlWithJSAlert()
QCOMPARE(toHtmlSync(&page), html);
}
+void tst_QWebEnginePage::setHtmlWithModuleImport()
+{
+ HttpServer server;
+ connect(&server, &HttpServer::newRequest, [&](HttpReqRep *rr) {
+ if (rr->requestMethod() == "GET" && rr->requestPath() == "/fibonacci.mjs") {
+ rr->setResponseBody("export function fib(n) {\n"
+ " return n < 2 ? n : fib(n-1) + fib(n-2)\n"
+ "}\n");
+ rr->setResponseHeader("Content-Type", "text/javascript");
+ rr->sendResponse();
+ } else {
+ rr->setResponseStatus(404);
+ rr->sendResponse();
+ }
+ });
+ QVERIFY(server.start());
+
+ QString html("<html>\n"
+ " <head>\n"
+ " <script type='module'>\n"
+ " import {fib} from './fibonacci.mjs'\n"
+ " window.fib7 = fib(7)\n"
+ " </script>\n"
+ " </head>\n"
+ " <body></body>\n"
+ "</html>\n");
+
+ QWebEnginePage page;
+ QSignalSpy spy(&page, &QWebEnginePage::loadFinished);
+ page.setHtml(html, server.url());
+ QVERIFY(spy.count() || spy.wait());
+
+ QCOMPARE(evaluateJavaScriptSync(&page, "fib7"), QVariant(13));
+}
+
void tst_QWebEnginePage::baseUrl_data()
{
QTest::addColumn<QString>("html");
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index 31438996f..044fac9d7 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -3125,7 +3125,7 @@ void tst_QWebEngineView::webUIURLs()
view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
view.load(url);
- QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 12000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
QCOMPARE(loadFinishedSpy.takeFirst().at(0).toBool(), supported);
}
diff --git a/tests/auto/widgets/schemes/tst_schemes.cpp b/tests/auto/widgets/schemes/tst_schemes.cpp
index 6da34efd8..1b6093571 100644
--- a/tests/auto/widgets/schemes/tst_schemes.cpp
+++ b/tests/auto/widgets/schemes/tst_schemes.cpp
@@ -103,7 +103,7 @@ void tst_Schemes::unknownUrlSchemePolicy()
});
}
- QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2, 15000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2, 60000);
QCOMPARE(page.acceptNavigationRequestCalls, shouldAccept ? 1 : 0);
}
}