diff options
author | hackademix | 2019-08-02 19:13:26 +0200 |
---|---|---|
committer | hackademix | 2019-08-02 19:13:26 +0200 |
commit | b56061943c461ac3804ef6eba0e4de808ee91dd3 (patch) | |
tree | 6aa8a57c7901bf9586796ec21ebd3d2716d31733 | |
parent | e45dfdcf2f662b6c0d26c00e3bfe56abd3797e5a (diff) | |
download | noscript-b56061943c461ac3804ef6eba0e4de808ee91dd3.tar.gz noscript-b56061943c461ac3804ef6eba0e4de808ee91dd3.tar.xz noscript-b56061943c461ac3804ef6eba0e4de808ee91dd3.zip |
[Tor] Work-around for prompts being huge when resistFingerprinting is enabled.
-rw-r--r-- | src/ui/Prompts.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/Prompts.js b/src/ui/Prompts.js index ed83ac2..439fbf0 100644 --- a/src/ui/Prompts.js +++ b/src/ui/Prompts.js @@ -7,16 +7,26 @@ var Prompts = (() => { async open(data) { promptData = data; this.close(); + let {width, height} = data.features; let options = { url: browser.extension.getURL("ui/prompt.html"), type: "panel", - width: data.features.width, - height: data.features.height, + width, + height, }; if (UA.isMozilla) { options.allowScriptsToClose = true; } this.currentWindow = await browser.windows.create(options); + // work around for https://bugzilla.mozilla.org/show_bug.cgi?id=1330882 + let {left, top, width: cw, height: ch} = this.currentWindow; + if (width && height && cw !== width || ch !== height) { + left += Math.round((cw - width) / 2); + top += Math.round((ch - height) / 2); + for (let attempts = 2; attempts-- > 0;) // top gets set only 2nd time, moz bug? + await browser.windows.update(this.currentWindow.id, + {left, top, width, height}); + } } async close() { if (this.currentWindow) { @@ -55,6 +65,7 @@ var Prompts = (() => { multiple: "close", // or "queue", or "focus" width: 400, height: 300, + alwaysOnTop: true, }, async prompt(features) { features = Object.assign({}, this.DEFAULTS, features || {}); |