Bug 1866100 - improve PromptUtils activeness handling, a=RyanVM

Original Revision: https://phabricator.services.mozilla.com/D200165

Differential Revision: https://phabricator.services.mozilla.com/D206619
This commit is contained in:
Gijs Kruitbosch 2024-04-04 13:37:42 +00:00
parent ec8eff915d
commit 4941720136

View File

@ -76,6 +76,12 @@ export var EnableDelayHelper = function ({
this.focusTarget.addEventListener("keydown", this, true);
this.focusTarget.document.addEventListener("unload", this);
// If we're not part of the active window, don't even start the timer yet.
let topWin = focusTarget.browsingContext.top.window;
if (topWin != Services.focus.activeWindow) {
return;
}
this.startOnFocusDelay();
};