dom/tests/mochitest/webapps/head.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial