Bug 990330: Remove event listener to avoid leaking in test_bug_771294.xul. r=ehsan

This commit is contained in:
Kyle Huey 2014-04-01 11:33:28 +08:00
parent d952ac3b4a
commit dd7075b92c

View File

@ -29,14 +29,17 @@ Cu.import("resource://gre/modules/PopupNotifications.jsm");
let blocked = true;
window.top.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView
.PopupNotifications.panel
.addEventListener("popupshowing", function() {
function blockedListener() {
blocked = false;
}, false);
}
let panel = window.top.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView
.PopupNotifications.panel;
panel.addEventListener("popupshowing", blockedListener, false);
Services.obs.addObserver(
function observeInstalling() {
@ -45,6 +48,7 @@ Services.obs.addObserver(
// to process the install request and (hopefully not) show the doorhanger.
setTimeout(function verify() {
ok(blocked, "Install panel was blocked after immediate redirect");
panel.removeEventListener("popupshowing", blockedListener);
SimpleTest.finish();
}, 0);
},