Index: chrome/browser/extensions/api/messaging/extension_message_port.h |
diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.h b/chrome/browser/extensions/api/messaging/extension_message_port.h |
index dd6e584fc5ef842cd18a8e4161cb1b2950516c6e..92b785803d2184935a5558c0dfaf4921d6644757 100644 |
--- a/chrome/browser/extensions/api/messaging/extension_message_port.h |
+++ b/chrome/browser/extensions/api/messaging/extension_message_port.h |
@@ -41,6 +41,12 @@ class ExtensionMessagePort : public MessageService::MessagePort { |
content::RenderProcessHost* extension_process); |
~ExtensionMessagePort() override; |
+ // Checks whether the frames to which this port is tied at its construction |
+ // are still aware of this port's existence. Frames that don't know about |
+ // the port are removed from the set of frames. This should be used for opener |
+ // ports because the frame may be navigated before the port was initialized. |
+ void RevalidatePort(); |
+ |
// MessageService::MessagePort: |
void RemoveCommonFrames(const MessagePort& port) override; |
bool HasFrame(content::RenderFrameHost* rfh) const override; |
@@ -92,6 +98,11 @@ class ExtensionMessagePort : public MessageService::MessagePort { |
// when the frame is removed or unloaded. |
std::set<content::RenderFrameHost*> frames_; |
+ // The ID of the tab where the channel was created. This is saved so that any |
+ // onMessage events can be run in the scope of the tab. |
+ // Only set on receiver ports (if the opener was a tab). -1 if invalid. |
+ int opener_tab_id_; |
+ |
// Whether the renderer acknowledged creation of the port. This is used to |
// distinguish abnormal port closure (e.g. no receivers) from explicit port |
// closure (e.g. by the port.disconnect() JavaScript method in the renderer). |