Bug 1611021 - part1 : add a method in special power to generate media control key events. r=bzbarsky

It allows us to simulate media control key events in non-privileged context, such as a mochitest running in content process.

Differential Revision: https://phabricator.services.mozilla.com/D60783

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2020-01-23 03:26:39 +00:00
Родитель 095171a2ea
Коммит 6f60b210f6
2 изменённых файлов: 9 добавлений и 0 удалений

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

@ -1293,6 +1293,10 @@ class SpecialPowersChild extends JSWindowActorChild {
);
}
async generateMediaControlKeyTestEvent(event) {
await this.sendQuery("SPGenerateMediaControlKeyTestEvent", { event });
}
// Note: each call to registerConsoleListener MUST be paired with a
// call to postConsoleSentinel; when the callback receives the
// sentinel it will unregister itself (_after_ calling the

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

@ -1095,6 +1095,11 @@ class SpecialPowersParent extends JSWindowActorParent {
return ServiceWorkerCleanUp.removeFromHost("example.com");
}
case "SPGenerateMediaControlKeyTestEvent": {
ChromeUtils.generateMediaControlKeysTestEvent(aMessage.data.event);
return undefined;
}
default:
throw new SpecialPowersError(
`Unrecognized Special Powers API: ${aMessage.name}`