Chromium Code Reviews| 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))); |
| } |
| } |