fix: don't execute preload scripts for internal <iframe> in <webview> (#19260)

This commit is contained in:
Milan Burda 2019-07-17 02:13:05 +02:00 committed by Cheng Zhao
parent b57e623c11
commit d1c9f5e309
7 changed files with 81 additions and 3 deletions

View file

@ -310,4 +310,28 @@ v8::Local<v8::Value> RendererClientBase::RunScript(
return script->Run(context).ToLocalChecked();
}
bool RendererClientBase::IsWebViewFrame(
v8::Handle<v8::Context> context,
content::RenderFrame* render_frame) const {
auto* isolate = context->GetIsolate();
if (render_frame->IsMainFrame())
return false;
mate::Dictionary window_dict(
isolate, GetContext(render_frame->GetWebFrame(), isolate)->Global());
v8::Local<v8::Object> frame_element;
if (!window_dict.Get("frameElement", &frame_element))
return false;
mate::Dictionary frame_element_dict(isolate, frame_element);
v8::Local<v8::Object> internal;
if (!frame_element_dict.GetHidden("internal", &internal))
return false;
return !internal.IsEmpty();
}
} // namespace electron