Bug 1926815 Remove inline event handler from fullscreen warning notification r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D226811
This commit is contained in:
Simon Friedberger 2024-10-28 10:15:35 +00:00
parent 99b0c1dcb4
commit 00c09d178a
2 changed files with 6 additions and 1 deletions

View File

@ -305,6 +305,11 @@ var FullScreen = {
"permissions.fullscreen.allowed"
);
let notificationExitButton = document.getElementById(
"fullscreen-exit-button"
);
notificationExitButton.addEventListener("click", this.exitDomFullScreen);
// Called when the Firefox window go into fullscreen.
addEventListener("fullscreen", this, true);
@ -400,6 +405,7 @@ var FullScreen = {
},
exitDomFullScreen() {
// Don't use `this` here. It does not reliably refer to this object.
if (document.fullscreen) {
document.exitFullscreen();
}

View File

@ -10,7 +10,6 @@
<html:div class="pointerlockfswarning-generic-text"
data-l10n-id="fullscreen-warning-no-domain"></html:div>
<html:button id="fullscreen-exit-button"
onclick="FullScreen.exitDomFullScreen();"
#ifdef XP_MACOSX
data-l10n-id="fullscreen-exit-mac-button"
#else