Index: content/shell/test_runner/test_runner.cc |
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc |
index 91c408b94336265131681d1812ae3671af6314a3..416872b6dd72e472d33fe6b80dabde23fe84a790 100644 |
--- a/content/shell/test_runner/test_runner.cc |
+++ b/content/shell/test_runner/test_runner.cc |
@@ -2040,7 +2040,13 @@ class WorkItemLoadingScript : public TestRunner::WorkItem { |
WorkItemLoadingScript(const std::string& script) : script_(script) {} |
bool Run(WebTestDelegate*, WebView* web_view) override { |
- web_view->MainFrame()->ExecuteScript( |
+ blink::WebFrame* main_frame = web_view->MainFrame(); |
+ if (!main_frame->IsWebLocalFrame()) { |
+ CHECK(false) << "This function cannot be called if the main frame is not " |
+ "a local frame."; |
+ return false; |
+ } |
+ main_frame->ToWebLocalFrame()->ExecuteScript( |
WebScriptSource(WebString::FromUTF8(script_))); |
return true; // FIXME: Did it really start a navigation? |
} |
@@ -2058,7 +2064,13 @@ class WorkItemNonLoadingScript : public TestRunner::WorkItem { |
WorkItemNonLoadingScript(const std::string& script) : script_(script) {} |
bool Run(WebTestDelegate*, WebView* web_view) override { |
- web_view->MainFrame()->ExecuteScript( |
+ blink::WebFrame* main_frame = web_view->MainFrame(); |
+ if (!main_frame->IsWebLocalFrame()) { |
+ CHECK(false) << "This function cannot be called if the main frame is not " |
+ "a local frame."; |
+ return false; |
+ } |
+ main_frame->ToWebLocalFrame()->ExecuteScript( |
WebScriptSource(WebString::FromUTF8(script_))); |
return false; |
} |