feat: add new fuse to treat file: identically to browsers (#40372)

This commit is contained in:
Samuel Attard 2023-11-09 10:23:52 -08:00 committed by GitHub
parent 0f68d845f9
commit d504d150ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 9 deletions

View file

@ -19,6 +19,7 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "electron/buildflags/buildflags.h"
#include "electron/fuses.h"
#include "printing/buildflags/buildflags.h"
#include "shell/browser/api/electron_api_protocol.h"
#include "shell/common/api/electron_api_native_image.h"
@ -277,8 +278,10 @@ void RendererClientBase::RenderThreadStarted() {
// Allow file scheme to handle service worker by default.
// FIXME(zcbenz): Can this be moved elsewhere?
blink::WebSecurityPolicy::RegisterURLSchemeAsAllowingServiceWorkers("file");
blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI("file");
if (electron::fuses::IsGrantFileProtocolExtraPrivilegesEnabled()) {
blink::WebSecurityPolicy::RegisterURLSchemeAsAllowingServiceWorkers("file");
blink::SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI("file");
}
#if BUILDFLAG(IS_WIN)
// Set ApplicationUserModelID in renderer process.