gecko/dom/tests/mochitest/webapps/file_bug_779982.html

51 lines
1.1 KiB
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":
try {
navigator.mozApps.checkInstalled('http://something.org/manifest.webapp');
finish(false);
} catch (e) {
finish(true);
}
break;
default:
finish(false);
break;
}
</script>
</html>