diff --git a/browser/base/content/socialchat.xml b/browser/base/content/socialchat.xml index 6355429fcd3..83ac01569c1 100644 --- a/browser/base/content/socialchat.xml +++ b/browser/base/content/socialchat.xml @@ -669,6 +669,12 @@ if (event.target != otherWin.document) return; + let detachEvent = new aChatbox.contentWindow.CustomEvent("socialFrameDetached", { + bubbles: true, + cancelable: true, + }); + aChatbox.contentDocument.dispatchEvent(detachEvent); + otherWin.removeEventListener("load", _chatLoad, true); let otherChatbox = otherWin.document.getElementById("chatter"); aChatbox.swapDocShells(otherChatbox); diff --git a/browser/components/loop/MozLoopService.jsm b/browser/components/loop/MozLoopService.jsm index a3f034be0eb..6c30bf43835 100644 --- a/browser/components/loop/MozLoopService.jsm +++ b/browser/components/loop/MozLoopService.jsm @@ -828,9 +828,15 @@ let MozLoopServiceInternal = { let window = chatbox.contentWindow; - window.addEventListener("unload", function onUnloadChat(evt) { - UITour.notify("Loop:ChatWindowClosed"); - }); + function socialFrameChanged(eventName) { + UITour.availableTargetsCache.clear(); + UITour.notify(eventName); + } + + window.addEventListener("socialFrameHide", socialFrameChanged.bind(null, "Loop:ChatWindowHidden")); + window.addEventListener("socialFrameShow", socialFrameChanged.bind(null, "Loop:ChatWindowShown")); + window.addEventListener("socialFrameDetached", socialFrameChanged.bind(null, "Loop:ChatWindowDetached")); + window.addEventListener("unload", socialFrameChanged.bind(null, "Loop:ChatWindowClosed")); injectLoopAPI(window); diff --git a/browser/modules/UITour.jsm b/browser/modules/UITour.jsm index 7534fd4b4b8..48448e8c337 100644 --- a/browser/modules/UITour.jsm +++ b/browser/modules/UITour.jsm @@ -142,6 +142,16 @@ this.UITour = { return loopBrowser.contentDocument.querySelector(".room-list"); }, }], + ["loop-selectedRoomButtons", { + infoPanelPosition: "leftcenter bottomright", + query: (aDocument) => { + let chatbox = aDocument.querySelector("chatbox[src^='about\:loopconversation'][selected]"); + if (!chatbox || !chatbox.contentDocument) { + return null; + } + return chatbox.contentDocument.querySelector(".call-action-group"); + }, + }], ["loop-signInUpLink", { query: (aDocument) => { let loopBrowser = aDocument.querySelector("#loop-notification-panel > #loop"); @@ -1375,8 +1385,7 @@ this.UITour = { hideLoopPanelAnnotations: function(aEvent) { UITour.hideAnnotationsForPanel(aEvent, (aTarget) => { - // TODO: Bug 1104927 - Handle the conversation targets separately. - return aTarget.targetName.startsWith("loop-"); + return aTarget.targetName.startsWith("loop-") && aTarget.targetName != "loop-selectedRoomButtons"; }); },