dom/tests/mochitest/webapps/file_bug_779982.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/webapps/file_bug_779982.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +  <body>
     1.7 +    foobar!
     1.8 +  </body>
     1.9 +  <script>
    1.10 +    var finished = false;
    1.11 +    var data = window.location.search.substring(1).split('&');
    1.12 +
    1.13 +    function finish(value) {
    1.14 +      value ? alert('success') : alert('failure');
    1.15 +      finished = true;
    1.16 +    }
    1.17 +
    1.18 +    switch (data[0]) {
    1.19 +      case "getSelf":
    1.20 +        navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
    1.21 +          if (data[1] == 'true') {
    1.22 +            finish(this.result == null);
    1.23 +          } else {
    1.24 +            finish(this.result != null);
    1.25 +          }
    1.26 +        }
    1.27 +        break;
    1.28 +
    1.29 +      case "checkInstalled":
    1.30 +        navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() {
    1.31 +          if (data[1] == 'true') {
    1.32 +            finish(!this.result);
    1.33 +          } else {
    1.34 +            finish(!!this.result);
    1.35 +          }
    1.36 +        }
    1.37 +        break;
    1.38 +
    1.39 +      case "checkInstalledWrong":
    1.40 +        try {
    1.41 +          navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
    1.42 +          finish(false);
    1.43 +        } catch (e) {
    1.44 +          finish(true);
    1.45 +        }
    1.46 +        break;
    1.47 +
    1.48 +      default:
    1.49 +        finish(false);
    1.50 +        break;
    1.51 +    }
    1.52 +  </script>
    1.53 +</html>

mercurial