https://github.com/mozilla/gecko-dev
Raw File
Tip revision: ae1e734d26dfb74a38e31eed6c9f95c4993f389f authored by ffxbld on 19 October 2016, 23:54:50 UTC
Added FENNEC_49_0_2_RELEASE FENNEC_49_0_2_BUILD2 tag(s) for changeset b8cfe2060804. DONTBUILD CLOSED TREE a=release
Tip revision: ae1e734
file_bug_779982.html
<!DOCTYPE html>
<html>
  <body>
    foobar!
  </body>
  <script>
    var finished = false;
    var data = window.location.search.substring(1).split('&');

    function finish(value) {
      value ? alert('success') : alert('failure');
      finished = true;
    }

    switch (data[0]) {
      case "getSelf":
        navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
          if (data[1] == 'true') {
            finish(this.result == null);
          } else {
            finish(this.result != null);
          }
        }
        break;

      case "checkInstalled":
        navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() {
          if (data[1] == 'true') {
            finish(!this.result);
          } else {
            finish(!!this.result);
          }
        }
        break;

      case "checkInstalledWrong":
        var request = navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
        request.onsuccess = function() {
          finish(false);
        }
        request.onerror = function() {
          if (this.error.name == "CROSS_ORIGIN_CHECK_NOT_ALLOWED") {
            finish(true);
          } else {
            finish(false);
          }
        }
        break;

      default:
        finish(false);
        break;
    }
  </script>
</html>
back to top