Bug 1627817 - Make sure to fire fullscreen-painted notification when transitioning PiP player window in and out of fullscreen. r=mstriemer

The DOMFullscreen JSWindowActors, which normally handle this sort of thing,
don't get instantiated for events that fire for a parent process DOM Window.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2020-04-13 20:31:49 +00:00
Родитель c0d3605505
Коммит cc459dbad6
1 изменённых файлов: 24 добавлений и 0 удалений

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

@ -68,6 +68,8 @@ let Player = {
"dblclick",
"keydown",
"mouseout",
"MozDOMFullscreen:Entered",
"MozDOMFullscreen:Exited",
"resize",
"unload",
],
@ -208,6 +210,28 @@ let Player = {
break;
}
// Normally, the DOMFullscreenParent / DOMFullscreenChild actors
// would take care of firing the `fullscreen-painted` notification,
// however, those actors are only ever instantiated when a <browser>
// is fullscreened, and not a <body> element in a parent-process
// chrome privileged DOM window.
//
// Rather than trying to re-engineer JSWindowActors to be re-usable for
// this edge-case, we do the work of firing fullscreen-painted when
// transitioning in and out of fullscreen ourselves here.
case "MozDOMFullscreen:Entered":
// Intentional fall-through
case "MozDOMFullscreen:Exited": {
let { lastTransactionId } = window.windowUtils;
window.addEventListener("MozAfterPaint", function onPainted(event) {
if (event.transactionId > lastTransactionId) {
window.removeEventListener("MozAfterPaint", onPainted);
Services.obs.notifyObservers(window, "fullscreen-painted");
}
});
break;
}
case "oop-browser-crashed": {
PictureInPicture.closePipWindow({ reason: "browser-crash" });
break;