Use blink::SchemeRegistry over WebSecurityPolicy
The latter is removing some APIs we use.
This commit is contained in:
parent
481b04358e
commit
e43b34b8f8
1 changed files with 12 additions and 9 deletions
|
@ -23,8 +23,8 @@
|
|||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
|
||||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
|
@ -146,12 +146,14 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
|
|||
|
||||
void WebFrame::RegisterURLSchemeAsSecure(const std::string& scheme) {
|
||||
// TODO(pfrazee): Remove 2.0
|
||||
blink::SchemeRegistry::registerURLSchemeAsSecure(
|
||||
WTF::String::fromUTF8(scheme.data(), scheme.length()));
|
||||
}
|
||||
|
||||
void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
|
||||
// Register scheme to bypass pages's Content Security Policy.
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
|
||||
blink::WebString::fromUTF8(scheme));
|
||||
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(
|
||||
WTF::String::fromUTF8(scheme.data(), scheme.length()));
|
||||
}
|
||||
|
||||
void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
|
||||
|
@ -173,25 +175,26 @@ void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
|
|||
}
|
||||
}
|
||||
// Register scheme to privileged list (https, wss, data, chrome-extension)
|
||||
blink::WebString privileged_scheme(blink::WebString::fromUTF8(scheme));
|
||||
WTF::String privileged_scheme(
|
||||
WTF::String::fromUTF8(scheme.data(), scheme.length()));
|
||||
if (secure) {
|
||||
// TODO(pfrazee): Remove 2.0
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsSecure(privileged_scheme);
|
||||
blink::SchemeRegistry::registerURLSchemeAsSecure(privileged_scheme);
|
||||
}
|
||||
if (bypassCSP) {
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(
|
||||
blink::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (allowServiceWorkers) {
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
|
||||
blink::SchemeRegistry::registerURLSchemeAsAllowingServiceWorkers(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (supportFetchAPI) {
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsSupportingFetchAPI(
|
||||
blink::SchemeRegistry::registerURLSchemeAsSupportingFetchAPI(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (corsEnabled) {
|
||||
blink::WebSecurityPolicy::registerURLSchemeAsCORSEnabled(privileged_scheme);
|
||||
blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(privileged_scheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue