Fix crash when using secure schemes
This commit is contained in:
parent
fb42a72ad8
commit
0fb746b350
2 changed files with 12 additions and 7 deletions
|
@ -50,20 +50,25 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
g_standard_schemes = schemes;
|
g_standard_schemes = schemes;
|
||||||
|
|
||||||
|
mate::Dictionary opts;
|
||||||
|
bool secure = false;
|
||||||
|
args->GetNext(&opts) && opts.Get("secure", &secure);
|
||||||
|
|
||||||
|
// Dynamically register the schemes.
|
||||||
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
||||||
for (const std::string& scheme : schemes) {
|
for (const std::string& scheme : schemes) {
|
||||||
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
|
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
|
||||||
|
if (secure) {
|
||||||
|
url::AddSecureScheme(scheme.c_str());
|
||||||
|
}
|
||||||
policy->RegisterWebSafeScheme(scheme);
|
policy->RegisterWebSafeScheme(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add switches to register as standard
|
// Add the schemes to command line switches, so child processes can also
|
||||||
|
// register them.
|
||||||
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
||||||
atom::switches::kStandardSchemes, base::JoinString(schemes, ","));
|
atom::switches::kStandardSchemes, base::JoinString(schemes, ","));
|
||||||
|
if (secure) {
|
||||||
mate::Dictionary opts;
|
|
||||||
bool secure = false;
|
|
||||||
if (args->GetNext(&opts) && opts.Get("secure", &secure) && secure) {
|
|
||||||
// add switches to register as secure
|
|
||||||
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
||||||
atom::switches::kSecureSchemes, base::JoinString(schemes, ","));
|
atom::switches::kSecureSchemes, base::JoinString(schemes, ","));
|
||||||
}
|
}
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 3e77e9faa16fcbda5fe740e1f2332201cf423c56
|
Subproject commit 541da8135eb72ca6f59da0e59ded4245fb12278e
|
Loading…
Add table
Add a link
Reference in a new issue