1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const Ci = Components.interfaces;
6 const Cu = Components.utils;
8 Cu.import("resource://gre/modules/Services.jsm");
11 .loadSubScript("chrome://webapprt/content/mochitest-shared.js", this);
13 // In test mode, the runtime isn't configured until we tell it to become
14 // an app, which requires us to use DOMApplicationRegistry to install one.
15 // But DOMApplicationRegistry needs to know the location of its registry dir,
16 // so we need to configure the runtime with at least that information.
18 registryDir: Services.dirsvc.get("ProfD", Ci.nsIFile).path,
22 Cu.import("resource://gre/modules/Webapps.jsm");
24 DOMApplicationRegistry.allAppsLaunchable = true;
26 becomeWebapp("http://mochi.test:8888/tests/webapprt/test/content/test.webapp",
27 undefined, function onBecome() {
28 if (window.arguments && window.arguments[0]) {
29 let testUrl = window.arguments[0].QueryInterface(Ci.nsIPropertyBag2).get("url");
32 let win = Services.wm.getMostRecentWindow("webapprt:webapp");
33 win.document.getElementById("content").setAttribute("src", testUrl);