diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-13 13:54:17 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-02-28 14:24:35 +0100 |
commit | 42af15c421a520499bc872e2d55053dcffb2a07b (patch) | |
tree | c0e8836daec4903254c7ae633eb8ef27a4502f00 /src/core/profile_adapter.cpp | |
parent | 01d4c6440b52f2ce26ced45b6ad193e909db44af (diff) |
Adaptations for Chromium 78
Including removal of renderer service.
[ChangeLog][QWebEngineSetting] XSS Auditing has been removed, and
XSSAuditingEnabled no longer has any effect.
Change-Id: I0835e2a76551057f3eea30a343e0373b642192f0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/profile_adapter.cpp')
-rw-r--r-- | src/core/profile_adapter.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 85577ef52..55db83d16 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -43,6 +43,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/browsing_data_remover.h" #include "content/public/browser/download_manager.h" +#include "content/public/browser/shared_cors_origin_access_list.h" +#include "services/network/public/cpp/cors/origin_access_list.h" #include "api/qwebengineurlscheme.h" #include "content_browser_client_qt.h" @@ -104,6 +106,17 @@ ProfileAdapter::ProfileAdapter(const QString &storageName): if (!storageName.isEmpty()) extensions::ExtensionSystem::Get(m_profile.data())->InitForRegularProfile(true); #endif + + // Allow XMLHttpRequests from qrc to file. + // ### consider removing for Qt6 + url::Origin qrc = url::Origin::Create(GURL("qrc://")); + auto pattern = network::mojom::CorsOriginPattern::New("file", "", 0, + network::mojom::CorsDomainMatchMode::kAllowSubdomains, + network::mojom::CorsPortMatchMode::kAllowAnyPort, + network::mojom::CorsOriginAccessMatchPriority::kDefaultPriority); + std::vector<network::mojom::CorsOriginPatternPtr> list; + list.push_back(std::move(pattern)); + m_profile->GetSharedCorsOriginAccessList()->SetForOrigin(qrc, std::move(list), {}, base::BindOnce([]{})); } ProfileAdapter::~ProfileAdapter() @@ -485,8 +498,8 @@ const QList<QByteArray> ProfileAdapter::customUrlSchemes() const void ProfileAdapter::updateCustomUrlSchemeHandlers() { - if (m_profile->m_urlRequestContextGetter.get()) - m_profile->m_profileIOData->updateJobFactory(); +// if (m_profile->m_urlRequestContextGetter.get()) +// m_profile->m_profileIOData->updateJobFactory(); } void ProfileAdapter::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler) @@ -695,7 +708,7 @@ QString ProfileAdapter::determineDownloadPath(const QString &downloadDirectory, QString suggestedFilePath = suggestedFile.absoluteFilePath(); base::FilePath tmpFilePath(toFilePath(suggestedFilePath).NormalizePathSeparatorsTo('/')); - int uniquifier = base::GetUniquePathNumber(tmpFilePath, base::FilePath::StringType()); + int uniquifier = base::GetUniquePathNumber(tmpFilePath); if (uniquifier > 0) suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", uniquifier)).AsUTF8Unsafe()); else if (uniquifier == -1) { |