michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: // Setup a phony handler to ensure the app pane will be populated. michael@0: var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"]. michael@0: createInstance(Ci.nsIWebHandlerApp); michael@0: handler.name = "App pane alive test"; michael@0: handler.uriTemplate = "http://test.mozilla.org/%s"; michael@0: michael@0: var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]. michael@0: getService(Ci.nsIExternalProtocolService); michael@0: var info = extps.getProtocolHandlerInfo("apppanetest"); michael@0: info.possibleApplicationHandlers.appendElement(handler, false); michael@0: michael@0: var hserv = Cc["@mozilla.org/uriloader/handler-service;1"]. michael@0: getService(Ci.nsIHandlerService); michael@0: hserv.store(info); michael@0: michael@0: function observer(win, topic, data) { michael@0: if (topic != "app-handler-pane-loaded") michael@0: return; michael@0: michael@0: Services.obs.removeObserver(observer, "app-handler-pane-loaded"); michael@0: runTest(win); michael@0: } michael@0: Services.obs.addObserver(observer, "app-handler-pane-loaded", false); michael@0: michael@0: openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences", michael@0: "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneApplications"); michael@0: } michael@0: michael@0: function runTest(win) { michael@0: var sel = win.document.documentElement.getAttribute("lastSelected"); michael@0: ok(sel == "paneApplications", "Specified pane was opened"); michael@0: michael@0: var rbox = win.document.getElementById("handlersView"); michael@0: ok(rbox, "handlersView is present"); michael@0: michael@0: var items = rbox && rbox.getElementsByTagName("richlistitem"); michael@0: ok(items && items.length > 0, "App handler list populated"); michael@0: michael@0: var handlerAdded = false; michael@0: for (let i = 0; i < items.length; i++) { michael@0: if (items[i].type == "apppanetest") michael@0: handlerAdded = true; michael@0: } michael@0: ok(handlerAdded, "apppanetest protocol handler was successfully added"); michael@0: michael@0: win.close(); michael@0: finish(); michael@0: }