Bug 1952343 - [about:memory] Wait for document to regain focus before reopening the file picker; r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D241441
This commit is contained in:
Edgar Chen
2025-03-14 19:55:01 +00:00
parent 23e0512adc
commit fd59d6a4dd

View File

@@ -327,13 +327,24 @@ window.onload = function () {
// onchange handler to be re-called without having to go via the file
// picker.
if (!aElem.skipClick) {
// Attempts to reopen the picker immediately might fail because the
// focus may not have switched back on some platform, so explicitly
// wait for focus here.
if (!this.ownerDocument.hasFocus()) {
let input = this;
this.ownerDocument.addEventListener("focus", (e) => {
input.click();
}, { once: true });
return;
}
this.click();
}
} else {
let filename1 = this.filename1;
delete this.filename1;
updateAboutMemoryFromTwoFiles(filename1, file.mozFullPath);
return;
}
let filename1 = this.filename1;
delete this.filename1;
updateAboutMemoryFromTwoFiles(filename1, file.mozFullPath);
}
);