mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 963366 - Hide navigator.requestWakeLock behind pref dom.wakelock.enabled. r=ehsan
--- b2g/app/b2g.js | 3 +++ .../mochitest/priority/test_HighPriority.html | 3 ++- dom/power/test/browser_wakelocks.js | 9 ++++++--- dom/power/test/mochitest.ini | 2 ++ dom/power/test/test_bug957893.html | 21 +++++++++++--------- dom/power/test/test_bug957899.html | 11 +++++++--- dom/power/test/test_wakelock_not_exposed.html | 17 ++++++++++++++++ dom/webidl/MozWakeLock.webidl | 2 +- dom/webidl/Navigator.webidl | 2 +- modules/libpref/src/init/all.js | 3 +++ 10 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 dom/power/test/test_wakelock_not_exposed.html
This commit is contained in:
parent
af08b27daf
commit
dc131e7690
@ -885,3 +885,6 @@ pref("gfx.canvas.willReadFrequently.enable", true);
|
||||
// Disable autofocus until we can have it not bring up the keyboard.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=965763
|
||||
pref("browser.autofocus", false);
|
||||
|
||||
// Enable wakelock
|
||||
pref("dom.wakelock.enabled", true);
|
||||
|
@ -119,7 +119,8 @@ const priorityChangeGracePeriod = 100;
|
||||
addEventListener('testready', function() {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{set: [['dom.ipc.processPriorityManager.backgroundGracePeriodMS',
|
||||
priorityChangeGracePeriod]]},
|
||||
priorityChangeGracePeriod],
|
||||
['dom.wakelock.enabled', true]]},
|
||||
runTest);
|
||||
});
|
||||
|
||||
|
@ -222,12 +222,15 @@ function runNextStep() {
|
||||
if (gCurStepIndex < gSteps.length) {
|
||||
gSteps[gCurStepIndex]();
|
||||
} else {
|
||||
SpecialPowers.removePermission("power", kUrlSource);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
SpecialPowers.addPermission("power", true, kUrlSource);
|
||||
runNextStep();
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "power", allow: true, context: kUrlSource}
|
||||
], function () {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.wakelock.enabled", true]]},
|
||||
runNextStep);
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
[test_bug957893.html]
|
||||
[test_bug957899.html]
|
||||
[test_wakelock_not_exposed.html]
|
||||
skip-if = toolkit == "gonk"
|
||||
[test_power_basics.html]
|
||||
[test_power_set_cpusleepallowed.html]
|
||||
[test_power_set_screen_brightness.html]
|
||||
|
@ -7,15 +7,18 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
try {
|
||||
var wl = navigator.requestWakeLock('');
|
||||
ok(false, "RequestWakeLock throws an exception!");
|
||||
} catch(e) {
|
||||
ok(true, "RequestWakeLock throws an exception!");
|
||||
}
|
||||
|
||||
info("Still alive!");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function test() {
|
||||
try {
|
||||
var wl = navigator.requestWakeLock('');
|
||||
ok(false, "RequestWakeLock throws an exception!");
|
||||
} catch(e) {
|
||||
ok(true, "RequestWakeLock throws an exception!");
|
||||
}
|
||||
info("Still alive!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.wakelock.enabled", true]]}, test);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -7,9 +7,14 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
var wl = navigator.requestWakeLock('a');
|
||||
ok(wl, "WakeLock created!");
|
||||
ok(!(wl instanceof XPathEvaluator), "Crashing?");
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function test() {
|
||||
var wl = navigator.requestWakeLock('a');
|
||||
ok(wl, "WakeLock created!");
|
||||
ok(!(wl instanceof XPathEvaluator), "Crashing?");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.wakelock.enabled", true]]}, test);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
17
dom/power/test/test_wakelock_not_exposed.html
Normal file
17
dom/power/test/test_wakelock_not_exposed.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=963366
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test navigator.requestWakeLock is not exposed to non-B2G platform</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
ok(navigator.requestWakeLock === undefined,
|
||||
"navigator.requestWakeLock is not exposed to non-B2G platform");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -4,7 +4,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
[Func="Navigator::HasWakeLockSupport"]
|
||||
[Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
|
||||
interface MozWakeLock
|
||||
{
|
||||
readonly attribute DOMString topic;
|
||||
|
@ -203,7 +203,7 @@ partial interface Navigator {
|
||||
*
|
||||
* @param aTopic resource name
|
||||
*/
|
||||
[Throws, Func="Navigator::HasWakeLockSupport"]
|
||||
[Throws, Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
|
||||
MozWakeLock requestWakeLock(DOMString aTopic);
|
||||
};
|
||||
|
||||
|
@ -4505,3 +4505,6 @@ pref("urlclassifier.download_allow_table", "");
|
||||
|
||||
// Turn off Spatial navigation by default.
|
||||
pref("snav.enabled", false);
|
||||
|
||||
// Wakelock is disabled by default.
|
||||
pref("dom.wakelock.enabled", false);
|
||||
|
Loading…
Reference in New Issue
Block a user