diff options
author | rob <rob@robwu.nl> | 2014-12-09 16:16:04 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-10 00:16:23 +0000 |
commit | 4ae97b7b61308ab58413c135b4ed70955b698335 (patch) | |
tree | 5e3861e783d5e6e25f6364c90cea74fe0089a5f6 /extensions/renderer/messaging_bindings.cc | |
parent | 6040ce4733965bd1215b9be7292dac67f035bbed (diff) | |
download | chromium_src-4ae97b7b61308ab58413c135b4ed70955b698335.zip chromium_src-4ae97b7b61308ab58413c135b4ed70955b698335.tar.gz chromium_src-4ae97b7b61308ab58413c135b4ed70955b698335.tar.bz2 |
Add frameId option to chrome.tabs.connect and chrome.tabs.sendMessage.
BUG=264286
R=kalman@chromium.org,tsepez@chromium.org,sky@chromium.org
TEST=browser_tests ExtensionApiTest.Messaging
Review URL: https://codereview.chromium.org/758443002
Cr-Commit-Position: refs/heads/master@{#307592}
Diffstat (limited to 'extensions/renderer/messaging_bindings.cc')
-rw-r--r-- | extensions/renderer/messaging_bindings.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc index 5a12f71..cb24496 100644 --- a/extensions/renderer/messaging_bindings.cc +++ b/extensions/renderer/messaging_bindings.cc @@ -25,6 +25,7 @@ #include "extensions/renderer/scoped_persistent.h" #include "extensions/renderer/script_context.h" #include "extensions/renderer/script_context_set.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" #include "third_party/WebKit/public/web/WebScopedUserGesture.h" #include "third_party/WebKit/public/web/WebScopedWindowFocusAllowedIndicator.h" @@ -245,6 +246,14 @@ void DispatchOnConnectToScriptContext( const std::string& tls_channel_id, bool* port_created, ScriptContext* script_context) { + // Only dispatch the events if this is the requested target frame (0 = main + // frame; positive = child frame). + content::RenderFrame* renderframe = script_context->GetRenderFrame(); + if (info.target_frame_id == 0 && renderframe->GetWebFrame()->parent() != NULL) + return; + if (info.target_frame_id > 0 && + renderframe->GetRoutingID() != info.target_frame_id) + return; v8::Isolate* isolate = script_context->isolate(); v8::HandleScope handle_scope(isolate); |