browser_bug410900.js
Go to the documentation of this file.
1 function test() {
3 
4  // Setup a phony handler to ensure the app pane will be populated.
5  var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
6  createInstance(Ci.nsIWebHandlerApp);
7  handler.name = "App pane alive test";
8  handler.uriTemplate = "http://test.mozilla.org/%s";
9 
10  var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
11  getService(Ci.nsIExternalProtocolService);
12  var info = extps.getProtocolHandlerInfo("apppanetest");
13  info.possibleApplicationHandlers.appendElement(handler, false);
14 
15  var hserv = Cc["@mozilla.org/uriloader/handler-service;1"].
16  getService(Ci.nsIHandlerService);
17  hserv.store(info);
18 
19  var obs = Cc["@mozilla.org/observer-service;1"].
20  getService(Ci.nsIObserverService);
21 
22  var observer = {
23  observe: function(win, topic, data) {
24  if (topic != "app-handler-pane-loaded")
25  return;
26 
27  obs.removeObserver(observer, "app-handler-pane-loaded");
28  runTest(win);
29  }
30  };
31  obs.addObserver(observer, "app-handler-pane-loaded", false);
32 
33  openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
34  "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneApplications");
35 }
36 
37 function runTest(win) {
38  var sel = win.document.documentElement.getAttribute("lastSelected");
39  ok(sel == "paneApplications", "Specified pane was opened");
40 
41  var rbox = win.document.getElementById("handlersView");
42  ok(rbox, "handlersView is present");
43 
44  var items = rbox && rbox.getElementsByTagName("richlistitem");
45  ok(items && items.length > 0, "App handler list populated");
46 
47  var handlerAdded = false;
48  for (let i = 0; i < items.length; i++) {
49  if (items[i].type == "apppanetest")
50  handlerAdded = true;
51  }
52  ok(handlerAdded, "apppanetest protocol handler was successfully added");
53 
54  win.close();
55  finish();
56 }
const Cc
sidebarFactory createInstance
Definition: nsSidebar.js:351
getService(Ci.sbIFaceplateManager)
waitForExplicitFinish()
function runTest(win)
observe topic
Definition: FeedWriter.js:1326
const Ci
function test()
observe data
Definition: FeedWriter.js:1329
_getSelectedPageStyle s i
GstMessage gpointer data sbGStreamerMessageHandler * handler
let observer
sbDeviceFirmwareAutoCheckForUpdate prototype observe