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

59 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();
makeAllAppsLaunchable();
var url = "http://test/chrome/dom/tests/mochitest/webapps/apps/basic.webapp";
// Observe app installation and confirm that the install origin didn't change.
var observer = {
observe: function observe(subject, topic, data) {
Services.obs.removeObserver(observer, "webapps-sync-install");
is(JSON.parse(data).installOrigin, "http://test",
"the install origin didn't change");
navigator.mozApps.mgmt.getAll().onsuccess = function onGetAll() {
var app = [a for (a of this.result) if (a.manifestURL == url)][0];
app.uninstall().onsuccess = function onUninstall() {
SimpleTest.finish();
}
}
}
};
Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver(observer, "webapps-sync-install", false);
// 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.
confirmNextInstall();
</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/bug_765063.xul"/>
</window>