Fix crash when using secure schemes

This commit is contained in:
Cheng Zhao 2017-04-18 16:20:08 +09:00
parent fb42a72ad8
commit 0fb746b350
2 changed files with 12 additions and 7 deletions

View file

@ -50,20 +50,25 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes,
mate::Arguments* args) {
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();
for (const std::string& scheme : schemes) {
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
if (secure) {
url::AddSecureScheme(scheme.c_str());
}
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(
atom::switches::kStandardSchemes, base::JoinString(schemes, ","));
mate::Dictionary opts;
bool secure = false;
if (args->GetNext(&opts) && opts.Get("secure", &secure) && secure) {
// add switches to register as secure
if (secure) {
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
atom::switches::kSecureSchemes, base::JoinString(schemes, ","));
}

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 3e77e9faa16fcbda5fe740e1f2332201cf423c56
Subproject commit 541da8135eb72ca6f59da0e59ded4245fb12278e