Skip to content

Commit 8732222

Browse files
committed
[UX] Fixed prompt window leaks (tor-browser#43281).
1 parent 57d8d73 commit 8732222

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ui/prompt.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,20 @@
2626
window.close();
2727
return;
2828
}
29-
let done = () => {
29+
30+
let done = async () => {
3031
Messages.send("promptDone", data);
32+
done = () => {};
33+
if ("windows" in browser) {
34+
try {
35+
await browser.windows.remove((await browser.windows.getCurrent()).id);
36+
} catch (e) {
37+
console.error(e);
38+
}
39+
}
40+
window.close();
3141
}
42+
3243
let {title, message, options, checks, buttons} = data.features;
3344

3445
function labelFor(el, text) {
@@ -97,7 +108,7 @@
97108
renderInputs("#options", options, "radio", "opt");
98109
renderInputs("#checks", checks, "checkbox", "flag");
99110
renderInputs("#buttons", buttons, "button", "button");
100-
addEventListener("unload", e => {
111+
addEventListener("hide", e => {
101112
done();
102113
});
103114

0 commit comments

Comments
 (0)