richard pushed to branch tor-browser-115.2.0esr-13.0-1 at The Tor Project / Applications / Tor Browser
Commits: e35aaaa8 by Henry Wilkes at 2023-08-24T20:21:48+00:00 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
Bug 42047: Remove sizing hacks for tor dialogs. We can just wait until DOMContentLoaded to call _populateXUL. Then the subDialog code will take care of the sizing for us.
- - - - -
13 changed files:
- browser/components/torpreferences/content/bridgeQrDialog.jsm - browser/components/torpreferences/content/bridgeQrDialog.xhtml - browser/components/torpreferences/content/builtinBridgeDialog.jsm - browser/components/torpreferences/content/builtinBridgeDialog.xhtml - browser/components/torpreferences/content/connectionSettingsDialog.jsm - browser/components/torpreferences/content/connectionSettingsDialog.xhtml - browser/components/torpreferences/content/provideBridgeDialog.jsm - browser/components/torpreferences/content/provideBridgeDialog.xhtml - browser/components/torpreferences/content/requestBridgeDialog.jsm - browser/components/torpreferences/content/requestBridgeDialog.xhtml - browser/components/torpreferences/content/torLogDialog.jsm - browser/components/torpreferences/content/torLogDialog.xhtml - browser/components/torpreferences/content/torPreferences.css
Changes:
===================================== browser/components/torpreferences/content/bridgeQrDialog.jsm ===================================== @@ -34,10 +34,7 @@ class BridgeQrDialog { }
init(window, dialog) { - // Defer to later until Firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(window, dialog); - }, 0); + this._populateXUL(window, dialog); }
openDialog(gSubDialog, bridgeString) {
===================================== browser/components/torpreferences/content/bridgeQrDialog.xhtml ===================================== @@ -21,8 +21,10 @@ "use strict";
let dialogObject = window.arguments[0]; - let dialogElement = document.getElementById("bridgeQr-dialog"); - dialogObject.init(window, dialogElement); + document.addEventListener("DOMContentLoaded", () => { + let dialogElement = document.getElementById("bridgeQr-dialog"); + dialogObject.init(window, dialogElement); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/builtinBridgeDialog.jsm ===================================== @@ -95,10 +95,6 @@ class BuiltinBridgeDialog { ); });
- // Hack: see the CSS - dialog.style.minWidth = "0"; - dialog.style.minHeight = "0"; - this._acceptButton = dialog.getButton("accept");
Services.obs.addObserver(this, TorConnectTopics.StateChange); @@ -129,10 +125,7 @@ class BuiltinBridgeDialog { }
init(window, aDialog) { - // defer to later until firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(window, aDialog); - }, 0); + this._populateXUL(window, aDialog); }
close() {
===================================== browser/components/torpreferences/content/builtinBridgeDialog.xhtml ===================================== @@ -83,8 +83,10 @@ "use strict";
let builtinBridgeDialog = window.arguments[0]; - let dialog = document.getElementById("torPreferences-builtinBridge-dialog"); - builtinBridgeDialog.init(window, dialog); + document.addEventListener("DOMContentLoaded", () => { + let dialog = document.getElementById("torPreferences-builtinBridge-dialog"); + builtinBridgeDialog.init(window, dialog); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/connectionSettingsDialog.jsm ===================================== @@ -213,10 +213,6 @@ class ConnectionSettingsDialog { this._dialog.addEventListener("dialogaccept", e => { this._applySettings(); }); - - // Hack: see the CSS - this._dialog.style.minWidth = "0"; - this._dialog.style.minHeight = "0"; }
// callback when proxy is toggled @@ -380,10 +376,7 @@ class ConnectionSettingsDialog { }
init(window, aDialog) { - // defer to later until firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(window, aDialog); - }, 0); + this._populateXUL(window, aDialog); }
openDialog(gSubDialog) {
===================================== browser/components/torpreferences/content/connectionSettingsDialog.xhtml ===================================== @@ -83,8 +83,10 @@ "use strict";
let connectionSettingsDialog = window.arguments[0]; - let dialog = document.getElementById("torPreferences-connection-dialog"); - connectionSettingsDialog.init(window, dialog); + document.addEventListener("DOMContentLoaded", () => { + let dialog = document.getElementById("torPreferences-connection-dialog"); + connectionSettingsDialog.init(window, dialog); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/provideBridgeDialog.jsm ===================================== @@ -99,10 +99,7 @@ class ProvideBridgeDialog { }
init(window, aDialog) { - // defer to later until firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(window, aDialog); - }, 0); + this._populateXUL(window, aDialog); }
close() {
===================================== browser/components/torpreferences/content/provideBridgeDialog.xhtml ===================================== @@ -24,8 +24,10 @@ "use strict";
let provideBridgeDialog = window.arguments[0]; - let dialog = document.getElementById("torPreferences-provideBridge-dialog"); - provideBridgeDialog.init(window, dialog); + document.addEventListener("DOMContentLoaded", () => { + let dialog = document.getElementById("torPreferences-provideBridge-dialog"); + provideBridgeDialog.init(window, dialog); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/requestBridgeDialog.jsm ===================================== @@ -157,10 +157,7 @@ class RequestBridgeDialog { }
init(window, dialog) { - // defer to later until firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(window, dialog); - }, 0); + this._populateXUL(window, dialog); }
close() {
===================================== browser/components/torpreferences/content/requestBridgeDialog.xhtml ===================================== @@ -35,8 +35,10 @@ "use strict";
let requestBridgeDialog = window.arguments[0]; - let dialog = document.getElementById("torPreferences-requestBridge-dialog"); - requestBridgeDialog.init(window, dialog); + document.addEventListener("DOMContentLoaded", () => { + let dialog = document.getElementById("torPreferences-requestBridge-dialog"); + requestBridgeDialog.init(window, dialog); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/torLogDialog.jsm ===================================== @@ -60,10 +60,7 @@ class TorLogDialog { }
init(window, aDialog) { - // defer to later until firefox has populated the dialog with all our elements - window.setTimeout(() => { - this._populateXUL(aDialog); - }, 0); + this._populateXUL(aDialog); }
copyTorLog() {
===================================== browser/components/torpreferences/content/torLogDialog.xhtml ===================================== @@ -19,8 +19,10 @@ "use strict";
let torLogDialog = window.arguments[0]; - let dialog = document.getElementById("torPreferences-torLog-dialog"); - torLogDialog.init(window, dialog); + document.addEventListener("DOMContentLoaded", () => { + let dialog = document.getElementById("torPreferences-torLog-dialog"); + torLogDialog.init(window, dialog); + }); ]]> </script> </dialog>
===================================== browser/components/torpreferences/content/torPreferences.css ===================================== @@ -441,22 +441,6 @@ dialog#torPreferences-requestBridge-dialog > hbox { }
/* Builtin bridge dialog */ -#torPreferences-builtinBridge-dialog { - /* Hack: ask XUL to load with a lot of space, then we will remove the minimum - sizes after we populate the string. Users with high resolutions should see a - big dialog, but with all the needed buttons, users with small resolutions - should see scrollbars. - Known problems: - 1) the hack works only if a window is *already* small: if it is big, and then - it is resized, the dialog will not shrink; - 2) horizontal scrollbars are never added. - The proper solution for this will be loading the localized string with - Mozilla's way. - See also https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/41044 */ - min-width: 700px; - min-height: 550px; -} - #torPreferences-builtinBridge-header { margin: 8px 0 10px 0; } @@ -504,12 +488,6 @@ groupbox#torPreferences-bridges-group textarea { }
/* Connection settings dialog */ -#torPreferences-connection-dialog { - /* Hack: like the built-in dialog */ - min-width: 700px; - min-height: 550px; -} - #torPreferences-connection-header { margin: 4px 0 14px 0; }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/e35aaaa8...