1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/apps/tests/file_app.template.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +<html> 1.5 +<head> 1.6 +<script> 1.7 + 1.8 +function sendMessage(msg) { 1.9 + alert(msg); 1.10 +} 1.11 + 1.12 +function ok(p, msg) { 1.13 + if (p) 1.14 + sendMessage("OK: " + msg); 1.15 + else 1.16 + sendMessage("KO: " + msg); 1.17 +} 1.18 + 1.19 +function is(a, b, msg) { 1.20 + if (a == b) 1.21 + sendMessage("OK: " + a + " == " + b + " - " + msg); 1.22 + else 1.23 + sendMessage("KO: " + a + " != " + b + " - " + msg); 1.24 +} 1.25 + 1.26 +function installed(p) { 1.27 + if (p) 1.28 + sendMessage("IS_INSTALLED"); 1.29 + else 1.30 + sendMessage("NOT_INSTALLED"); 1.31 +} 1.32 + 1.33 +function finish() { 1.34 + sendMessage("VERSION: MyWebApp vVERSIONTOKEN"); 1.35 + sendMessage("DONE"); 1.36 +} 1.37 + 1.38 +function cbError() { 1.39 + ok(false, "Error callback invoked"); 1.40 + finish(); 1.41 +} 1.42 + 1.43 +function go() { 1.44 + ok(true, "Launched app"); 1.45 + var request = window.navigator.mozApps.getSelf(); 1.46 + request.onsuccess = function() { 1.47 + var app = request.result; 1.48 + checkApp(app); 1.49 + } 1.50 + request.onerror = cbError; 1.51 +} 1.52 + 1.53 +function checkApp(app) { 1.54 + // If the app is installed, |app| will be non-null. If it is, verify its state. 1.55 + installed(!!app); 1.56 + if (app) { 1.57 + var appName = "Really Rapid Release (APPTYPETOKEN)"; 1.58 + var manifest = SpecialPowers.wrap(app.manifest); 1.59 + is(manifest.name, appName, "Manifest name should be correct"); 1.60 + is(app.origin, "http://test", "App origin should be correct"); 1.61 + is(app.installOrigin, "http://mochi.test:8888", "Install origin should be correct"); 1.62 + } 1.63 + finish(); 1.64 +} 1.65 + 1.66 +</script> 1.67 +</head> 1.68 +<body onload="go();"> 1.69 +App Body. Version: VERSIONTOKEN 1.70 +</body></html>