Index: extensions/renderer/api/automation/automation_api_helper.cc |
diff --git a/extensions/renderer/api/automation/automation_api_helper.cc b/extensions/renderer/api/automation/automation_api_helper.cc |
index 45c62026f263d18b390e2e183fbcc35dedfefbeb..bcb4ad86f1baf6e488a25dd49e8a77853bcbe23f 100644 |
--- a/extensions/renderer/api/automation/automation_api_helper.cc |
+++ b/extensions/renderer/api/automation/automation_api_helper.cc |
@@ -10,7 +10,7 @@ |
#include "third_party/WebKit/public/web/WebDocument.h" |
#include "third_party/WebKit/public/web/WebElement.h" |
#include "third_party/WebKit/public/web/WebExceptionCode.h" |
-#include "third_party/WebKit/public/web/WebFrame.h" |
+#include "third_party/WebKit/public/web/WebLocalFrame.h" |
#include "third_party/WebKit/public/web/WebNode.h" |
#include "third_party/WebKit/public/web/WebView.h" |
@@ -47,8 +47,15 @@ void AutomationApiHelper::OnQuerySelector(int request_id, |
routing_id(), request_id, error, 0)); |
return; |
} |
- blink::WebDocument document = |
- render_view()->GetWebView()->MainFrame()->GetDocument(); |
+ |
+ // ExtensionMsg_AutomationQuerySelector should only be sent to an active view. |
+ DCHECK(render_view()->GetWebView()->MainFrame()->IsWebLocalFrame()); |
+ |
+ blink::WebDocument document = render_view() |
+ ->GetWebView() |
+ ->MainFrame() |
+ ->ToWebLocalFrame() |
+ ->GetDocument(); |
if (document.IsNull()) { |
error.value = ExtensionHostMsg_AutomationQuerySelector_Error::kNoDocument; |
Send(new ExtensionHostMsg_AutomationQuerySelector_Result( |