gecko/dom/tests/mochitest/webapps/test_bug_771294.xul
Marco Castelluccio dfc9d0934f Bug 771294 - Install App doorhanger remains visible when installing page immediately loads another page. r=myk
--HG--
rename : dom/tests/mochitest/webapps/bug_765063.xul => dom/tests/mochitest/webapps/install_and_redirect_helper.xul
2013-08-05 16:30:41 -04:00

63 lines
2.2 KiB
XML

<?xml version="1.0"?>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Mozilla Bug 771294">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript" src="head.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=771294"
target="_blank">Mozilla Bug 771294</a>
</body>
<script>
const Ci = Components.interfaces;
const Cu = Components.utils;
SimpleTest.waitForExplicitFinish();
makeAllAppsLaunchable();
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/PopupNotifications.jsm");
let blocked = true;
window.top.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView
.PopupNotifications.panel
.addEventListener("popupshowing", function() {
blocked = false;
}, false);
Services.obs.addObserver(
function observeInstalling() {
Services.obs.removeObserver(observeInstalling, "webapps-ask-install");
// Spin the event loop before running the test to give the registry time
// to process the install request and (hopefully not) show the doorhanger.
setTimeout(function verify() {
ok(blocked, "Install panel was blocked after immediate redirect");
SimpleTest.finish();
}, 0);
},
"webapps-ask-install",
false
);
</script>
<!-- Load a page that initiates an app installation and then immediately
- redirects to a page at a different origin. We can't do this directly
- inside this test page, because that would cause the test to hang. -->
<iframe src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/>
</window>