Index: remoting/webapp/hangout_session.js |
diff --git a/remoting/webapp/hangout_session.js b/remoting/webapp/hangout_session.js |
index 7f11ee308ed62539e48c9db0eec58c7858baf9a8..ab4ffab410569c6c52b4474b0efc8fbf8e577f95 100644 |
--- a/remoting/webapp/hangout_session.js |
+++ b/remoting/webapp/hangout_session.js |
@@ -16,19 +16,26 @@ |
var remoting = remoting || {}; |
/** |
+ * @param {string} senderId id of the current tab or window. |
* @constructor |
*/ |
-remoting.HangoutSession = function() { |
+remoting.HangoutSession = function(senderId) { |
/** |
* @private |
- * @type {chrome.extension.Port} |
+ * @type {chrome.runtime.Port} |
*/ |
this.port_ = null; |
+ |
+ /** |
+ * @private |
+ * @type {string} |
+ */ |
+ this.senderId_ = senderId; |
}; |
remoting.HangoutSession.prototype.init = function() { |
- this.port_ = chrome.runtime.connect({name: 'it2me.helper.webapp'}); |
- |
+ var portName = 'it2me.helper.webapp@' + this.senderId_; |
+ this.port_ = chrome.runtime.connect({name: portName}); |
remoting.hangoutSessionEvents.addEventListener( |
remoting.hangoutSessionEvents.sessionStateChanged, |
this.onSessionStateChanged_.bind(this)); |
@@ -44,6 +51,8 @@ remoting.HangoutSession.prototype.onSessionStateChanged_ = function(state) { |
} catch (e) { |
// postMessage will throw an exception if the port is disconnected. |
// We can safely ignore this exception. |
+ var error = /** @type{Error} */ e; |
+ console.error(error); |
} finally { |
if (state === State.FAILED || state === State.CLOSED) { |
// close the current window |