add {secure:} opt to protocol.registerStandardSchemes
This commit is contained in:
parent
de625bfb65
commit
9d2e23413e
6 changed files with 33 additions and 3 deletions
|
@ -204,4 +204,18 @@ void AtomContentClient::AddServiceWorkerSchemes(
|
||||||
service_worker_schemes->insert(url::kFileScheme);
|
service_worker_schemes->insert(url::kFileScheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomContentClient::AddSecureSchemesAndOrigins(
|
||||||
|
std::set<std::string>* secure_schemes,
|
||||||
|
std::set<GURL>* secure_origins) {
|
||||||
|
std::vector<std::string> schemes;
|
||||||
|
ConvertStringWithSeparatorToVector(&schemes, ",",
|
||||||
|
switches::kRegisterSecureSchemes);
|
||||||
|
if (!schemes.empty()) {
|
||||||
|
for (const std::string& scheme : schemes) {
|
||||||
|
secure_schemes->insert(scheme);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -31,6 +31,9 @@ class AtomContentClient : public brightray::ContentClient {
|
||||||
std::vector<content::PepperPluginInfo>* plugins) override;
|
std::vector<content::PepperPluginInfo>* plugins) override;
|
||||||
void AddServiceWorkerSchemes(
|
void AddServiceWorkerSchemes(
|
||||||
std::set<std::string>* service_worker_schemes) override;
|
std::set<std::string>* service_worker_schemes) override;
|
||||||
|
void AddSecureSchemesAndOrigins(
|
||||||
|
std::set<std::string>* secure_schemes,
|
||||||
|
std::set<GURL>* secure_origins) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
|
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
|
||||||
|
|
|
@ -46,7 +46,7 @@ std::vector<std::string> GetStandardSchemes() {
|
||||||
return g_standard_schemes;
|
return g_standard_schemes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterStandardSchemes(const std::vector<std::string>& schemes) {
|
void RegisterStandardSchemes(const std::vector<std::string>& schemes, mate::Arguments* args) {
|
||||||
g_standard_schemes = schemes;
|
g_standard_schemes = schemes;
|
||||||
|
|
||||||
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
||||||
|
@ -55,8 +55,17 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes) {
|
||||||
policy->RegisterWebSafeScheme(scheme);
|
policy->RegisterWebSafeScheme(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add switches to register as standard
|
||||||
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
||||||
atom::switches::kStandardSchemes, base::JoinString(schemes, ","));
|
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
|
||||||
|
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
||||||
|
atom::switches::kRegisterSecureSchemes, base::JoinString(schemes, ","));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
||||||
|
@ -220,7 +229,7 @@ void RegisterStandardSchemes(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
atom::api::RegisterStandardSchemes(schemes);
|
atom::api::RegisterStandardSchemes(schemes, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace atom {
|
||||||
namespace api {
|
namespace api {
|
||||||
|
|
||||||
std::vector<std::string> GetStandardSchemes();
|
std::vector<std::string> GetStandardSchemes();
|
||||||
void RegisterStandardSchemes(const std::vector<std::string>& schemes);
|
void RegisterStandardSchemes(const std::vector<std::string>& schemes, mate::Arguments* args);
|
||||||
|
|
||||||
class Protocol : public mate::TrackableObject<Protocol> {
|
class Protocol : public mate::TrackableObject<Protocol> {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -144,6 +144,9 @@ const char kStandardSchemes[] = "standard-schemes";
|
||||||
// Register schemes to handle service worker.
|
// Register schemes to handle service worker.
|
||||||
const char kRegisterServiceWorkerSchemes[] = "register-service-worker-schemes";
|
const char kRegisterServiceWorkerSchemes[] = "register-service-worker-schemes";
|
||||||
|
|
||||||
|
// Register schemes as secure.
|
||||||
|
const char kRegisterSecureSchemes[] = "register-secure-schemes";
|
||||||
|
|
||||||
// The minimum SSL/TLS version ("tls1", "tls1.1", or "tls1.2") that
|
// The minimum SSL/TLS version ("tls1", "tls1.1", or "tls1.2") that
|
||||||
// TLS fallback will accept.
|
// TLS fallback will accept.
|
||||||
const char kSSLVersionFallbackMin[] = "ssl-version-fallback-min";
|
const char kSSLVersionFallbackMin[] = "ssl-version-fallback-min";
|
||||||
|
|
|
@ -76,6 +76,7 @@ extern const char kPpapiFlashVersion[];
|
||||||
extern const char kDisableHttpCache[];
|
extern const char kDisableHttpCache[];
|
||||||
extern const char kStandardSchemes[];
|
extern const char kStandardSchemes[];
|
||||||
extern const char kRegisterServiceWorkerSchemes[];
|
extern const char kRegisterServiceWorkerSchemes[];
|
||||||
|
extern const char kRegisterSecureSchemes[];
|
||||||
extern const char kSSLVersionFallbackMin[];
|
extern const char kSSLVersionFallbackMin[];
|
||||||
extern const char kCipherSuiteBlacklist[];
|
extern const char kCipherSuiteBlacklist[];
|
||||||
extern const char kAppUserModelId[];
|
extern const char kAppUserModelId[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue