gecko/dom/tests/mochitest/webapps/test_bug_765063.xul

56 lines
2.1 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 765063">
<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=741549"
target="_blank">Mozilla Bug 765063</a>
</body>
<script>
SimpleTest.waitForExplicitFinish();
SpecialPowers.setAllAppsLaunchable(true);
var mmListener = {
receiveMessage: function(aMessage) {
ppmm.removeMessageListener("Webapps:Install", mmListener);
var msg = aMessage.json;
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(msg.from, null, null);
is(uri.prePath, "http://test", "the install origin didn't change");
SimpleTest.finish();
}
};
var ppmm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Components.interfaces.nsIMessageBroadcaster);
ppmm.addMessageListener("Webapps:Install", mmListener);
// We call this here, even though the app is installed by the helper page,
// because the helper page redirect would cause its install listener to unload
// before it can confirm the install.
confirmNextPopup();
</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>