diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index 3af3408e5218..64cfd26d21dd 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -49,7 +49,7 @@ diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug562890.js b/toolkit/mozapps/extensions/test/browser/browser_bug562890.js index 55d7a678bfb0..c81423bac7cc 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_bug562890.js +++ b/toolkit/mozapps/extensions/test/browser/browser_bug562890.js @@ -24,15 +24,15 @@ function test() { optionsURL: addonPrefsURI }]); - open_manager("addons://list/extension", function(aWindow) { - var addonList = aWindow.document.getElementById("addon-list"); + open_manager("addons://list/extension", function(aManager) { + var addonList = aManager.document.getElementById("addon-list"); for (var i = 0; i < addonList.childNodes.length; i++) { var addonItem = addonList.childNodes[i]; if (addonItem.hasAttribute("name") && addonItem.getAttribute("name") == "Test add-on 1") break; } - var prefsBtn = aWindow.document.getAnonymousElementByAttribute(addonItem, + var prefsBtn = aManager.document.getAnonymousElementByAttribute(addonItem, "anonid", "preferences-btn"); is(prefsBtn.hidden, true, "Prefs button should be hidden for addon with no optionsURL set") @@ -43,26 +43,28 @@ function test() { addonItem.getAttribute("name") == "Test add-on 2") break; } - prefsBtn = aWindow.document.getAnonymousElementByAttribute(addonItem, - "anonid", - "preferences-btn"); + prefsBtn = aManager.document.getAnonymousElementByAttribute(addonItem, + "anonid", + "preferences-btn"); is(prefsBtn.hidden, false, "Prefs button should be shown for addon with a optionsURL set") Services.ww.registerNotification(function(aSubject, aTopic, aData) { if (aTopic == "domwindowclosed") { Services.ww.unregisterNotification(arguments.callee); + waitForFocus(function() { + close_manager(aManager); + finish(); + }, aManager); } else if (aTopic == "domwindowopened") { let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); win.documentURI, addonPrefsURI, "The correct addon pref window should open" waitForFocus(function() { win.close(); - aWindow.close(); - finish(); }, win); } }); - EventUtils.synthesizeMouseAtCenter(prefsBtn, { }, aWindow); + EventUtils.synthesizeMouseAtCenter(prefsBtn, { }, aManager); }); } diff --git a/toolkit/mozapps/extensions/test/browser/head.js b/toolkit/mozapps/extensions/test/browser/head.js index 78827a7bc325..7208d31f7e8f 100644 --- a/toolkit/mozapps/extensions/test/browser/head.js +++ b/toolkit/mozapps/extensions/test/browser/head.js @@ -45,6 +45,13 @@ registerCleanupFunction(function() { catch (e) { } + // Throw an error if the add-ons manager window is open anywhere + var windows = Services.wm.getEnumerator("Addons:Manager"); + if (windows.hasMoreElements()) + ok(false, "Found unexpected add-ons manager window still open"); + while (windows.hasMoreElements()) + windows.getNext().QueryInterface(Ci.nsIDOMWindow).close(); + // We can for now know that getAllInstalls actually calls its callback before // it returns so this will complete before the next test start. AddonManager.getAllInstalls(function(aInstalls) {