summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/console.cc
diff options
context:
space:
mode:
authormsimonides <msimonides@opera.com>2014-11-12 05:15:07 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-12 13:15:28 +0000
commit15c088458a1e6bf4f315f7b61f1b153a5ca1d60d (patch)
treea212bcca1f5c7d6b088eb133fda34b8d569ac2aa /extensions/renderer/console.cc
parentfb6c300d63cbe6f78125533ecf3e3f5ea6dd1a94 (diff)
downloadchromium_src-15c088458a1e6bf4f315f7b61f1b153a5ca1d60d.zip
chromium_src-15c088458a1e6bf4f315f7b61f1b153a5ca1d60d.tar.gz
chromium_src-15c088458a1e6bf4f315f7b61f1b153a5ca1d60d.tar.bz2
Send extension console messages to the right WebFrame.
The extensions::console::ByContextFinder's conditions are tightened so that the correct RenderView is found for a given v8::Context. This fixes the problem where console messages may be sent to an incorrect document (e.g. background page instead of the options page). BUG=427922 Review URL: https://codereview.chromium.org/678393002 Cr-Commit-Position: refs/heads/master@{#303824}
Diffstat (limited to 'extensions/renderer/console.cc')
-rw-r--r--extensions/renderer/console.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/extensions/renderer/console.cc b/extensions/renderer/console.cc
index 4601f6c..3ed31fc 100644
--- a/extensions/renderer/console.cc
+++ b/extensions/renderer/console.cc
@@ -39,9 +39,11 @@ class ByContextFinder : public content::RenderViewVisitor {
bool Visit(content::RenderView* render_view) override {
ExtensionHelper* helper = ExtensionHelper::Get(render_view);
- if (helper &&
- helper->dispatcher()->script_context_set().GetByV8Context(context_)) {
- found_ = render_view;
+ if (helper) {
+ ScriptContext* script_context =
+ helper->dispatcher()->script_context_set().GetByV8Context(context_);
+ if (script_context && script_context->GetRenderView() == render_view)
+ found_ = render_view;
}
return !found_;
}