2012-09-25 08:04:24 -07:00
|
|
|
<!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;
|
|
|
|
|
2012-10-02 13:38:51 -07:00
|
|
|
case "checkInstalled":
|
|
|
|
navigator.mozApps.checkInstalled('http://example.org/manifest.webapp').onsuccess = function onCheckInstalled() {
|
2012-09-25 08:04:24 -07:00
|
|
|
if (data[1] == 'true') {
|
2012-10-02 13:38:51 -07:00
|
|
|
finish(!this.result);
|
2012-09-25 08:04:24 -07:00
|
|
|
} else {
|
2012-10-02 13:38:51 -07:00
|
|
|
finish(!!this.result);
|
2012-09-25 08:04:24 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-10-02 13:38:51 -07:00
|
|
|
case "checkInstalledWrong":
|
2012-09-25 08:04:24 -07:00
|
|
|
try {
|
2012-10-02 13:38:51 -07:00
|
|
|
navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
|
2012-09-25 08:04:24 -07:00
|
|
|
finish(false);
|
|
|
|
} catch (e) {
|
|
|
|
finish(true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
finish(false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</html>
|