add {secure:} opt to protocol.registerStandardSchemes
This commit is contained in:
Родитель
de625bfb65
Коммит
9d2e23413e
|
@ -204,4 +204,18 @@ void AtomContentClient::AddServiceWorkerSchemes(
|
|||
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
|
||||
|
|
|
@ -31,6 +31,9 @@ class AtomContentClient : public brightray::ContentClient {
|
|||
std::vector<content::PepperPluginInfo>* plugins) override;
|
||||
void AddServiceWorkerSchemes(
|
||||
std::set<std::string>* service_worker_schemes) override;
|
||||
void AddSecureSchemesAndOrigins(
|
||||
std::set<std::string>* secure_schemes,
|
||||
std::set<GURL>* secure_origins) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);
|
||||
|
|
|
@ -46,7 +46,7 @@ std::vector<std::string> GetStandardSchemes() {
|
|||
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;
|
||||
|
||||
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
||||
|
@ -55,8 +55,17 @@ void RegisterStandardSchemes(const std::vector<std::string>& schemes) {
|
|||
policy->RegisterWebSafeScheme(scheme);
|
||||
}
|
||||
|
||||
// add switches to register as standard
|
||||
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
|
||||
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
|
||||
atom::switches::kRegisterSecureSchemes, base::JoinString(schemes, ","));
|
||||
}
|
||||
}
|
||||
|
||||
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
|
||||
|
@ -220,7 +229,7 @@ void RegisterStandardSchemes(
|
|||
return;
|
||||
}
|
||||
|
||||
atom::api::RegisterStandardSchemes(schemes);
|
||||
atom::api::RegisterStandardSchemes(schemes, args);
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace atom {
|
|||
namespace api {
|
||||
|
||||
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> {
|
||||
public:
|
||||
|
|
|
@ -144,6 +144,9 @@ const char kStandardSchemes[] = "standard-schemes";
|
|||
// Register schemes to handle service worker.
|
||||
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
|
||||
// TLS fallback will accept.
|
||||
const char kSSLVersionFallbackMin[] = "ssl-version-fallback-min";
|
||||
|
|
|
@ -76,6 +76,7 @@ extern const char kPpapiFlashVersion[];
|
|||
extern const char kDisableHttpCache[];
|
||||
extern const char kStandardSchemes[];
|
||||
extern const char kRegisterServiceWorkerSchemes[];
|
||||
extern const char kRegisterSecureSchemes[];
|
||||
extern const char kSSLVersionFallbackMin[];
|
||||
extern const char kCipherSuiteBlacklist[];
|
||||
extern const char kAppUserModelId[];
|
||||
|
|
Загрузка…
Ссылка в новой задаче