diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2019-05-27 13:11:26 +0200 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2019-07-18 10:47:05 +0200 |
commit | 1b319cab5c5a049093bf165f2909273005fc625c (patch) | |
tree | f3ad2e3c5b3eaf64bfeee040a72002b49a00714a /src/core/api | |
parent | 0872bcd6a0a423d7aa904f597f83cd991b53112b (diff) |
Add QWebEngineUrlScheme::CorsEnabled flag
Add support for enabling CORS for custom schemes. Headers for CORS are generated
automatically by UrlRequestCustomJob for all CorsEnabled schemes.
[ChangeLog][Custom Schemes] Added the QWebEngineUrlScheme::CorsEnabled flag for
enabling cross-origin resource sharing with custom schemes.
Fixes: QTBUG-75651
Change-Id: Ia17acf25ae8488f23c6b4609777a3bdbf72149ee
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api')
-rw-r--r-- | src/core/api/qwebengineurlscheme.cpp | 8 | ||||
-rw-r--r-- | src/core/api/qwebengineurlscheme.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/core/api/qwebengineurlscheme.cpp b/src/core/api/qwebengineurlscheme.cpp index f4efad717..6c7d1780c 100644 --- a/src/core/api/qwebengineurlscheme.cpp +++ b/src/core/api/qwebengineurlscheme.cpp @@ -59,6 +59,7 @@ ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::NoAccessAllowed, url::CustomScheme::NoAc ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::ServiceWorkersAllowed, url::CustomScheme::ServiceWorkersAllowed) ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::ViewSourceAllowed, url::CustomScheme::ViewSourceAllowed) ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::ContentSecurityPolicyIgnored, url::CustomScheme::ContentSecurityPolicyIgnored) +ASSERT_ENUMS_MATCH(QWebEngineUrlScheme::CorsEnabled, url::CustomScheme::CorsEnabled) static bool g_schemesLocked = false; @@ -190,6 +191,13 @@ public: \value ContentSecurityPolicyIgnored Indicates that accesses to this scheme should bypass all Content-Security-Policy checks. + + \value CorsEnabled + Enables cross-origin resource sharing (CORS) for this scheme. This flag is + required in order to, for example, use the scheme with the \l + {https://fetch.spec.whatwg.org/}{Fetch API}, or to deliver CSS fonts to a + different origin. The appropriate CORS headers are generated automatically by + the QWebEngineUrlRequestJob class. (Added in Qt 5.14) */ QWebEngineUrlScheme::QWebEngineUrlScheme(QWebEngineUrlSchemePrivate *d) : d(d) {} diff --git a/src/core/api/qwebengineurlscheme.h b/src/core/api/qwebengineurlscheme.h index 095b47320..ecac44184 100644 --- a/src/core/api/qwebengineurlscheme.h +++ b/src/core/api/qwebengineurlscheme.h @@ -76,6 +76,7 @@ public: ServiceWorkersAllowed = 0x10, ViewSourceAllowed = 0x20, ContentSecurityPolicyIgnored = 0x40, + CorsEnabled = 0x80, }; Q_DECLARE_FLAGS(Flags, Flag) Q_FLAG(Flags) |