dom/tests/mochitest/webapps/head.js

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:4f2cb56a7ee6
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function runAll(steps) {
5 SimpleTest.waitForExplicitFinish();
6
7 /**
8 * On Mac, apps aren't considered launchable right after they've been
9 * installed because the OS takes some time to detect them (so
10 * nsIMacWebAppUtils::pathForAppWithIdentifier() returns null).
11 * That causes methods like mgmt.getAll() to exclude the app from their
12 * results, even though the app is installed and is in the registry.
13 * See the tests under toolkit/webapps for a viable solution.
14 *
15 * To work around this problem, set allAppsLaunchable to true, which makes
16 * all apps considered as launchable.
17 */
18 SpecialPowers.setAllAppsLaunchable(true);
19
20 // Clone the array so we don't modify the original.
21 steps = steps.concat();
22 function next() {
23 if (steps.length) {
24 steps.shift()(next);
25 }
26 else {
27 SimpleTest.finish();
28 }
29 }
30 next();
31 }
32
33 function confirmNextInstall() {
34 var Ci = SpecialPowers.Ci;
35
36 var popupPanel = SpecialPowers.wrap(window).top.
37 QueryInterface(Ci.nsIInterfaceRequestor).
38 getInterface(Ci.nsIWebNavigation).
39 QueryInterface(Ci.nsIDocShell).
40 chromeEventHandler.ownerDocument.defaultView.
41 PopupNotifications.panel;
42
43 function onPopupShown() {
44 popupPanel.removeEventListener("popupshown", onPopupShown, false);
45 SpecialPowers.wrap(this).childNodes[0].button.doCommand();
46 }
47 popupPanel.addEventListener("popupshown", onPopupShown, false);
48 }

mercurial