summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/messaging
diff options
context:
space:
mode:
authornednguyen <nednguyen@google.com>2015-09-10 16:08:43 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-10 23:09:19 +0000
commit0e66d57071b66863773249452c49384cff83b9ac (patch)
treeb9b11cf509d8344c1dd38f9f094551eb4520b70e /chrome/browser/extensions/api/messaging
parentf2aedcc017d906abfd2e9d567cf63c11f4d096e4 (diff)
downloadchromium_src-0e66d57071b66863773249452c49384cff83b9ac.zip
chromium_src-0e66d57071b66863773249452c49384cff83b9ac.tar.gz
chromium_src-0e66d57071b66863773249452c49384cff83b9ac.tar.bz2
Revert of Check the tab ID before delivering an extension message. (patchset #4 id:60001 of https://codereview.chromium.org/1318153002/ )
Reason for revert: Speculative revert, this may cause compile failure on [precise32, precise64] stable BUG=530347 Original issue's description: > Check the tab ID before delivering an extension message. > > r335753 changed extension messaging to use RenderFrames, which had the > side-effect of delivering messages to every RenderFrame in a process, > which may include other tabs. > > This patch fixes that by sending the target tab ID along with the message. A > more principled fix would have been to track RenderFrames on the browser and > send to precisely the right ones, but this would need to be part of a more > comprehensive refactor. > > I also fixed up ExtensionApiTest.Connect and re-enabled, which was disabled > years ago due to flakiness. Hopefully my test JS changes will fix that. > > BUG=520303 > R=rdevlin.cronin@chromium.org, dcheng@chromium.org > > Committed: https://crrev.com/1344c7dfde448d4b80693f597b02993b7f6bbd5b > Cr-Commit-Position: refs/heads/master@{#346176} TBR=dcheng@chromium.org,rdevlin.cronin@chromium.org,kalman@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=520303 Review URL: https://codereview.chromium.org/1339463002 Cr-Commit-Position: refs/heads/master@{#348274}
Diffstat (limited to 'chrome/browser/extensions/api/messaging')
-rw-r--r--chrome/browser/extensions/api/messaging/extension_message_port.cc2
-rw-r--r--chrome/browser/extensions/api/messaging/extension_message_port.h1
-rw-r--r--chrome/browser/extensions/api/messaging/message_service.cc20
-rw-r--r--chrome/browser/extensions/api/messaging/message_service.h1
4 files changed, 8 insertions, 16 deletions
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.cc b/chrome/browser/extensions/api/messaging/extension_message_port.cc
index 1e4f87f..7f0da64 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.cc
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.cc
@@ -27,7 +27,6 @@ void ExtensionMessagePort::DispatchOnConnect(
const std::string& channel_name,
scoped_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
- int target_tab_id,
int target_frame_id,
int guest_process_id,
int guest_render_frame_routing_id,
@@ -44,7 +43,6 @@ void ExtensionMessagePort::DispatchOnConnect(
info.target_id = target_extension_id;
info.source_id = source_extension_id;
info.source_url = source_url;
- info.target_tab_id = target_tab_id;
info.target_frame_id = target_frame_id;
info.guest_process_id = guest_process_id;
info.guest_render_frame_routing_id = guest_render_frame_routing_id;
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.h b/chrome/browser/extensions/api/messaging/extension_message_port.h
index 79b8003..8445bda 100644
--- a/chrome/browser/extensions/api/messaging/extension_message_port.h
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.h
@@ -25,7 +25,6 @@ class ExtensionMessagePort : public MessageService::MessagePort {
const std::string& channel_name,
scoped_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
- int target_tab_id,
int target_frame_id,
int guest_process_id,
int guest_render_frame_routing_id,
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index e08249f..36e1e32 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -129,7 +129,6 @@ struct MessageService::OpenChannelParams {
int source_process_id;
scoped_ptr<base::DictionaryValue> source_tab;
int source_frame_id;
- int target_tab_id;
int target_frame_id;
scoped_ptr<MessagePort> receiver;
int receiver_port_id;
@@ -145,7 +144,6 @@ struct MessageService::OpenChannelParams {
OpenChannelParams(int source_process_id,
scoped_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
- int target_tab_id,
int target_frame_id,
MessagePort* receiver,
int receiver_port_id,
@@ -157,7 +155,6 @@ struct MessageService::OpenChannelParams {
bool include_guest_process_info)
: source_process_id(source_process_id),
source_frame_id(source_frame_id),
- target_tab_id(target_tab_id),
target_frame_id(target_frame_id),
receiver(receiver),
receiver_port_id(receiver_port_id),
@@ -355,8 +352,8 @@ void MessageService::OpenChannelToExtension(
}
scoped_ptr<OpenChannelParams> params(new OpenChannelParams(
- source_process_id, source_tab.Pass(), source_frame_id, -1,
- -1, // no target_tab_id/target_frame_id for connections to extensions
+ source_process_id, source_tab.Pass(), source_frame_id,
+ -1, // no target_frame_id for a channel to an extension/background page.
nullptr, receiver_port_id, source_extension_id, target_extension_id,
source_url, channel_name, include_tls_channel_id,
include_guest_process_info));
@@ -552,11 +549,11 @@ void MessageService::OpenChannelToTab(int source_process_id,
scoped_ptr<base::DictionaryValue>(), // Source tab doesn't make sense
// for opening to tabs.
-1, // If there is no tab, then there is no frame either.
- tab_id, frame_id, receiver.release(), receiver_port_id, extension_id,
- extension_id,
+ frame_id,
+ receiver.release(), receiver_port_id, extension_id, extension_id,
GURL(), // Source URL doesn't make sense for opening to tabs.
channel_name,
- false, // Connections to tabs don't get TLS channel IDs.
+ false, // Connections to tabs don't get TLS channel IDs.
false)); // Connections to tabs aren't webview guests.
OpenChannelImpl(contents->GetBrowserContext(), params.Pass(), extension,
false /* did_enqueue */);
@@ -605,10 +602,9 @@ void MessageService::OpenChannelImpl(BrowserContext* browser_context,
// opener has the opposite port ID).
channel->receiver->DispatchOnConnect(
params->receiver_port_id, params->channel_name, params->source_tab.Pass(),
- params->source_frame_id, params->target_tab_id, params->target_frame_id,
- guest_process_id, guest_render_frame_routing_id,
- params->source_extension_id, params->target_extension_id,
- params->source_url, params->tls_channel_id);
+ params->source_frame_id, params->target_frame_id, guest_process_id,
+ guest_render_frame_routing_id, params->source_extension_id,
+ params->target_extension_id, params->source_url, params->tls_channel_id);
// Report the event to the event router, if the target is an extension.
//
diff --git a/chrome/browser/extensions/api/messaging/message_service.h b/chrome/browser/extensions/api/messaging/message_service.h
index 92ec7cb..9d209b2 100644
--- a/chrome/browser/extensions/api/messaging/message_service.h
+++ b/chrome/browser/extensions/api/messaging/message_service.h
@@ -73,7 +73,6 @@ class MessageService : public BrowserContextKeyedAPI,
const std::string& channel_name,
scoped_ptr<base::DictionaryValue> source_tab,
int source_frame_id,
- int target_tab_id,
int target_frame_id,
int guest_process_id,
int guest_render_frame_routing_id,