Bug 1251890: Fix RemoveTopWindowID listener. r=billm

MozReview-Commit-ID: 4nQdPszQOy
This commit is contained in:
Kris Maglione 2016-02-27 14:11:25 -08:00
parent a5d98d1dec
commit 571eaa9908
4 changed files with 26 additions and 1 deletions

View File

@ -15,6 +15,7 @@
// Test harness globals
"ExtensionTestUtils": false,
"TestUtils": false,
"clickBrowserAction": true,
"clickPageAction": true,

View File

@ -50,4 +50,5 @@ support-files =
[browser_ext_windows_update.js]
[browser_ext_contentscript_connect.js]
[browser_ext_tab_runtimeConnect.js]
[browser_ext_topwindowid.js]
[browser_ext_webNavigation_getFrames.js]

View File

@ -0,0 +1,23 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
add_task(function* test_topwindowid_cleanup() {
let {Frames} = Cu.import("resource://gre/modules/ExtensionManagement.jsm", {});
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/");
let {outerWindowID, messageManager} = tab.linkedBrowser;
ok(Frames.topWindowIds.has(outerWindowID), "Outer window ID is registered");
let awaitDisconnect = TestUtils.topicObserved("message-manager-disconnect",
subject => subject === messageManager);
yield BrowserTestUtils.removeTab(tab);
yield awaitDisconnect;
ok(!Frames.topWindowIds.has(outerWindowID), "Outer window ID is no longer registered");
});

View File

@ -35,7 +35,7 @@ var Frames = {
}
Services.mm.addMessageListener("Extension:TopWindowID", this);
Services.mm.addMessageListener("Extension:RemoveTopWindowID", this);
Services.mm.addMessageListener("Extension:RemoveTopWindowID", this, true);
},
isTopWindowId(windowId) {