dom/tests/mochitest/webapps/test_bug_771294.xul

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:3f89eebc9e79
1 <?xml version="1.0"?>
2
3 <!-- Any copyright is dedicated to the Public Domain.
4 - http://creativecommons.org/publicdomain/zero/1.0/ -->
5
6 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
7 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
8
9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
10 title="Mozilla Bug 771294">
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
12 <script type="application/javascript" src="head.js"/>
13 <!-- test results are displayed in the html:body -->
14 <body xmlns="http://www.w3.org/1999/xhtml">
15 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=771294"
16 target="_blank">Mozilla Bug 771294</a>
17 </body>
18
19 <script>
20 const Ci = Components.interfaces;
21 const Cu = Components.utils;
22
23 SimpleTest.waitForExplicitFinish();
24
25 SpecialPowers.setAllAppsLaunchable(true);
26
27 Cu.import("resource://gre/modules/Services.jsm");
28 Cu.import("resource://gre/modules/PopupNotifications.jsm");
29
30 let blocked = true;
31
32 function blockedListener() {
33 blocked = false;
34 }
35
36 let panel = window.top.QueryInterface(Ci.nsIInterfaceRequestor)
37 .getInterface(Ci.nsIWebNavigation)
38 .QueryInterface(Ci.nsIDocShell)
39 .chromeEventHandler.ownerDocument.defaultView
40 .PopupNotifications.panel;
41
42 panel.addEventListener("popupshowing", blockedListener, false);
43
44 Services.obs.addObserver(
45 function observeInstalling() {
46 Services.obs.removeObserver(observeInstalling, "webapps-ask-install");
47 // Spin the event loop before running the test to give the registry time
48 // to process the install request and (hopefully not) show the doorhanger.
49 setTimeout(function verify() {
50 ok(blocked, "Install panel was blocked after immediate redirect");
51 panel.removeEventListener("popupshowing", blockedListener);
52 SimpleTest.finish();
53 }, 0);
54 },
55 "webapps-ask-install",
56 false
57 );
58
59 </script>
60
61 <!-- Load a page that initiates an app installation and then immediately
62 - redirects to a page at a different origin. We can't do this directly
63 - inside this test page, because that would cause the test to hang. -->
64 <iframe src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/>
65
66 </window>

mercurial