зеркало из https://github.com/mozilla/gecko-dev.git
Bug 607416: Fix failure to close window in browser_bug562890.js. r=robstrong, a=bustage
This commit is contained in:
Родитель
b201b29244
Коммит
d8ce8470fa
|
@ -49,7 +49,7 @@
|
|||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml"
|
||||
id="addons-page" title="&addons.windowTitle;" disablechrome="true"
|
||||
role="application"
|
||||
role="application" windowtype="Addons:Manager"
|
||||
ondragenter="gDragDrop.onDragOver(event)"
|
||||
ondragover="gDragDrop.onDragOver(event)"
|
||||
ondrop="gDragDrop.onDrop(event)">
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче