Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
285a88a1 by Pier Angelo Vendrame at 2023-03-29T19:46:17+02:00
fixup! Bug 31740: Remove some unnecessary RemoteSettings instances
Bug 41704: Immediately return on remoteSettings.pollChanges
- - - - -
2 changed files:
- services/settings/remote-settings.js
- services/settings/servicesSettings.manifest
Changes:
=====================================
services/settings/remote-settings.js
=====================================
@@ -200,12 +200,17 @@ function remoteSettingsFunction() {
full = false,
} = {}) => {
// When running in full mode, we ignore last polling status.
- if (full) {
+ if (full || AppConstants.BASE_BROWSER_VERSION) {
gPrefs.clearUserPref(PREF_SETTINGS_SERVER_BACKOFF);
gPrefs.clearUserPref(PREF_SETTINGS_LAST_UPDATE);
gPrefs.clearUserPref(PREF_SETTINGS_LAST_ETAG);
}
+ if (AppConstants.BASE_BROWSER_VERSION) {
+ // tor-browser#41704: pollChanges is always online, so do not allow it.
+ return;
+ }
+
let pollTelemetryArgs = {
source: TELEMETRY_SOURCE_POLL,
trigger,
=====================================
services/settings/servicesSettings.manifest
=====================================
@@ -4,4 +4,4 @@ resource services-settings resource://gre/modules/services-settings/
# Schedule polling of remote settings changes
# (default 24H, max 72H)
# see syntax https://searchfox.org/mozilla-central/rev/cc280c4be94ff8cf64a27cc9b3d6831ff…
-category update-timer RemoteSettingsComponents @mozilla.org/services/settings;1,getService,services-settings-poll-changes,services.settings.poll_interval,86400,259200
+# category update-timer RemoteSettingsComponents @mozilla.org/services/settings;1,getService,services-settings-poll-changes,services.settings.poll_interval,86400,259200
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/285a88a…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/285a88a…
You're receiving this email because of your account on gitlab.torproject.org.
Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
0a920be1 by Pier Angelo Vendrame at 2023-03-29T17:47:40+02:00
fixup! Add TorStrings module for localization
Restore the letterbox warning for 12.0
- - - - -
1 changed file:
- toolkit/torbutton/chrome/locale/en-US/torbutton.properties
Changes:
=====================================
toolkit/torbutton/chrome/locale/en-US/torbutton.properties
=====================================
@@ -115,3 +115,8 @@ torbutton.popup.no_newnym = Torbutton cannot safely give you a new identity. It
# Preferences for mobile: these strings are still referenced, but we should
# check whether this feature is still used
torbutton.security_settings.menu.title = Security Settings
+
+# The notification that appears when maximizing the browser with letterboxing disabled
+# TODO: This string is not needed as of 12.5a5, and has a replacement in Base Browser!
+# To be removed when 12.0 will not need new updates.
+torbutton.maximize_warning = Maximizing Tor Browser can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave Tor Browser windows in their original default size.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0a920be…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0a920be…
You're receiving this email because of your account on gitlab.torproject.org.
Pier Angelo Vendrame pushed to branch base-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
2ffae0ac by Pier Angelo Vendrame at 2023-03-29T16:58:54+02:00
fixup! Bug 41695: Warn on window maximization without letterboxing in RFPHelper module
Bug 41698
- - - - -
59f56195 by Pier Angelo Vendrame at 2023-03-29T16:58:55+02:00
fixup! Bug 41369: Improve Firefox language settings for multi-lingual packages
Bug 41698: Reword the recommendation badges in about:addons
We need to add a new commit for all base browser strings
- - - - -
6f98fb4c by Pier Angelo Vendrame at 2023-03-29T16:58:55+02:00
Base Browser strings
This commit adds all the strings needed by following Base Browser
patches.
- - - - -
a825810a by Pier Angelo Vendrame at 2023-03-29T16:58:55+02:00
Bug 41698: Reword the recommendation badges in about:addons
Firefox strings use { -brand-product-name }.
As a result, it seems that the fork is recommending extensions, whereas
AMO curators are doing that.
So, we replace the strings with custom ones that clarify that Mozilla is
recommending them.
We assign the strings with JS because our translation backend does not
support Fluent attributes, yet, but once it does, we should switch to
them, instead.
Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1825033
- - - - -
3 changed files:
- browser/locales/en-US/browser/languageNotification.ftl
- toolkit/mozapps/extensions/content/aboutaddons.html
- toolkit/mozapps/extensions/content/aboutaddons.js
Changes:
=====================================
browser/locales/en-US/browser/languageNotification.ftl
=====================================
@@ -2,6 +2,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# These strings are used by the Base Browser part of the changeset, not only for
+# the language notification.
+# TODO: Rename this file to make this clearer
+
+
+## Language notification
+
# $language is the language Tor Browser is displayed in (already translated)
language-notification-label-system = { -brand-short-name } has set your display language to { $language } based on your system’s language.
# This is shown when the system language is not supported, so we fall back to another language instead.
@@ -9,6 +16,15 @@ language-notification-label-system = { -brand-short-name } has set your display
language-notification-label = { -brand-short-name } has set your display language to { $language }.
language-notification-button = Change Language…
+
+## Fullscreen/maximization notification shown when letterboxing is disabled
+
basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size.
basebrowser-rfp-restore-window-size-button-label = Restore
basebrowser-rfp-restore-window-size-button-ak = R
+
+
+## Tooltip for the about:addons recommended badge
+
+basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance
+basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance
=====================================
toolkit/mozapps/extensions/content/aboutaddons.html
=====================================
@@ -24,6 +24,8 @@
<link rel="localization" href="toolkit/about/aboutAddons.ftl">
<link rel="localization" href="toolkit/about/abuseReports.ftl">
+ <link rel="localization" href="browser/languageNotification.ftl"/>
+
<!-- Defer scripts so all the templates are loaded by the time they run. -->
<script defer src="chrome://mozapps/content/extensions/aboutaddonsCommon.js"></script>
<script defer src="chrome://mozapps/content/extensions/abuse-reports.js"></script>
@@ -153,7 +155,6 @@
is="support-link"
support-page="add-on-badges"
utmcontent="promoted-addon-badge"
- data-l10n-id="addon-badge-recommended2"
hidden>
</a>
<a class="addon-badge addon-badge-line"
@@ -167,7 +168,6 @@
is="support-link"
support-page="add-on-badges"
utmcontent="promoted-addon-badge"
- data-l10n-id="addon-badge-verified2"
hidden>
</a>
<a class="addon-badge addon-badge-private-browsing-allowed"
=====================================
toolkit/mozapps/extensions/content/aboutaddons.js
=====================================
@@ -4885,6 +4885,29 @@ async function initialize() {
);
}
}
+
+ // At the moment we need to do this, because Weblate still does not support
+ // attributes in Fluent.
+ const [recommended, verified] = await document.l10n.formatValues([
+ { id: "basebrowser-addon-badge-recommended" },
+ { id: "basebrowser-addon-badge-verified" },
+ ]);
+
+ importTemplate("card");
+ _templates.card.content
+ .querySelector(".addon-badge-recommended")
+ .setAttribute("title", recommended);
+ _templates.card.content
+ .querySelector(".addon-badge-verified")
+ .setAttribute("title", verified);
+
+ // We also update any template copy that has already been created.
+ for (const badge of document.querySelectorAll(".addon-badge-recommended")) {
+ badge.setAttribute("title", recommended);
+ }
+ for (const badge of document.querySelectorAll(".addon-badge-verified")) {
+ badge.setAttribute("title", verified);
+ }
}
window.promiseInitialized = new Promise(resolve => {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/9e31ce…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/9e31ce…
You're receiving this email because of your account on gitlab.torproject.org.
Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
9b87c73a by Pier Angelo Vendrame at 2023-03-29T16:56:32+02:00
fixup! Bug 41695: Warn on window maximization without letterboxing in RFPHelper module
Bug 41698
- - - - -
071ef206 by Pier Angelo Vendrame at 2023-03-29T16:56:49+02:00
fixup! Bug 41369: Improve Firefox language settings for multi-lingual packages
Bug 41698: Reword the recommendation badges in about:addons
We need to add a new commit for all base browser strings
- - - - -
35133d69 by Pier Angelo Vendrame at 2023-03-29T16:56:49+02:00
Base Browser strings
This commit adds all the strings needed by following Base Browser
patches.
- - - - -
663cd8e2 by Pier Angelo Vendrame at 2023-03-29T16:56:50+02:00
Bug 41698: Reword the recommendation badges in about:addons
Firefox strings use { -brand-product-name }.
As a result, it seems that the fork is recommending extensions, whereas
AMO curators are doing that.
So, we replace the strings with custom ones that clarify that Mozilla is
recommending them.
We assign the strings with JS because our translation backend does not
support Fluent attributes, yet, but once it does, we should switch to
them, instead.
Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1825033
- - - - -
3 changed files:
- browser/locales/en-US/browser/languageNotification.ftl
- toolkit/mozapps/extensions/content/aboutaddons.html
- toolkit/mozapps/extensions/content/aboutaddons.js
Changes:
=====================================
browser/locales/en-US/browser/languageNotification.ftl
=====================================
@@ -2,6 +2,13 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# These strings are used by the Base Browser part of the changeset, not only for
+# the language notification.
+# TODO: Rename this file to make this clearer
+
+
+## Language notification
+
# $language is the language Tor Browser is displayed in (already translated)
language-notification-label-system = { -brand-short-name } has set your display language to { $language } based on your system’s language.
# This is shown when the system language is not supported, so we fall back to another language instead.
@@ -9,6 +16,15 @@ language-notification-label-system = { -brand-short-name } has set your display
language-notification-label = { -brand-short-name } has set your display language to { $language }.
language-notification-button = Change Language…
+
+## Fullscreen/maximization notification shown when letterboxing is disabled
+
basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size.
basebrowser-rfp-restore-window-size-button-label = Restore
basebrowser-rfp-restore-window-size-button-ak = R
+
+
+## Tooltip for the about:addons recommended badge
+
+basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance
+basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance
=====================================
toolkit/mozapps/extensions/content/aboutaddons.html
=====================================
@@ -24,6 +24,8 @@
<link rel="localization" href="toolkit/about/aboutAddons.ftl">
<link rel="localization" href="toolkit/about/abuseReports.ftl">
+ <link rel="localization" href="browser/languageNotification.ftl"/>
+
<!-- Defer scripts so all the templates are loaded by the time they run. -->
<script defer src="chrome://mozapps/content/extensions/aboutaddonsCommon.js"></script>
<script defer src="chrome://mozapps/content/extensions/abuse-reports.js"></script>
@@ -153,7 +155,6 @@
is="support-link"
support-page="add-on-badges"
utmcontent="promoted-addon-badge"
- data-l10n-id="addon-badge-recommended2"
hidden>
</a>
<a class="addon-badge addon-badge-line"
@@ -167,7 +168,6 @@
is="support-link"
support-page="add-on-badges"
utmcontent="promoted-addon-badge"
- data-l10n-id="addon-badge-verified2"
hidden>
</a>
<a class="addon-badge addon-badge-private-browsing-allowed"
=====================================
toolkit/mozapps/extensions/content/aboutaddons.js
=====================================
@@ -4885,6 +4885,29 @@ async function initialize() {
);
}
}
+
+ // At the moment we need to do this, because Weblate still does not support
+ // attributes in Fluent.
+ const [recommended, verified] = await document.l10n.formatValues([
+ { id: "basebrowser-addon-badge-recommended" },
+ { id: "basebrowser-addon-badge-verified" },
+ ]);
+
+ importTemplate("card");
+ _templates.card.content
+ .querySelector(".addon-badge-recommended")
+ .setAttribute("title", recommended);
+ _templates.card.content
+ .querySelector(".addon-badge-verified")
+ .setAttribute("title", verified);
+
+ // We also update any template copy that has already been created.
+ for (const badge of document.querySelectorAll(".addon-badge-recommended")) {
+ badge.setAttribute("title", recommended);
+ }
+ for (const badge of document.querySelectorAll(".addon-badge-verified")) {
+ badge.setAttribute("title", verified);
+ }
}
window.promiseInitialized = new Promise(resolve => {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5a1faa…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/5a1faa…
You're receiving this email because of your account on gitlab.torproject.org.
Richard Pospesel pushed to branch base-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
f23c4fda by Richard Pospesel at 2023-03-29T11:38:31+00:00
fixup! Firefox preference overrides.
Bug 41701: Reporting an extension does not work
- - - - -
1 changed file:
- browser/app/profile/001-base-profile.js
Changes:
=====================================
browser/app/profile/001-base-profile.js
=====================================
@@ -452,6 +452,9 @@ pref("browser.discovery.enabled", false);
pref("extensions.webextensions.restrictedDomains", "");
// Don't give Mozilla-recommended third-party extensions special privileges.
pref("extensions.postDownloadThirdPartyPrompt", false);
+// tor-browser#41701: Reporting an extension does not work
+// disable extension reporting since the request goes to Mozilla and is rejected anyway (HTTP 400)
+pref("extensions.abuseReport.enabled", false);
// We are already providing the languages we support in multi-lingual packages.
// Therefore, do not allow download of additional language packs. They are not a
// privacy/security threat, we are disabling them for UX reasons. See bug 41377.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f23c4fd…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/f23c4fd…
You're receiving this email because of your account on gitlab.torproject.org.
Richard Pospesel pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
5a1faa00 by Richard Pospesel at 2023-03-29T11:35:07+00:00
fixup! Firefox preference overrides.
Bug 41701: Reporting an extension does not work
- - - - -
1 changed file:
- browser/app/profile/001-base-profile.js
Changes:
=====================================
browser/app/profile/001-base-profile.js
=====================================
@@ -448,6 +448,9 @@ pref("browser.discovery.enabled", false);
pref("extensions.webextensions.restrictedDomains", "");
// Don't give Mozilla-recommended third-party extensions special privileges.
pref("extensions.postDownloadThirdPartyPrompt", false);
+// tor-browser#41701: Reporting an extension does not work
+// disable extension reporting since the request goes to Mozilla and is rejected anyway (HTTP 400)
+pref("extensions.abuseReport.enabled", false);
// We are already providing the languages we support in multi-lingual packages.
// Therefore, do not allow download of additional language packs. They are not a
// privacy/security threat, we are disabling them for UX reasons. See bug 41377.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5a1faa0…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/5a1faa0…
You're receiving this email because of your account on gitlab.torproject.org.
Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
db5d0d31 by hackademix at 2023-03-29T12:33:11+02:00
fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser
- - - - -
1 changed file:
- browser/components/torconnect/content/torconnect-urlbar.inc.xhtml
Changes:
=====================================
browser/components/torconnect/content/torconnect-urlbar.inc.xhtml
=====================================
@@ -3,6 +3,7 @@
<hbox id="torconnect-box"
class="urlbar-icon-wrapper urlbar-page-action"
role="status"
+ align="center"
hidden="true">
<hbox id="torconnect-container">
<label id="torconnect-label"/>
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/db5d0d3…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/db5d0d3…
You're receiving this email because of your account on gitlab.torproject.org.
Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser
Commits:
16c5a240 by hackademix at 2023-03-28T22:53:50+02:00
Bug 41631: Prevent weird initial window dimensions caused by subpixel computations
- - - - -
1d0cc334 by hackademix at 2023-03-28T23:30:47+02:00
fixup! Bug 10760: Integrate TorButton to TorBrowser core
- - - - -
e32a6cd3 by hackademix at 2023-03-28T23:33:12+02:00
fixup! Bug 40562: Added Tor Browser preferences to 000-tor-browser.js
- - - - -
be88af1c by hackademix at 2023-03-29T09:52:37+02:00
Bug 41695: Warn on window maximization without letterboxing in RFPHelper module
- - - - -
5 changed files:
- browser/app/profile/000-tor-browser.js
- browser/locales/en-US/browser/languageNotification.ftl
- toolkit/components/resistfingerprinting/RFPHelper.jsm
- toolkit/torbutton/chrome/content/torbutton.js
- toolkit/torbutton/chrome/locale/en-US/torbutton.properties
Changes:
=====================================
browser/app/profile/000-tor-browser.js
=====================================
@@ -65,11 +65,6 @@ pref("extensions.torbutton.use_nontor_proxy", false);
// State prefs:
pref("extensions.torbutton.startup", false);
-// This is only used when letterboxing is disabled.
-// See #7255 for details. We display the warning three times to make sure the
-// user did not click on it by accident.
-pref("extensions.torbutton.maximize_warnings_remaining", 3);
-
// Security prefs:
pref("extensions.torbutton.resize_new_windows", false);
pref("extensions.torbutton.launch_warning", true);
=====================================
browser/locales/en-US/browser/languageNotification.ftl
=====================================
@@ -8,3 +8,7 @@ language-notification-label-system = { -brand-short-name } has set your display
# $language is the language Tor Browser is displayed in (already translated).
language-notification-label = { -brand-short-name } has set your display language to { $language }.
language-notification-button = Change Language…
+
+basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size.
+basebrowser-rfp-restore-window-size-button-label = Restore
+basebrowser-rfp-restore-window-size-button-ak = R
=====================================
toolkit/components/resistfingerprinting/RFPHelper.jsm
=====================================
@@ -22,16 +22,110 @@ const kPrefLetterboxingTesting =
"privacy.resistFingerprinting.letterboxing.testing";
const kTopicDOMWindowOpened = "domwindowopened";
-var logConsole;
-function log(msg) {
- if (!logConsole) {
- logConsole = console.createInstance({
- prefix: "RFPHelper.jsm",
- maxLogLevelPref: "privacy.resistFingerprinting.jsmloglevel",
- });
+const kPrefResizeWarnings = "privacy.resistFingerprinting.resizeWarnings";
+
+XPCOMUtils.defineLazyGetter(this, "logConsole", () =>
+ console.createInstance({
+ prefix: "RFPHelper.jsm",
+ maxLogLevelPref: "privacy.resistFingerprinting.jsmloglevel",
+ })
+);
+
+function log(...args) {
+ logConsole.log(...args);
+}
+
+function forEachWindow(callback) {
+ const windowList = Services.wm.getEnumerator("navigator:browser");
+ while (windowList.hasMoreElements()) {
+ const win = windowList.getNext();
+ if (win.gBrowser && !win.closed) {
+ try {
+ callback(win);
+ } catch (e) {
+ logConsole.error(e);
+ }
+ }
+ }
+}
+
+
+async function windowResizeHandler(aEvent) {
+ if (RFPHelper.letterboxingEnabled) {
+ return;
+ }
+ if (Services.prefs.getIntPref(kPrefResizeWarnings, 3) <= 0) {
+ return;
+ }
+
+ const window = aEvent.currentTarget;
+
+ // Wait for end of execution queue to ensure we have correct windowState.
+ await new Promise(resolve => window.setTimeout(resolve, 0));
+ switch (window.windowState) {
+ case window.STATE_MAXIMIZED:
+ case window.STATE_FULLSCREEN:
+ break;
+ default:
+ return;
+ }
+
+ // Do not add another notification if one is already showing.
+ const kNotificationName = "rfp-window-resize-notification";
+ let box = window.gNotificationBox;
+ if (box.getNotificationWithValue(kNotificationName)) {
+ return;
}
- logConsole.log(msg);
+ // Rate-limit showing our notification if needed.
+ if (Date.now() - (windowResizeHandler.timestamp || 0) < 1000) {
+ return;
+ }
+ windowResizeHandler.timestamp = Date.now();
+
+ const decreaseWarningsCount = () => {
+ const currentCount = Services.prefs.getIntPref(kPrefResizeWarnings);
+ if (currentCount > 0) {
+ Services.prefs.setIntPref(kPrefResizeWarnings, currentCount - 1);
+ }
+ };
+
+ const [label, accessKey] = await window.document.l10n.formatValues([
+ { id: "basebrowser-rfp-restore-window-size-button-label" },
+ { id: "basebrowser-rfp-restore-window-size-button-ak" },
+ ]);
+
+ const buttons = [
+ {
+ label,
+ accessKey,
+ popup: null,
+ callback() {
+ // reset notification timer to work-around resize race conditions
+ windowResizeHandler.timestamp = Date.now();
+ // restore the original (rounded) size we had stored on window startup
+ let { _rfpOriginalSize } = window;
+ window.setTimeout(() => {
+ window.resizeTo(_rfpOriginalSize.width, _rfpOriginalSize.height);
+ }, 0);
+ },
+ },
+ ];
+
+ box.appendNotification(
+ kNotificationName,
+ {
+ label: { "l10n-id": "basebrowser-rfp-maximize-warning-message" },
+ priority: box.PRIORITY_WARNING_LOW,
+ eventCallback(event) {
+ if (event === "dismissed") {
+ // user manually dismissed the notification
+ decreaseWarningsCount();
+ }
+ },
+ },
+ buttons
+ );
}
class _RFPHelper {
@@ -158,7 +252,11 @@ class _RFPHelper {
_handleResistFingerprintingChanged() {
if (Services.prefs.getBoolPref(kPrefResistFingerprinting)) {
this._addRFPObservers();
+ Services.ww.registerNotification(this);
+ forEachWindow(win => this._attachWindow(win));
} else {
+ forEachWindow(win => this._detachWindow(win));
+ Services.ww.unregisterNotification(this);
this._removeRFPObservers();
}
}
@@ -295,13 +393,11 @@ class _RFPHelper {
}
_handleLetterboxingPrefChanged() {
- if (Services.prefs.getBoolPref(kPrefLetterboxing, false)) {
- Services.ww.registerNotification(this);
- this._attachAllWindows();
- } else {
- this._detachAllWindows();
- Services.ww.unregisterNotification(this);
- }
+ this.letterboxingEnabled = Services.prefs.getBoolPref(
+ kPrefLetterboxing,
+ false
+ );
+ forEachWindow(win => this._updateSizeForTabsInWindow(win));
}
// The function to parse the dimension set from the pref value. The pref value
@@ -402,11 +498,13 @@ class _RFPHelper {
let logPrefix = `_roundContentSize[${Math.random()}]`;
log(logPrefix);
let win = aBrowser.ownerGlobal;
+
let browserContainer = aBrowser
.getTabBrowser()
.getBrowserContainer(aBrowser);
let browserParent = aBrowser.parentElement;
browserParent.classList.remove("exclude-letterboxing");
+
let [
[contentWidth, contentHeight],
[parentWidth, parentHeight],
@@ -419,6 +517,27 @@ class _RFPHelper {
])
);
+ if (
+ !win._rfpSizeOffset ||
+ (win._rfpOriginalSize &&
+ win.outerWidth === win._rfpOriginalSize.width &&
+ win.outerHeight === win._rfpOriginalSize.height)
+ ) {
+ const BASELINE_ROUNDING = 10;
+ const offset = s =>
+ s - Math.round(s / BASELINE_ROUNDING) * BASELINE_ROUNDING;
+
+ win._rfpSizeOffset = {
+ width: offset(parentWidth),
+ height: offset(parentHeight),
+ };
+ log(
+ `${logPrefix} Window size offsets %o (from %s, %s)`,
+ win._rfpSizeOffset,
+ parentWidth,
+ parentHeight
+ );
+ }
log(
`${logPrefix} contentWidth=${contentWidth} contentHeight=${contentHeight} parentWidth=${parentWidth} parentHeight=${parentHeight} containerWidth=${containerWidth} containerHeight=${containerHeight}${
isNewTab ? " (new tab)." : "."
@@ -437,6 +556,16 @@ class _RFPHelper {
});
let result;
+
+ if (!this.letterboxingEnabled) {
+ const offset = win._rfpSizeOffset;
+ result = r(aWidth - offset.width, aHeight - offset.height);
+ log(
+ `${logPrefix} Letterboxing disabled, applying baseline rounding offsets: (${aWidth}, ${aHeight}) => ${result.width} x ${result.height})`
+ );
+ return result;
+ }
+
log(`${logPrefix} roundDimensions(${aWidth}, ${aHeight})`);
// If the set is empty, we will round the content with the default
// stepping size.
@@ -554,7 +683,6 @@ class _RFPHelper {
_updateSizeForTabsInWindow(aWindow) {
let tabBrowser = aWindow.gBrowser;
-
tabBrowser.tabpanels?.classList.add("letterboxing");
for (let tab of tabBrowser.tabs) {
@@ -564,10 +692,18 @@ class _RFPHelper {
// we need to add this class late because otherwise new windows get maximized
aWindow.setTimeout(() => {
tabBrowser.tabpanels?.classList.add("letterboxing-ready");
+ if (!aWindow._rfpOriginalSize) {
+ aWindow._rfpOriginalSize = {
+ width: aWindow.outerWidth,
+ height: aWindow.outerHeight,
+ };
+ log("Recording original window size", aWindow._rfpOriginalSize);
+ }
});
}
_attachWindow(aWindow) {
+ aWindow.addEventListener("sizemodechange", windowResizeHandler);
aWindow.gBrowser.addTabsProgressListener(this);
aWindow.addEventListener("TabOpen", this);
const resizeObserver = (aWindow._rfpResizeObserver = new aWindow.ResizeObserver(
@@ -585,19 +721,7 @@ class _RFPHelper {
this._updateSizeForTabsInWindow(aWindow);
}
- _attachAllWindows() {
- let windowList = Services.wm.getEnumerator("navigator:browser");
- while (windowList.hasMoreElements()) {
- let win = windowList.getNext();
-
- if (win.closed || !win.gBrowser) {
- continue;
- }
-
- this._attachWindow(win);
- }
- }
_detachWindow(aWindow) {
let tabBrowser = aWindow.gBrowser;
@@ -614,20 +738,7 @@ class _RFPHelper {
let browser = tab.linkedBrowser;
this._resetContentSize(browser);
}
- }
-
- _detachAllWindows() {
- let windowList = Services.wm.getEnumerator("navigator:browser");
-
- while (windowList.hasMoreElements()) {
- let win = windowList.getNext();
-
- if (win.closed || !win.gBrowser) {
- continue;
- }
-
- this._detachWindow(win);
- }
+ aWindow.removeEventListener("sizemodechange", windowResizeHandler);
}
_handleDOMWindowOpened(win) {
=====================================
toolkit/torbutton/chrome/content/torbutton.js
=====================================
@@ -54,19 +54,12 @@ var torbutton_new_circuit;
m_tb_prefs.addObserver("extensions.torbutton", this);
m_tb_prefs.addObserver("browser.privatebrowsing.autostart", this);
m_tb_prefs.addObserver("javascript", this);
- m_tb_prefs.addObserver("privacy.resistFingerprinting", this);
- m_tb_prefs.addObserver("privacy.resistFingerprinting.letterboxing", this);
},
unregister() {
m_tb_prefs.removeObserver("extensions.torbutton", this);
m_tb_prefs.removeObserver("browser.privatebrowsing.autostart", this);
m_tb_prefs.removeObserver("javascript", this);
- m_tb_prefs.removeObserver("privacy.resistFingerprinting", this);
- m_tb_prefs.removeObserver(
- "privacy.resistFingerprinting.letterboxing",
- this
- );
},
// topic: what event occurred
@@ -83,10 +76,6 @@ var torbutton_new_circuit;
case "extensions.torbutton.use_nontor_proxy":
torbutton_use_nontor_proxy();
break;
- case "privacy.resistFingerprinting":
- case "privacy.resistFingerprinting.letterboxing":
- torbutton_update_fingerprinting_prefs();
- break;
}
},
};
@@ -666,21 +655,6 @@ var torbutton_new_circuit;
Services.prefs.savePrefFile(null);
}
- function torbutton_update_fingerprinting_prefs() {
- var mode = m_tb_prefs.getBoolPref("privacy.resistFingerprinting");
- var letterboxing = m_tb_prefs.getBoolPref(
- "privacy.resistFingerprinting.letterboxing",
- false
- );
- m_tb_prefs.setBoolPref(
- "extensions.torbutton.resize_new_windows",
- mode && !letterboxing
- );
-
- // Force prefs to be synced to disk
- Services.prefs.savePrefFile(null);
- }
-
// Bug 1506 P1: This function just cleans up prefs that got set badly in previous releases
function torbutton_fixup_old_prefs() {
if (m_tb_prefs.getIntPref("extensions.torbutton.pref_fixup_version") < 1) {
@@ -728,9 +702,6 @@ var torbutton_new_circuit;
// Bug 1506: Should probably be moved to an XPCOM component
torbutton_do_main_window_startup();
- // For charsets
- torbutton_update_fingerprinting_prefs();
-
// Bug 30565: sync browser.privatebrowsing.autostart with security.nocertdb
torbutton_update_disk_prefs();
@@ -741,46 +712,6 @@ var torbutton_new_circuit;
}
}
- // Bug 1506 P3: Used to decide if we should resize the window.
- //
- // Returns true if the window wind is neither maximized, full screen,
- // ratpoisioned/evilwmed, nor minimized.
- function torbutton_is_windowed(wind) {
- torbutton_log(
- 3,
- "Window: (" +
- wind.outerWidth +
- "," +
- wind.outerHeight +
- ") ?= (" +
- wind.screen.availWidth +
- "," +
- wind.screen.availHeight +
- ")"
- );
- if (
- wind.windowState == Ci.nsIDOMChromeWindow.STATE_MINIMIZED ||
- wind.windowState == Ci.nsIDOMChromeWindow.STATE_MAXIMIZED
- ) {
- torbutton_log(2, "Window is minimized/maximized");
- return false;
- }
- if ("fullScreen" in wind && wind.fullScreen) {
- torbutton_log(2, "Window is fullScreen");
- return false;
- }
- if (
- wind.outerHeight == wind.screen.availHeight &&
- wind.outerWidth == wind.screen.availWidth
- ) {
- torbutton_log(3, "Window is ratpoisoned/evilwm'ed");
- return false;
- }
-
- torbutton_log(2, "Window is normal");
- return true;
- }
-
// Bug 1506 P3: This is needed pretty much only for the window resizing.
// See comments for individual functions for details
function torbutton_new_window(event) {
@@ -797,17 +728,6 @@ var torbutton_new_circuit;
}
torbutton_do_startup();
-
- let progress = Cc["@mozilla.org/docloaderservice;1"].getService(
- Ci.nsIWebProgress
- );
-
- if (torbutton_is_windowed(window)) {
- progress.addProgressListener(
- torbutton_resizelistener,
- Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT
- );
- }
}
// Bug 1506 P2: This is only needed because we have observers
@@ -815,8 +735,6 @@ var torbutton_new_circuit;
function torbutton_close_window(event) {
torbutton_tor_check_observer.unregister();
- window.removeEventListener("sizemodechange", m_tb_resize_handler);
-
// TODO: This is a real ghetto hack.. When the original window
// closes, we need to find another window to handle observing
// unique events... The right way to do this is to move the
@@ -856,158 +774,4 @@ var torbutton_new_circuit;
window.addEventListener("load", torbutton_new_window);
window.addEventListener("unload", torbutton_close_window);
-
- var m_tb_resize_handler = null;
- var m_tb_resize_date = null;
-
- // Bug 1506 P1/P3: Setting a fixed window size is important, but
- // probably not for android.
- var torbutton_resizelistener = {
- QueryInterface: ChromeUtils.generateQI([
- "nsIWebProgressListener",
- "nsISupportsWeakReference",
- ]),
-
- onLocationChange(aProgress, aRequest, aURI) {},
- onStateChange(aProgress, aRequest, aFlag, aStatus) {
- if (aFlag & Ci.nsIWebProgressListener.STATE_STOP) {
- window.promiseDocumentFlushed(() => {
- // Here we're guaranteed to read the "final" (!) initial size, rather than [1, 1].
- torbutton_resizelistener.originalSize = {
- width: window.outerWidth,
- height: window.outerHeight,
- };
- });
- m_tb_resize_handler = async function() {
- // Wait for end of execution queue to ensure we have correct windowState.
- await new Promise(resolve => setTimeout(resolve, 0));
- if (
- window.windowState === window.STATE_MAXIMIZED ||
- window.windowState === window.STATE_FULLSCREEN
- ) {
- const kRemainingWarnings =
- "extensions.torbutton.maximize_warnings_remaining";
- if (
- Services.prefs.getBoolPref(
- "extensions.torbutton.resize_new_windows"
- ) &&
- Services.prefs.getIntPref(kRemainingWarnings) > 0
- ) {
- // Do not add another notification if one is already showing.
- const kNotificationName = "torbutton-maximize-notification";
-
- const box = gNotificationBox;
- if (box.getNotificationWithValue(kNotificationName)) {
- return;
- }
-
- // Rate-limit showing our notification if needed.
- if (m_tb_resize_date === null) {
- m_tb_resize_date = Date.now();
- } else {
- // We wait at least another second before we show a new
- // notification. Should be enough to rule out OSes that call our
- // handler rapidly due to internal workings.
- if (Date.now() - m_tb_resize_date < 1000) {
- return;
- }
- // Resizing but we need to reset |m_tb_resize_date| now.
- m_tb_resize_date = Date.now();
- }
-
- // No need to get "OK" translated again.
- const bundle = Services.strings.createBundle(
- "chrome://global/locale/commonDialogs.properties"
- );
-
- const decreaseWarningsCount = () => {
- const currentCount = Services.prefs.getIntPref(
- kRemainingWarnings
- );
- if (currentCount > 0) {
- Services.prefs.setIntPref(
- kRemainingWarnings,
- currentCount - 1
- );
- }
- };
-
- let buttons = [
- {
- label: bundle.GetStringFromName("OK"),
- accessKey: "O",
- popup: null,
- callback() {
- // reset notification timer to work-around resize race conditions
- m_tb_resize_date = Date.now();
- // restore the original (rounded) size we had stored on window startup
- let { originalSize } = torbutton_resizelistener;
- window.resizeTo(originalSize.width, originalSize.height);
- },
- },
- ];
-
- const label = torbutton_get_property_string(
- "torbutton.maximize_warning"
- );
-
- box.appendNotification(
- kNotificationName,
- {
- label,
- priority: box.PRIORITY_WARNING_LOW,
- eventCallback(event) {
- if (event === "dismissed") {
- // user manually dismissed the notification
- decreaseWarningsCount();
- }
- },
- },
- buttons
- );
- }
- }
- }; // m_tb_resize_handler
-
- // We need to handle OSes that auto-maximize windows depending on user
- // settings and/or screen resolution in the start-up phase and users that
- // try to shoot themselves in the foot by maximizing the window manually.
- // We add a listener which is triggerred as soon as the window gets
- // maximized (windowState = 1). We are resizing during start-up but not
- // later as the user should see only a warning there as a stopgap before
- // #14229 lands.
- // Alas, the Firefox window code is handling the event not itself:
- // "// Note the current implementation of SetSizeMode just stores
- // // the new state; it doesn't actually resize. So here we store
- // // the state and pass the event on to the OS."
- // (See: https://mxr.mozilla.org/mozilla-esr31/source/xpfe/appshell/src/
- // nsWebShellWindow.cpp#348)
- // This means we have to cope with race conditions and resizing in the
- // sizemodechange listener is likely to fail. Thus, we add a specific
- // resize listener that is doing the work for us. It seems (at least on
- // Ubuntu) to be the case that maximizing (and then again normalizing) of
- // the window triggers more than one resize event the first being not the
- // one we need. Thus we can't remove the listener after the first resize
- // event got fired. Thus, we have the rather klunky setTimeout() call.
- window.addEventListener("sizemodechange", m_tb_resize_handler);
-
- let progress = Cc["@mozilla.org/docloaderservice;1"].getService(
- Ci.nsIWebProgress
- );
- progress.removeProgressListener(this);
- }
- }, // onStateChange
-
- onProgressChange(
- aProgress,
- aRequest,
- curSelfProgress,
- maxSelfProgress,
- curTotalProgress,
- maxTotalProgress
- ) {},
- onStatusChange(aProgress, aRequest, stat, message) {},
- onSecurityChange() {},
- };
})();
-//vim:set ts=4
=====================================
toolkit/torbutton/chrome/locale/en-US/torbutton.properties
=====================================
@@ -115,6 +115,3 @@ torbutton.popup.no_newnym = Torbutton cannot safely give you a new identity. It
# Preferences for mobile: these strings are still referenced, but we should
# check whether this feature is still used
torbutton.security_settings.menu.title = Security Settings
-
-# Other legacy stuff we might just remove since we are using letterbox
-torbutton.maximize_warning = Maximizing Tor Browser can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave Tor Browser windows in their original default size.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/c1b352…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/c1b352…
You're receiving this email because of your account on gitlab.torproject.org.
Richard Pospesel pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
4f6e8b75 by Nicolas Vigier at 2023-03-29T11:32:16+02:00
Bug 40833: Set update-channel for base-browser nightly
- - - - -
1 changed file:
- projects/firefox/build
Changes:
=====================================
projects/firefox/build
=====================================
@@ -169,7 +169,7 @@ export LANG=C.UTF-8
./mach configure \
--with-distribution-id=org.torproject \
--with-base-browser-version=[% c("var/torbrowser_version") %] \
- [% IF c("var/tor-browser") -%]
+ [% IF c("var/updater_enabled") -%]
--enable-update-channel=[% c("var/channel") %] \
[% END %] \
[% IF !c("var/base-browser") -%]--with-branding=browser/branding/[% c("var/branding_directory_prefix") %]-[% c("var/channel") %][% END %] \
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/4…
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/4…
You're receiving this email because of your account on gitlab.torproject.org.