зеркало из https://github.com/electron/electron.git
Fix custom scheme not registered as service worker scheme
This commit is contained in:
Родитель
703f8707db
Коммит
a249235b22
|
@ -187,13 +187,9 @@ void ElectronContentClient::AddAdditionalSchemes(Schemes* schemes) {
|
|||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
std::string process_type =
|
||||
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
// Browser Process registration happens in
|
||||
// `api::Protocol::RegisterSchemesAsPrivileged`
|
||||
//
|
||||
// Renderer Process registration happens in `RendererClientBase`
|
||||
//
|
||||
// We use this for registration to network utility process
|
||||
if (process_type == ::switches::kUtilityProcess) {
|
||||
// Register schemes for browser process and network utility process, the
|
||||
// registration for renderer process happens in `RendererClientBase`.
|
||||
if (process_type.empty() || process_type == ::switches::kUtilityProcess) {
|
||||
AppendDelimitedSwitchToVector(switches::kServiceWorkerSchemes,
|
||||
&schemes->service_worker_schemes);
|
||||
AppendDelimitedSwitchToVector(switches::kStandardSchemes,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "base/command_line.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "content/common/url_schemes.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "shell/browser/browser.h"
|
||||
|
@ -149,6 +150,14 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
|
|||
g_standard_schemes);
|
||||
AppendSchemesToCmdLine(electron::switches::kStreamingSchemes,
|
||||
g_streaming_schemes);
|
||||
|
||||
// The scheme registration happens before user's main script is executed, so
|
||||
// we have to explicitly do a re-registration to make the new scheme
|
||||
// effective.
|
||||
// Note that while the API is marked as ForTests, it is safe to call in this
|
||||
// use case, and it has DCHECK to ensure we are not making changes to schemes
|
||||
// _after_ any code has read the scheme registry.
|
||||
content::ReRegisterContentSchemesForTests();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
Загрузка…
Ссылка в новой задаче