mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
53 lines
1.5 KiB
HTML
53 lines
1.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for Power API</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Power API **/
|
|
|
|
ok('mozPower' in navigator, "navigator.mozPower should exist");
|
|
|
|
/** Test permission **/
|
|
// In b2g, addPermission 'power' is only working after a document reload
|
|
// See bug 802312
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function startTest() {
|
|
window.frames[0].frameElement.setAttribute('onload', 'doTest2()');
|
|
power = window.frames[0].navigator.mozPower;
|
|
ok(!power, "Shouldn't be able to access power manager without permission.");
|
|
|
|
SpecialPowers.addPermission("power", true, window.frames[0].document);
|
|
window.frames[0].location.reload();
|
|
}
|
|
|
|
function doTest2() {
|
|
window.frames[0].frameElement.setAttribute('onload', 'doTest3()');
|
|
power = window.frames[0].navigator.mozPower;
|
|
ok(power, "Should be able to access power manager with permission.");
|
|
|
|
SpecialPowers.removePermission("power", window.frames[0].document);
|
|
window.frames[0].location.reload();
|
|
}
|
|
|
|
function doTest3() {
|
|
power = window.frames[0].navigator.mozPower;
|
|
ok(!power, "Shouldn't be able to access power manager without permission.");
|
|
SimpleTest.finish();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
<iframe onload="startTest()"></iframe>
|
|
<pre id="test">
|
|
</pre>
|
|
</body>
|
|
</html>
|