2012-08-14 22:27:26 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-10-07 12:03:21 +00:00
|
|
|
var Ci = Components.interfaces;
|
|
|
|
var Cu = Components.utils;
|
2012-08-14 22:27:26 +00:00
|
|
|
|
|
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
|
2013-08-16 19:17:52 +00:00
|
|
|
Services.scriptloader
|
|
|
|
.loadSubScript("chrome://webapprt/content/mochitest-shared.js", this);
|
2012-08-14 22:27:26 +00:00
|
|
|
|
2013-08-16 19:17:52 +00:00
|
|
|
// In test mode, the runtime isn't configured until we tell it to become
|
|
|
|
// an app, which requires us to use DOMApplicationRegistry to install one.
|
|
|
|
// But DOMApplicationRegistry needs to know the location of its registry dir,
|
|
|
|
// so we need to configure the runtime with at least that information.
|
|
|
|
WebappRT.config = {
|
|
|
|
registryDir: Services.dirsvc.get("ProfD", Ci.nsIFile).path,
|
|
|
|
};
|
2012-08-14 22:27:26 +00:00
|
|
|
|
2013-08-16 19:17:52 +00:00
|
|
|
Cu.import("resource://gre/modules/Webapps.jsm");
|
2012-08-14 22:27:26 +00:00
|
|
|
|
2014-11-13 11:30:00 +00:00
|
|
|
becomeWebapp("http://mochi.test:8888/webapprtContent/webapprt/test/content/test.webapp",
|
2013-08-16 19:17:52 +00:00
|
|
|
undefined, function onBecome() {
|
|
|
|
if (window.arguments && window.arguments[0]) {
|
|
|
|
let testUrl = window.arguments[0].QueryInterface(Ci.nsIPropertyBag2).get("url");
|
|
|
|
|
|
|
|
if (testUrl) {
|
|
|
|
let win = Services.wm.getMostRecentWindow("webapprt:webapp");
|
|
|
|
win.document.getElementById("content").setAttribute("src", testUrl);
|
|
|
|
}
|
2012-08-14 22:27:26 +00:00
|
|
|
}
|
|
|
|
|
2013-08-16 19:17:52 +00:00
|
|
|
window.close();
|
|
|
|
});
|