Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: components/plugins/renderer/loadable_plugin_placeholder.cc

Issue 2923433002: Move ExecuteScript method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/plugins/renderer/loadable_plugin_placeholder.cc
diff --git a/components/plugins/renderer/loadable_plugin_placeholder.cc b/components/plugins/renderer/loadable_plugin_placeholder.cc
index 576786453687c1f4fb6a4b98eb2a147a70cdd991..32a13e6771a939e930459c7c4f464072126b8148 100644
--- a/components/plugins/renderer/loadable_plugin_placeholder.cc
+++ b/components/plugins/renderer/loadable_plugin_placeholder.cc
@@ -145,7 +145,12 @@ void LoadablePluginPlaceholder::UpdateMessage() {
return;
std::string script =
"window.setMessage(" + base::GetQuotedJSONString(message_) + ")";
- plugin()->web_view()->MainFrame()->ExecuteScript(
+ blink::WebFrame* main_frame = plugin()->web_view()->MainFrame();
+ if (!main_frame->IsWebLocalFrame()) {
dcheng 2017/06/04 10:37:22 As this is a WebViewPlugin, which is only used to
Łukasz Anforowicz 2017/06/05 17:10:57 Good point - done: - I've exposed WebViewPlugin::
+ NOTREACHED();
+ return;
+ }
+ main_frame->ToWebLocalFrame()->ExecuteScript(
blink::WebScriptSource(blink::WebString::FromUTF8(script)));
}
@@ -252,7 +257,12 @@ void LoadablePluginPlaceholder::OnUnobscuredRectUpdate(
std::string script = base::StringPrintf(
"window.resizePoster('%dpx', '%dpx', '%dpx', '%dpx')", x, y, width,
height);
- plugin()->web_view()->MainFrame()->ExecuteScript(
+ blink::WebFrame* main_frame = plugin()->web_view()->MainFrame();
+ if (!main_frame->IsWebLocalFrame()) {
+ NOTREACHED();
+ return;
+ }
+ main_frame->ToWebLocalFrame()->ExecuteScript(
blink::WebScriptSource(blink::WebString::FromUTF8(script)));
}
}

Powered by Google App Engine
This is Rietveld 408576698