Bumping manifests a=b2g-bump
[gecko.git] / dom / apps / tests / file_script.template.js
blobbbd8b15cda06ac3fa57558d7277471680712bc62
1 function sendMessage(msg) {
2   alert(msg);
5 function ok(p, msg) {
6   if (p)
7     sendMessage("OK: " + msg);
8   else
9     sendMessage("KO: " + msg);
12 function is(a, b, msg) {
13   if (a == b)
14     sendMessage("OK: " + a + " == " + b + " - " + msg);
15   else
16     sendMessage("KO: " + a + " != " + b + " - " + msg);
19 function installed(p) {
20   if (p)
21     sendMessage("IS_INSTALLED");
22   else
23     sendMessage("NOT_INSTALLED");
26 function finish() {
27   sendMessage("VERSION: MyWebApp vVERSIONTOKEN");
28   sendMessage("DONE");
31 function cbError() {
32   ok(false, "Error callback invoked");
33   finish();
36 function go() {
37   ok(true, "Launched APPTYPETOKEN app");
38   var request = window.navigator.mozApps.getSelf();
39   request.onsuccess = function() {
40     var app = request.result;
41     checkApp(app);
42   }
43   request.onerror = cbError;
46 function checkApp(app) {
47   // If the app is installed, |app| will be non-null. If it is, verify its state.
48   installed(!!app);
49   if (app) {
50     var appName = "Really Rapid Release (APPTYPETOKEN)";
51     var manifest = SpecialPowers.wrap(app.manifest);
52     is(manifest.name, appName, "Manifest name should be correct");
53     is(app.origin, "http://test", "App origin should be correct");
54     is(app.installOrigin, "http://mochi.test:8888", "Install origin should be correct");
55   }
56   finish();
59 go();