mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out bc8eeacc3c8a (bug 843893) for (at least) desktop bustage in test_power_basics.html
This commit is contained in:
parent
af416ef4e2
commit
8f82505fcd
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Non-Permitted Application for Alarm API</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
@ -12,37 +13,21 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
function alarmtests() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
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.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
|
||||
SpecialPowers.removePermission("alarms", document);
|
||||
window.location = window.location;
|
||||
}
|
||||
|
||||
// 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");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES = \
|
||||
test_power_basics.html \
|
||||
test_power_non_permitted_app.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
|
@ -4,12 +4,6 @@
|
||||
<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"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Power API **/
|
||||
@ -17,11 +11,42 @@
|
||||
ok('mozPower' in navigator, "navigator.mozPower should exist");
|
||||
|
||||
/** Test permission **/
|
||||
// In b2g, addPermission 'power' is only working after a document reload
|
||||
// See bug 802312
|
||||
|
||||
power = navigator.mozPower;
|
||||
ok(power, "Should be able to access power manager with permission.");
|
||||
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>
|
||||
|
@ -1,39 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Power 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">
|
||||
|
||||
/** Test for Power API **/
|
||||
|
||||
function powertests() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
power = navigator.mozPower;
|
||||
ok(!power, "Shouldn't be able to access power manager without permission.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
if(!SpecialPowers.hasPermission("power", document)) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var js = document.createElement("script");
|
||||
js.type = "application/javascript";
|
||||
js.src = "/tests/SimpleTest/SimpleTest.js";
|
||||
js.onload = powertests;
|
||||
head.appendChild(js);
|
||||
|
||||
} else {
|
||||
SpecialPowers.removePermission("power", document);
|
||||
window.location = window.location;
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user