2012-06-22 00:37:49 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test Non-Permitted Application for Alarm API</title>
|
2013-03-19 14:27:55 -07:00
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2012-06-22 00:37:49 -07:00
|
|
|
<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";
|
|
|
|
|
2013-03-19 14:27:55 -07:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
2013-03-25 16:50:06 -07:00
|
|
|
if (SpecialPowers.hasPermission("alarms", document)) {
|
2013-03-07 12:48:34 -08:00
|
|
|
SpecialPowers.removePermission("alarms", document);
|
2013-03-25 16:50:06 -07:00
|
|
|
window.location.reload();
|
|
|
|
} else {
|
|
|
|
SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
|
|
|
|
SpecialPowers.removePermission("alarms", document);
|
2012-06-22 00:37:49 -07:00
|
|
|
|
2014-06-12 23:19:11 -07:00
|
|
|
// mozAlarms is installed on all platforms except Android for the moment.
|
2013-03-25 16:50:06 -07:00
|
|
|
if (navigator.appVersion.indexOf("Android") != -1) {
|
2014-06-12 23:19:11 -07:00
|
|
|
ok(!('mozAlarms' in navigator),
|
|
|
|
"navigator.mozAlarms should not exist without permission");
|
|
|
|
ok(!('AlarmsManager' in window),
|
|
|
|
"Interface AlarmsManager should not exist");
|
2013-03-25 16:50:06 -07:00
|
|
|
} else {
|
2014-06-12 23:19:11 -07:00
|
|
|
ok(!('mozAlarms' in navigator),
|
|
|
|
"navigator.mozAlarms should not exist without permission");
|
|
|
|
ok(!('AlarmsManager' in window),
|
|
|
|
"Interface AlarmsManager should not exist without permission");
|
2013-03-25 16:50:06 -07:00
|
|
|
}
|
|
|
|
SpecialPowers.addPermission("alarms", true, document);
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
}
|
2012-06-22 00:37:49 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|