feat: move webFrame scheme privilege methods to main process (#16416)
* chore: deprecate webFrame.registerURLSchemeAsPrivileged * Add register schemes protocol api * update branch to enable browser process API * Revert deprecation changes * Fetch API support * Updated api to take an array, still working on tests * Update tests * Remove web frame API * Minor changes * update scheme registrations on browser and renderer process * fix: enable ses.getBlobData spec * Update breaking changes doc
This commit is contained in:
parent
257de6a963
commit
940c4c0787
19 changed files with 319 additions and 319 deletions
|
@ -31,7 +31,6 @@
|
|||
#include "third_party/blink/public/web/web_script_execution_callback.h"
|
||||
#include "third_party/blink/public/web/web_script_source.h"
|
||||
#include "third_party/blink/public/web/web_view.h"
|
||||
#include "third_party/blink/renderer/platform/weborigin/scheme_registry.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
@ -262,54 +261,6 @@ void WebFrame::SetSpellCheckProvider(mate::Arguments* args,
|
|||
new AtomWebFrameObserver(render_frame, std::move(spell_check_client));
|
||||
}
|
||||
|
||||
void WebFrame::RegisterURLSchemeAsBypassingCSP(const std::string& scheme) {
|
||||
// Register scheme to bypass pages's Content Security Policy.
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
|
||||
WTF::String::FromUTF8(scheme.data(), scheme.length()));
|
||||
}
|
||||
|
||||
void WebFrame::RegisterURLSchemeAsPrivileged(const std::string& scheme,
|
||||
mate::Arguments* args) {
|
||||
// TODO(deepak1556): blink::SchemeRegistry methods should be called
|
||||
// before any renderer threads are created. Fixing this would break
|
||||
// current api. Change it with 2.0.
|
||||
|
||||
// Read optional flags
|
||||
bool secure = true;
|
||||
bool bypassCSP = true;
|
||||
bool allowServiceWorkers = true;
|
||||
bool supportFetchAPI = true;
|
||||
bool corsEnabled = true;
|
||||
if (args->Length() == 2) {
|
||||
mate::Dictionary options;
|
||||
if (args->GetNext(&options)) {
|
||||
options.Get("secure", &secure);
|
||||
options.Get("bypassCSP", &bypassCSP);
|
||||
options.Get("allowServiceWorkers", &allowServiceWorkers);
|
||||
options.Get("supportFetchAPI", &supportFetchAPI);
|
||||
options.Get("corsEnabled", &corsEnabled);
|
||||
}
|
||||
}
|
||||
// Register scheme to privileged list (https, wss, data, chrome-extension)
|
||||
WTF::String privileged_scheme(
|
||||
WTF::String::FromUTF8(scheme.data(), scheme.length()));
|
||||
if (bypassCSP) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsBypassingContentSecurityPolicy(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (allowServiceWorkers) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsAllowingServiceWorkers(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (supportFetchAPI) {
|
||||
blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI(
|
||||
privileged_scheme);
|
||||
}
|
||||
if (corsEnabled) {
|
||||
url::AddCorsEnabledScheme(scheme.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WebFrame::InsertText(const std::string& text) {
|
||||
web_frame_->FrameWidget()->GetActiveWebInputMethodController()->CommitText(
|
||||
blink::WebString::FromUTF8(text),
|
||||
|
@ -522,10 +473,6 @@ void WebFrame::BuildPrototype(v8::Isolate* isolate,
|
|||
&WebFrame::AllowGuestViewElementDefinition)
|
||||
.SetMethod("getWebFrameId", &WebFrame::GetWebFrameId)
|
||||
.SetMethod("setSpellCheckProvider", &WebFrame::SetSpellCheckProvider)
|
||||
.SetMethod("registerURLSchemeAsBypassingCSP",
|
||||
&WebFrame::RegisterURLSchemeAsBypassingCSP)
|
||||
.SetMethod("registerURLSchemeAsPrivileged",
|
||||
&WebFrame::RegisterURLSchemeAsPrivileged)
|
||||
.SetMethod("insertText", &WebFrame::InsertText)
|
||||
.SetMethod("insertCSS", &WebFrame::InsertCSS)
|
||||
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue