dom/tests/mochitest/webapps/file_bug_779982.html

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:dcb04d3fb546
1 <!DOCTYPE html>
2 <html>
3 <body>
4 foobar!
5 </body>
6 <script>
7 var finished = false;
8 var data = window.location.search.substring(1).split('&');
9
10 function finish(value) {
11 value ? alert('success') : alert('failure');
12 finished = true;
13 }
14
15 switch (data[0]) {
16 case "getSelf":
17 navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
18 if (data[1] == 'true') {
19 finish(this.result == null);
20 } else {
21 finish(this.result != null);
22 }
23 }
24 break;
25
26 case "checkInstalled":
27 navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() {
28 if (data[1] == 'true') {
29 finish(!this.result);
30 } else {
31 finish(!!this.result);
32 }
33 }
34 break;
35
36 case "checkInstalledWrong":
37 try {
38 navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
39 finish(false);
40 } catch (e) {
41 finish(true);
42 }
43 break;
44
45 default:
46 finish(false);
47 break;
48 }
49 </script>
50 </html>

mercurial