Index: extensions/renderer/resources/messaging.js |
diff --git a/extensions/renderer/resources/messaging.js b/extensions/renderer/resources/messaging.js |
index 5a7ec1e40dc01d492c542729ddaacbd9def8b323..a15497d23efac334c9073830fcdd47d3237ac543 100644 |
--- a/extensions/renderer/resources/messaging.js |
+++ b/extensions/renderer/resources/messaging.js |
@@ -76,6 +76,16 @@ |
this.onDestroy_(); |
privates(this.onDisconnect).impl.destroy_(); |
privates(this.onMessage).impl.destroy_(); |
+ // TODO(robwu): Remove port lifetime management because it is completely |
+ // handled in the browser. The renderer's only roles are |
+ // 1) rejecting ports so that the browser knows that the renderer is not |
+ // interested in the port (this is merely an optimization) |
+ // 2) acknowledging port creations, so that the browser knows that the port |
+ // was successfully created (from the perspective of the extension), but |
+ // then closed for some non-fatal reason. |
+ // 3) notifying the browser of explicit port closure via .disconnect(). |
+ // In other cases (navigations), the browser automatically cleans up the |
+ // port. |
messagingNatives.PortRelease(this.portId_); |
delete ports[this.portId_]; |
}; |