fix contextIsolation issue while webPreference sandbox is on

contextIsolation didn't work while sandbox is on. The fix is contextIsolation picked up while sandbox on
This commit is contained in:
sungpark 2017-07-27 17:08:24 -07:00
parent 485b9099f1
commit bf07c5aebd
8 changed files with 63 additions and 22 deletions

View file

@ -69,6 +69,8 @@ RendererClientBase::RendererClientBase() {
ParseSchemesCLISwitch(switches::kStandardSchemes);
for (const std::string& scheme : standard_schemes_list)
url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT);
isolated_world_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kContextIsolation);
}
RendererClientBase::~RendererClientBase() {
@ -197,4 +199,12 @@ void RendererClientBase::AddSupportedKeySystems(
AddChromeKeySystems(key_systems);
}
v8::Local<v8::Context> RendererClientBase::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) {
if (isolated_world())
return frame->worldScriptContext(isolate, World::ISOLATED_WORLD);
else
return frame->mainWorldScriptContext();
}
} // namespace atom