Bug 1100284: use a more canonical window ID for chat windows. r=MattN,abr
☠☠ backed out by 1a9ce687110d ☠ ☠
authorMike de Boer <mdeboer@mozilla.com>
Fri, 21 Nov 2014 15:47:59 +0100
changeset 217089 c773c6be92708c523d2519ad584fc92af1e12b52
parent 217088 e8f45cf7b043d717f1b5669b9375b0efafa8356d
child 217090 23410bbf21619cea251cd9123cfef4e4db012cd3
push id52224
push usercbook@mozilla.com
push dateMon, 24 Nov 2014 13:16:24 +0000
treeherdermozilla-inbound@bf9071999612 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, abr
bugs1100284
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1100284: use a more canonical window ID for chat windows. r=MattN,abr
browser/components/loop/MozLoopService.jsm
--- a/browser/components/loop/MozLoopService.jsm
+++ b/browser/components/loop/MozLoopService.jsm
@@ -769,17 +769,24 @@ let MozLoopServiceInternal = {
    *
    * @param {Object} conversationWindowData The data to be obtained by the
    *                                        window when it opens.
    * @returns {Number} The id of the window.
    */
   openChatWindow: function(conversationWindowData) {
     // So I guess the origin is the loop server!?
     let origin = this.loopServerUri;
-    let windowId = gLastWindowId++;
+    // Try getting a window ID that can (re-)identify this conversation, or resort
+    // to a globally unique one as a last resort.
+    // XXX We can clean this up once rooms and direct contact calling are the only
+    //     two modes left.
+    let windowId = ("contact" in conversationWindowData) ?
+                   conversationWindowData.contact._guid || gLastWindowId++ :
+                   conversationWindowData.roomToken || conversationWindowData.callId ||
+                   gLastWindowId++;
     // Store the id as a string, as that's what we use elsewhere.
     windowId = windowId.toString();
 
     gConversationWindowData.set(windowId, conversationWindowData);
 
     let url = "about:loopconversation#" + windowId;
 
     let callback = chatbox => {