Bug 817782 - unhide the social chatbar as new top-level windows are opened. r=gavin
authorMark Hammond <mhammond@skippinet.com.au>
Thu, 06 Dec 2012 13:37:04 +1100
changeset 115154 d3dc0b80efe3c2342eeaebbaa78ef17c908e37af
parent 115153 3399897304da595848f9626d32cc9f14982d4038
child 115155 2bf2896077db32c75a5ab852526740f58bcf8280
push id23973
push useremorley@mozilla.com
push dateThu, 06 Dec 2012 10:04:18 +0000
treeherdermozilla-central@ddda5400c826 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs817782
milestone20.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 817782 - unhide the social chatbar as new top-level windows are opened. r=gavin
browser/base/content/browser-social.js
browser/base/content/test/browser_social_chatwindow.js
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -113,16 +113,17 @@ let SocialUI = {
     // The View->Sidebar and Menubar->Tools menu.
     for (let id of ["menu_socialSidebar", "menu_socialAmbientMenu"])
       document.getElementById(id).setAttribute("label", Social.provider.name);
 
     SocialToolbar.init();
     SocialShareButton.init();
     SocialSidebar.init();
     SocialMenu.populate();
+    SocialChatBar.update();
     this.updateActiveBroadcaster();
   },
 
   updateToggleCommand: function SocialUI_updateToggleCommand() {
     if (!Social.provider)
       return;
 
     let toggleCommand = this.toggleCommand;
--- a/browser/base/content/test/browser_social_chatwindow.js
+++ b/browser/base/content/test/browser_social_chatwindow.js
@@ -407,16 +407,38 @@ var tests = {
             port.close();
             next();
           });
       }
     }
     port.postMessage({topic: "test-init", data: { id: 1 }});
   },
 
+  testSecondTopLevelWindow: function(next) {
+    // Bug 817782 - check chats work in new top-level windows.
+    const chatUrl = "https://example.com/browser/browser/base/content/test/social_chat.html";
+    let port = Social.provider.getWorkerPort();
+    let secondWindow;
+    port.onmessage = function(e) {
+      if (e.data.topic == "test-init-done") {
+        secondWindow = OpenBrowserWindow();
+        secondWindow.addEventListener("load", function loadListener() {
+          secondWindow.removeEventListener("load", loadListener);
+          port.postMessage({topic: "test-worker-chat", data: chatUrl});
+        });
+      } else if (e.data.topic == "got-chatbox-message") {
+        // the chat was created - let's make sure it was created in the second window.
+        is(secondWindow.SocialChatBar.chatbar.childElementCount, 1);
+        secondWindow.close();
+        next();
+      }
+    }
+    port.postMessage({topic: "test-init"});
+  },
+
   // XXX - note this must be the last test until we restore the login state
   // between tests...
   testCloseOnLogout: function(next) {
     const chatUrl = "https://example.com/browser/browser/base/content/test/social_chat.html";
     let port = Social.provider.getWorkerPort();
     ok(port, "provider has a port");
     port.postMessage({topic: "test-init"});
     port.onmessage = function (e) {