Bug 608911 - Invalid check in browser_bug562890.js. r=dtownsend, a=test fix

This commit is contained in:
Robert Strong 2010-11-02 14:55:05 -07:00
Родитель c8ca994c3e
Коммит 06e304f8e6
3 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -82,6 +82,7 @@ _TEST_FILES = \
$(NULL) $(NULL)
_TEST_RESOURCES = \ _TEST_RESOURCES = \
addon_prefs.xul \
browser_bug557956.rdf \ browser_bug557956.rdf \
browser_bug557956_8_2.xpi \ browser_bug557956_8_2.xpi \
browser_bug557956_9_2.xpi \ browser_bug557956_9_2.xpi \

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="addon-test-pref-window"> id="addon-test-pref-window">
<label value="Oh hai!"/> <label value="Oh hai!"/>

Просмотреть файл

@ -11,7 +11,7 @@ function test() {
waitForExplicitFinish(); waitForExplicitFinish();
var addonPrefsURI = TESTROOT + "addon_prefs.xul"; var addonPrefsURI = CHROMEROOT + "addon_prefs.xul";
var gProvider = new MockProvider(); var gProvider = new MockProvider();
gProvider.createAddons([{ gProvider.createAddons([{
@ -50,19 +50,26 @@ function test() {
"preferences-btn"); "preferences-btn");
is(prefsBtn.hidden, false, "Prefs button should be shown for addon with a optionsURL set") is(prefsBtn.hidden, false, "Prefs button should be shown for addon with a optionsURL set")
Services.ww.registerNotification(function(aSubject, aTopic, aData) { Services.ww.registerNotification(function TEST_ww_observer(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed") { if (aTopic == "domwindowclosed") {
Services.ww.unregisterNotification(arguments.callee); Services.ww.unregisterNotification(TEST_ww_observer);
waitForFocus(function() { // Give the preference window a chance to finish closing before closing
close_manager(aManager); // the add-ons manager.
finish(); executeSoon(function() {
}, aManager); close_manager(aManager, finish);
});
} else if (aTopic == "domwindowopened") { } else if (aTopic == "domwindowopened") {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget); let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.documentURI, addonPrefsURI, "The correct addon pref window should open" win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
waitForFocus(function() { win.addEventListener("load", function TEST_ww_onLoad() {
if (win.location != addonPrefsURI)
return;
win.removeEventListener("load", TEST_ww_onLoad, false);
is(win.location, addonPrefsURI,
"The correct addon pref window should have opened");
win.close(); win.close();
}, win); }, false);
} }
}); });