Bug 446212 - Random failure on Linux mozilla-central qm-centos5-03 / browser_bug410900.js. r=gavin

This commit is contained in:
Ryan Flint 2008-07-20 02:34:35 -04:00
Родитель 42c45fec0f
Коммит 683c68d711
2 изменённых файлов: 31 добавлений и 15 удалений

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

@ -982,6 +982,10 @@ var gApplicationsPane = {
self._rebuildVisibleTypes();
self._sortVisibleTypes();
self._rebuildView();
// Notify observers that the UI is now ready
Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService).
notifyObservers(window, "app-handler-pane-loaded", null);
}
setTimeout(_delayedPaneLoad, 0, this);
},

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

@ -16,28 +16,40 @@ function test() {
getService(Ci.nsIHandlerService);
hserv.store(info);
var obs = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
var observer = {
observe: function(win, topic, data) {
if (topic != "app-handler-pane-loaded")
return;
runTest(win);
obs.removeObserver(observer, "app-handler-pane-loaded");
}
};
obs.addObserver(observer, "app-handler-pane-loaded", false);
openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no", "paneApplications");
setTimeout(runTest, 1000);
}
function runTest() {
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var win = wm.getMostRecentWindow("Browser:Preferences");
ok(win, "Pref window opened");
function runTest(win) {
var sel = win.document.documentElement.getAttribute("lastSelected");
ok(sel == "paneApplications", "Specified pane was opened");
if (win) {
var sel = win.document.documentElement.getAttribute("lastSelected");
ok(sel == "paneApplications", "Specified pane was opened");
var rbox = win.document.getElementById("handlersView");
ok(rbox, "handlersView is present");
var rbox = win.document.getElementById("handlersView");
ok(rbox, "handlersView is present");
var items = rbox && rbox.getElementsByTagName("richlistitem");
ok(items && items.length > 0, "App handler list populated");
var items = rbox && rbox.getElementsByTagName("richlistitem");
ok(items && items.length > 0, "App handler list populated");
win.close();
var handlerAdded = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type == "apppanetest")
handlerAdded = true;
}
ok(handlerAdded, "apppanetest protocol handler was successfully added");
win.close();
finish();
}