dom/tests/mochitest/webapps/test_bug_765063.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/webapps/test_bug_765063.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<?xml version="1.0"?>
     1.5 +
     1.6 +<!-- Any copyright is dedicated to the Public Domain.
     1.7 +   - http://creativecommons.org/publicdomain/zero/1.0/ -->
     1.8 +
     1.9 +<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
    1.10 +<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
    1.11 +
    1.12 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +        title="Mozilla Bug 765063">
    1.14 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.15 +  <script type="application/javascript" src="head.js"/>
    1.16 +  <!-- test results are displayed in the html:body -->
    1.17 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.18 +  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741549"
    1.19 +     target="_blank">Mozilla Bug 765063</a>
    1.20 +  </body>
    1.21 +
    1.22 +<script> 
    1.23 +
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +SpecialPowers.setAllAppsLaunchable(true);
    1.27 +
    1.28 +var mmListener = {
    1.29 +  receiveMessage: function(aMessage) {
    1.30 +    ppmm.removeMessageListener("Webapps:Install", mmListener);
    1.31 +
    1.32 +    var msg = aMessage.json;
    1.33 +    var ioService = Components.classes["@mozilla.org/network/io-service;1"]
    1.34 +                                      .getService(Components.interfaces.nsIIOService);
    1.35 +    var uri = ioService.newURI(msg.from, null, null);
    1.36 +    is(uri.prePath, "http://test", "the install origin didn't change");
    1.37 +
    1.38 +    SimpleTest.finish();
    1.39 +  }
    1.40 +};
    1.41 +
    1.42 +var ppmm = Components.classes["@mozilla.org/parentprocessmessagemanager;1"]
    1.43 +                             .getService(Components.interfaces.nsIMessageBroadcaster);
    1.44 +ppmm.addMessageListener("Webapps:Install", mmListener);
    1.45 +
    1.46 +// We call this here, even though the app is installed by the helper page,
    1.47 +// because the helper page redirect would cause its install listener to unload
    1.48 +// before it can confirm the install.
    1.49 +confirmNextInstall();
    1.50 +
    1.51 +</script> 
    1.52 +
    1.53 +  <!-- Load a page that initiates an app installation and then immediately
    1.54 +     - redirects to a page at a different origin.  We can't do this directly
    1.55 +     - inside this test page, because that would cause the test to hang. -->
    1.56 +  <iframe src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/>
    1.57 +
    1.58 +</window>

mercurial