mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add option to enable fetch support for custom schemes (issue #2579)
This commit is contained in:
committed by
Marshall Greenblatt
parent
667d190547
commit
a72e00a7b9
@@ -81,6 +81,9 @@ class CefContentClient : public content::ContentClient,
|
||||
// A scheme that can bypass Content-Security-Policy (CSP) checks. This value
|
||||
// should be false in most cases where |is_standard| is true.
|
||||
bool is_csp_bypassing;
|
||||
|
||||
// A scheme that can perform fetch request.
|
||||
bool is_fetch_enabled;
|
||||
};
|
||||
typedef std::list<SchemeInfo> SchemeInfoList;
|
||||
|
||||
|
@@ -31,7 +31,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(const CefString& scheme_name,
|
||||
bool is_display_isolated,
|
||||
bool is_secure,
|
||||
bool is_cors_enabled,
|
||||
bool is_csp_bypassing) {
|
||||
bool is_csp_bypassing,
|
||||
bool is_fetch_enabled) {
|
||||
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
|
||||
if (scheme::IsInternalHandledScheme(scheme) ||
|
||||
registered_schemes_.find(scheme) != registered_schemes_.end()) {
|
||||
@@ -54,8 +55,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(const CefString& scheme_name,
|
||||
schemes_.csp_bypassing_schemes.push_back(scheme);
|
||||
|
||||
CefContentClient::SchemeInfo scheme_info = {
|
||||
scheme, is_standard, is_local, is_display_isolated,
|
||||
is_secure, is_cors_enabled, is_csp_bypassing};
|
||||
scheme, is_standard, is_local, is_display_isolated,
|
||||
is_secure, is_cors_enabled, is_csp_bypassing, is_fetch_enabled};
|
||||
CefContentClient::Get()->AddCustomScheme(scheme_info);
|
||||
|
||||
return true;
|
||||
|
@@ -24,7 +24,8 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
|
||||
bool is_display_isolated,
|
||||
bool is_secure,
|
||||
bool is_cors_enabled,
|
||||
bool is_csp_bypassing) override;
|
||||
bool is_csp_bypassing,
|
||||
bool is_fetch_enabled) override;
|
||||
|
||||
void GetSchemes(content::ContentClient::Schemes* schemes);
|
||||
|
||||
|
@@ -216,6 +216,10 @@ void RegisterURLSchemeAsSecure(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsSecure(scheme);
|
||||
}
|
||||
|
||||
void RegisterURLSchemeAsSupportingFetchAPI(const blink::WebString& scheme) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI(scheme);
|
||||
}
|
||||
|
||||
struct CefScriptForbiddenScope::Impl {
|
||||
blink::ScriptForbiddenScope scope_;
|
||||
};
|
||||
|
@@ -69,6 +69,9 @@ BLINK_EXPORT bool IsScriptForbidden();
|
||||
BLINK_EXPORT void RegisterURLSchemeAsLocal(const blink::WebString& scheme);
|
||||
BLINK_EXPORT void RegisterURLSchemeAsSecure(const blink::WebString& scheme);
|
||||
|
||||
BLINK_EXPORT void RegisterURLSchemeAsSupportingFetchAPI(
|
||||
const blink::WebString& scheme);
|
||||
|
||||
// Wrapper for blink::ScriptForbiddenScope.
|
||||
class BLINK_EXPORT CefScriptForbiddenScope final {
|
||||
public:
|
||||
|
@@ -269,6 +269,8 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
blink::WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(scheme);
|
||||
if (info.is_secure)
|
||||
blink_glue::RegisterURLSchemeAsSecure(scheme);
|
||||
if (info.is_fetch_enabled)
|
||||
blink_glue::RegisterURLSchemeAsSupportingFetchAPI(scheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user