Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: extensions/renderer/messaging_bindings.cc

Issue 1931253004: Determine routing ID before potentially invalidating the frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/messaging_bindings.cc
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index 4a7e733a0737fa9233da10471d130d677ad2462b..c1da6263306e594c3e8f3844de314a9a8db01c08 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -449,15 +449,16 @@ void MessagingBindings::DispatchOnConnect(
const ExtensionMsg_ExternalConnectionInfo& info,
const std::string& tls_channel_id,
content::RenderFrame* restrict_to_render_frame) {
+ int routing_id = restrict_to_render_frame
+ ? restrict_to_render_frame->GetRoutingID()
+ : MSG_ROUTING_NONE;
bool port_created = false;
context_set.ForEach(
info.target_id, restrict_to_render_frame,
base::Bind(&DispatchOnConnectToScriptContext, target_port_id,
channel_name, &source, info, tls_channel_id, &port_created));
+ // Note: |restrict_to_render_frame| may have been deleted at this point!
- int routing_id = restrict_to_render_frame
- ? restrict_to_render_frame->GetRoutingID()
- : MSG_ROUTING_NONE;
if (port_created) {
content::RenderThread::Get()->Send(
new ExtensionHostMsg_OpenMessagePort(routing_id, target_port_id));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698