diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/general/test_idleapi_permissions.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/general/test_idleapi_permissions.html')
-rw-r--r-- | dom/tests/mochitest/general/test_idleapi_permissions.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/tests/mochitest/general/test_idleapi_permissions.html b/dom/tests/mochitest/general/test_idleapi_permissions.html new file mode 100644 index 000000000..4f690f462 --- /dev/null +++ b/dom/tests/mochitest/general/test_idleapi_permissions.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for idle api permissions</title> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"> +</div> +<pre id="test"> +<script type="application/javascript"> + +var idleObserver = { + onidle: null, + onactive: null +}; + +function doAddIdleObserver(obs) { + var i = document.createElement("iframe"); + document.body.appendChild(i); + var added = false; + try { + i.contentWindow.navigator.addIdleObserver(obs); + added = true; + } catch (e) { } + i.remove(); + return added; +} + +function run_test() { + // addIdleObserver checks whether time is > 0. + this.idleObserver.time = 100; + + SpecialPowers.pushPermissions([{type: "idle", allow: true, context: document}], () => { + added = doAddIdleObserver(this.idleObserver, true); + ok(added, "Should be able to add idle observer with permission."); + SimpleTest.finish(); + }); +} + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(run_test); +</script> +</pre> +</body> +</html> |