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
parent 3f6f378217
commit b116bc2d1e
3 changed files with 20 additions and 11 deletions

View File

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

View File

@ -1,4 +1,5 @@
<?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"
id="addon-test-pref-window">
<label value="Oh hai!"/>

View File

@ -10,8 +10,8 @@ function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
var addonPrefsURI = TESTROOT + "addon_prefs.xul";
var addonPrefsURI = CHROMEROOT + "addon_prefs.xul";
var gProvider = new MockProvider();
gProvider.createAddons([{
@ -50,19 +50,26 @@ function test() {
"preferences-btn");
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") {
Services.ww.unregisterNotification(arguments.callee);
waitForFocus(function() {
close_manager(aManager);
finish();
}, aManager);
Services.ww.unregisterNotification(TEST_ww_observer);
// Give the preference window a chance to finish closing before closing
// the add-ons manager.
executeSoon(function() {
close_manager(aManager, finish);
});
} else if (aTopic == "domwindowopened") {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.documentURI, addonPrefsURI, "The correct addon pref window should open"
waitForFocus(function() {
win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
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);
}, false);
}
});