Bug 1704500: Test Windows geolocation utility process restart on crash r=gerard-majax

Make sure that the geolocation utility process restarts for georequests that arrive after a crash. This tests process behavior regardless of whether or not the OS is set to allow geolocation (and in automation, it is not).

Depends on D162944

Differential Revision: https://phabricator.services.mozilla.com/D162945
This commit is contained in:
David Parks 2023-01-25 02:48:58 +00:00
Родитель 440a5789f6
Коммит 620c02a682
2 изменённых файлов: 72 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,8 @@ skip-if =
skip-if =
!crashreporter
ccov
[browser_utility_geolocation_crashed.js]
skip-if = !(os == 'win' && os_version == '10.0') # Geolocation is remoted only on Windows 8+
[browser_utility_hard_kill.js]
[browser_utility_hard_kill_delayed.js] # bug 1754572: we really want hard_kill to be rust before hard_kill_delayed
[browser_utility_memoryReport.js]

Просмотреть файл

@ -0,0 +1,70 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
async function getGeolocation() {
info("Requesting geolocation");
let resolve;
let promise = new Promise((_resolve, _reject) => {
resolve = _resolve;
});
navigator.geolocation.getCurrentPosition(
() => {
ok(true, "geolocation succeeded");
resolve(undefined);
},
() => {
ok(false, "geolocation failed");
resolve(undefined);
}
);
return promise;
}
add_setup(async function() {
// Avoid the permission doorhanger and cache that would trigger instead
// of re-requesting location. Setting geo.timeout to 0 causes it to
// retry the system geolocation (incl. recreating the utility process)
// instead of reusing the MLS geolocation fallback it found the first time.
await SpecialPowers.pushPrefEnv({
set: [
["geo.prompt.testing", true],
["geo.prompt.testing.allow", true],
["geo.provider.network.debug.requestCache.enabled", false],
["geo.provider.testing", false],
["geo.timeout", 0],
],
});
});
add_task(async function testGeolocationProcessCrash() {
info("Start the Windows utility process");
await getGeolocation();
info("Crash the utility process");
await crashSomeUtilityActor("windowsUtils");
info("Restart the Windows utility process");
await getGeolocation();
info("Confirm the restarted process");
await checkUtilityExists("windowsUtils");
info("Kill the utility process");
await cleanUtilityProcessShutdown("windowsUtils", true);
info("Restart the Windows utility process again");
await getGeolocation();
info("Confirm the restarted process");
await checkUtilityExists("windowsUtils");
});
add_task(async function testCleanup() {
info("Clean up to avoid confusing future tests");
await cleanUtilityProcessShutdown("windowsUtils", true);
});