gecko/dom/alarm/test/test_alarm_non_permitted_app.html

51 lines
1.3 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<title>Test Non-Permitted Application for Alarm API</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
<script type="application/javascript">
"use strict";
function alarmtests() {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
// mozAlarms is intalled on all platforms except Android for the moment.
if (navigator.appVersion.indexOf("Android") != -1) {
ok(!('mozAlarms' in navigator), "navigator.mozAlarms should not exist");
} else {
ok('mozAlarms' in navigator, "navigator.mozAlarms should exist");
is(navigator.mozAlarms, null, "navigator.mozAlarms should return null");
}
SpecialPowers.addPermission("alarms", true, document);
SimpleTest.finish();
});
}
if(!SpecialPowers.hasPermission("alarms", document)) {
var head = document.getElementsByTagName('head')[0];
var js = document.createElement("script");
js.type = "application/javascript";
js.src = "/tests/SimpleTest/SimpleTest.js";
js.onload = alarmtests;
head.appendChild(js);
} else {
SpecialPowers.removePermission("alarms", document);
window.location = window.location;
}
</script>
</pre>
</body>
</html>