This is an automated email from the git hooks/post-receive script.
richard pushed a change to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
from 7801f522366c fixup! Add TorStrings module for localization new 2d9fb2cb57bc Revert "Bug 32220: Improve the letterboxing experience" new a38c81a1bd7a Bug 41434: Letterboxing, preemptively apply margins in a global CSS rule to mitigate race conditions on newly created windows and tabs. new 377411d5dedc Bug 41434: Letterboxing, improve logging. new e62c2067db13 Bug 31064: Letterboxing, exempt browser extensions. new 321a85ed02dc Bug 32411: Letterboxing, exempt view-source: URIs. new 95d8ea660184 Bug 32220: Improve the letterboxing experience
The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: browser/base/content/browser.css | 23 +- browser/base/content/tabbrowser-tab.js | 9 - browser/themes/shared/tabs.css | 6 - .../components/resistfingerprinting/RFPHelper.jsm | 296 +++++++++------------ 4 files changed, 141 insertions(+), 193 deletions(-)
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 2d9fb2cb57bcc268da06f451a9e13d17587169bc Author: hackademix giorgio@maone.net AuthorDate: Thu Nov 10 19:56:30 2022 +0100
Revert "Bug 32220: Improve the letterboxing experience"
This reverts commit 7d37c04b9efb676678cfa34eb11c3014c83012be. --- browser/base/content/browser.css | 7 -- browser/base/content/tabbrowser-tab.js | 9 -- browser/themes/shared/tabs.css | 6 -- .../components/resistfingerprinting/RFPHelper.jsm | 97 +++------------------- 4 files changed, 12 insertions(+), 107 deletions(-)
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 2f181244982d..03a778809dc8 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -98,13 +98,6 @@ body { -moz-window-dragging: drag; }
-.browserStack > browser.letterboxing { - border-color: var(--chrome-content-separator-color); - border-style: solid; - border-width : 1px; - border-top: none; -} - #toolbar-menubar[autohide="true"] { overflow: hidden; } diff --git a/browser/base/content/tabbrowser-tab.js b/browser/base/content/tabbrowser-tab.js index 4243079a84b9..abcabb98503e 100644 --- a/browser/base/content/tabbrowser-tab.js +++ b/browser/base/content/tabbrowser-tab.js @@ -239,15 +239,6 @@ return true; }
- get needsLetterbox() { - let browser = this.linkedBrowser; - if (isBlankPageURL(browser.currentURI.spec)) { - return false; - } - - return true; - } - get lastAccessed() { return this._lastAccessed == Infinity ? Date.now() : this._lastAccessed; } diff --git a/browser/themes/shared/tabs.css b/browser/themes/shared/tabs.css index 9597205f7606..2eb7405c78d5 100644 --- a/browser/themes/shared/tabs.css +++ b/browser/themes/shared/tabs.css @@ -56,12 +56,6 @@ background-color: var(--tabpanel-background-color); }
-/* extend down the toolbar's colors when letterboxing is enabled*/ -#tabbrowser-tabpanels.letterboxing { - background-color: var(--toolbar-bgcolor); - background-image: var(--toolbar-bgimage); -} - #tabbrowser-tabs, #tabbrowser-arrowscrollbox, #tabbrowser-tabs[positionpinnedtabs] > #tabbrowser-arrowscrollbox > .tabbrowser-tab[pinned] { diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index 146e4a86514e..d2191ee14aa5 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -40,7 +40,6 @@ class _RFPHelper { // ============================================================================ constructor() { this._initialized = false; - this._borderDimensions = null; }
init() { @@ -353,24 +352,6 @@ class _RFPHelper { }); }
- getBorderDimensions(aBrowser) { - if (this._borderDimensions) { - return this._borderDimensions; - } - - const win = aBrowser.ownerGlobal; - const browserStyle = win.getComputedStyle(aBrowser); - - this._borderDimensions = { - top: parseInt(browserStyle.borderTopWidth), - right: parseInt(browserStyle.borderRightWidth), - bottom: parseInt(browserStyle.borderBottomWidth), - left: parseInt(browserStyle.borderLeftWidth), - }; - - return this._borderDimensions; - } - _addOrClearContentMargin(aBrowser) { let tab = aBrowser.getTabBrowser().getTabForBrowser(aBrowser);
@@ -379,13 +360,9 @@ class _RFPHelper { return; }
- // we add the letterboxing class even if the content does not need letterboxing - // in which case margins are set such that the borders are hidden - aBrowser.classList.add("letterboxing"); - // We should apply no margin around an empty tab or a tab with system // principal. - if (!tab.needsLetterbox || aBrowser.contentPrincipal.isSystemPrincipal) { + if (tab.isEmpty || aBrowser.contentPrincipal.isSystemPrincipal) { this._clearContentViewMargin(aBrowser); } else { this._roundContentView(aBrowser); @@ -553,32 +530,10 @@ class _RFPHelper { // Calculating the margins around the browser element in order to round the // content viewport. We will use a 200x100 stepping if the dimension set // is not given. - - const borderDimensions = this.getBorderDimensions(aBrowser); - const marginDims = calcMargins( - containerWidth, - containerHeight - borderDimensions.top - ); - - let margins = { - top: 0, - right: 0, - bottom: 0, - left: 0, - }; - - // snap browser element to top - margins.top = 0; - // and leave 'double' margin at the bottom - margins.bottom = 2 * marginDims.height - borderDimensions.bottom; - // identical margins left and right - margins.right = marginDims.width - borderDimensions.right; - margins.left = marginDims.width - borderDimensions.left; - - const marginStyleString = `${margins.top}px ${margins.right}px ${margins.bottom}px ${margins.left}px`; + let margins = calcMargins(containerWidth, containerHeight);
// If the size of the content is already quantized, we do nothing. - if (aBrowser.style.margin === marginStyleString) { + if (aBrowser.style.margin == `${margins.height}px ${margins.width}px`) { log("_roundContentView[" + logId + "] is_rounded == true"); if (this._isLetterboxingTesting) { log( @@ -599,35 +554,19 @@ class _RFPHelper { "_roundContentView[" + logId + "] setting margins to " + - marginStyleString + margins.width + + " x " + + margins.height ); - - // The margin background color is determined by the background color of the - // window's tabpanels#tabbrowser-tabpanels element - aBrowser.style.margin = marginStyleString; + // One cannot (easily) control the color of a margin unfortunately. + // An initial attempt to use a border instead of a margin resulted + // in offset event dispatching; so for now we use a colorless margin. + aBrowser.style.margin = `${margins.height}px ${margins.width}px`; }); }
_clearContentViewMargin(aBrowser) { - const borderDimensions = this.getBorderDimensions(aBrowser); - // set the margins such that the browser elements border is visible up top, but - // are rendered off-screen on the remaining sides - let margins = { - top: 0, - right: -borderDimensions.right, - bottom: -borderDimensions.bottom, - left: -borderDimensions.left, - }; - const marginStyleString = `${margins.top}px ${margins.right}px ${margins.bottom}px ${margins.left}px`; - aBrowser.ownerGlobal.requestAnimationFrame(() => { - aBrowser.style.margin = marginStyleString; - }); - } - - _removeLetterboxing(aBrowser) { - aBrowser.ownerGlobal.requestAnimationFrame(() => { - aBrowser.classList.remove("letterboxing"); aBrowser.style.margin = ""; }); } @@ -645,11 +584,6 @@ class _RFPHelper { aWindow.gBrowser.addTabsProgressListener(this); aWindow.addEventListener("TabOpen", this);
- const tabPanel = aWindow.document.getElementById("tabbrowser-tabpanels"); - if (tabPanel) { - tabPanel.classList.add("letterboxing"); - } - // Rounding the content viewport. this._updateMarginsForTabsInWindow(aWindow); } @@ -673,17 +607,10 @@ class _RFPHelper { tabBrowser.removeTabsProgressListener(this); aWindow.removeEventListener("TabOpen", this);
- // revert tabpanel's background colors to default - const tabPanel = aWindow.document.getElementById("tabbrowser-tabpanels"); - if (tabPanel) { - tabPanel.classList.remove("letterboxing"); - } - - // and revert each browser element to default, - // restore default margins and remove letterboxing class + // Clear all margins and tooltip for all browsers. for (let tab of tabBrowser.tabs) { let browser = tab.linkedBrowser; - this._removeLetterboxing(browser); + this._clearContentViewMargin(browser); } }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit a38c81a1bd7a0a1f51fbfb2b59ddb25420e2612d Author: hackademix giorgio@maone.net AuthorDate: Thu Nov 10 22:25:51 2022 +0100
Bug 41434: Letterboxing, preemptively apply margins in a global CSS rule to mitigate race conditions on newly created windows and tabs. --- browser/base/content/browser.css | 12 ++ .../components/resistfingerprinting/RFPHelper.jsm | 178 ++++++++++++++------- 2 files changed, 129 insertions(+), 61 deletions(-)
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 03a778809dc8..2ea45e3a40b7 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -98,6 +98,18 @@ body { -moz-window-dragging: drag; }
+/** + Never modify the following selector without synchronizing + LETTERBOX_CSS_SELECTOR in RFPHelper.jsm! +**/ +.letterboxing .browserStack > browser:not(.exclude-letterboxing) { + margin: 0; /* to be dynamically set by RFHelper.jsm */ +} + +browser.exclude-letterboxing { + margin: 0 !important; +} + #toolbar-menubar[autohide="true"] { overflow: hidden; } diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index d2191ee14aa5..60ce0b3313c9 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -107,7 +107,7 @@ class _RFPHelper { switch (aMessage.type) { case "TabOpen": { let tab = aMessage.target; - this._addOrClearContentMargin(tab.linkedBrowser); + this._addOrClearContentMargin(tab.linkedBrowser, /* isNewTab = */ true); break; } default: @@ -352,20 +352,49 @@ class _RFPHelper { }); }
- _addOrClearContentMargin(aBrowser) { - let tab = aBrowser.getTabBrowser().getTabForBrowser(aBrowser); + getLetterboxingDefaultRule(aBrowser) { + let document = aBrowser.ownerDocument; + return (document._letterboxingMarginsRule ||= (() => { + // If not already cached on the document object, traverse the CSSOM and + // find the rule applying the default letterboxing styles to browsers + // preemptively in order to beat race conditions on tab/window creation + const LETTERBOX_CSS_URL = "chrome://browser/content/browser.css"; + const LETTERBOX_CSS_SELECTOR = + ".letterboxing .browserStack > browser:not(.exclude-letterboxing)"; + for (let ss of document.styleSheets) { + if (ss.href !== LETTERBOX_CSS_URL) { + continue; + } + for (let rule of ss.rules) { + if (rule.selectorText === LETTERBOX_CSS_SELECTOR) { + return rule; + } + } + } + return null; // shouldn't happen + })()); + }
+ _noLetterBoxingFor({ contentPrincipal, currentURI }) { + // we don't want letterboxing on... + return ( + // ... privileged pages + contentPrincipal.isSystemPrincipal || + // ... about: URIs EXCEPT about:blank + (currentURI.schemeIs("about") && currentURI.filePath !== "blank") + ); + } + + _addOrClearContentMargin(aBrowser, isNewTab = false) { // We won't do anything for lazy browsers. if (!aBrowser.isConnected) { return; } - - // We should apply no margin around an empty tab or a tab with system - // principal. - if (tab.isEmpty || aBrowser.contentPrincipal.isSystemPrincipal) { + if (this._noLetterBoxingFor(aBrowser)) { + // this tab doesn't need letterboxing this._clearContentViewMargin(aBrowser); } else { - this._roundContentView(aBrowser); + this._roundContentView(aBrowser, isNewTab); } }
@@ -391,44 +420,25 @@ class _RFPHelper { * The function will round the given browser by adding margins around the * content viewport. */ - async _roundContentView(aBrowser) { + async _roundContentView(aBrowser, isNewTab = false) { let logId = Math.random(); log("_roundContentView[" + logId + "]"); + aBrowser.classList.remove("exclude-letterboxing"); let win = aBrowser.ownerGlobal; let browserContainer = aBrowser .getTabBrowser() .getBrowserContainer(aBrowser); - - let { - contentWidth, - contentHeight, - containerWidth, - containerHeight, - } = await win.promiseDocumentFlushed(() => { - let contentWidth = aBrowser.clientWidth; - let contentHeight = aBrowser.clientHeight; - let containerWidth = browserContainer.clientWidth; - let containerHeight = browserContainer.clientHeight; - - // If the findbar or devtools are out, we need to subtract their height (plus 1 - // for the separator) from the container height, because we need to adjust our - // letterboxing to account for it; however it is not included in that dimension - // (but rather is subtracted from the content height.) - let findBar = win.gFindBarInitialized ? win.gFindBar : undefined; - let findBarOffset = - findBar && !findBar.hidden ? findBar.clientHeight + 1 : 0; - let devtools = browserContainer.getElementsByClassName( - "devtools-toolbox-bottom-iframe" - ); - let devtoolsOffset = devtools.length ? devtools[0].clientHeight : 0; - - return { - contentWidth, - contentHeight, - containerWidth, - containerHeight: containerHeight - findBarOffset - devtoolsOffset, - }; - }); + let browserParent = aBrowser.parentElement; + let [ + [contentWidth, contentHeight], + [parentWidth, parentHeight], + [containerWidth, containerHeight], + ] = await win.promiseDocumentFlushed(() => + // Read layout info only inside this callback and do not write, to avoid additional reflows + [aBrowser, browserParent, browserContainer] + .map(e => e.getBoundingClientRect()) + .map(r => [r.width, r.height]) + );
log( "_roundContentView[" + @@ -444,7 +454,12 @@ class _RFPHelper { " " );
- let calcMargins = (aWidth, aHeight) => { + if (containerWidth === 0) { + // race condition: tab already be closed, bail out + return; + } + + const calcMargins = (aWidth, aHeight) => { let result; log( "_roundContentView[" + @@ -455,6 +470,7 @@ class _RFPHelper { aHeight + ")" ); + // If the set is empty, we will round the content with the default // stepping size. if (!this._letterboxingDimensions.length) { @@ -530,10 +546,54 @@ class _RFPHelper { // Calculating the margins around the browser element in order to round the // content viewport. We will use a 200x100 stepping if the dimension set // is not given. - let margins = calcMargins(containerWidth, containerHeight); + + const buildMarginStyleString = (aWidth, aHeight) => { + const marginDims = calcMargins(aWidth, aHeight); + + // snap browser element to top + const top = 0, + // and leave 'double' margin at the bottom + bottom = 2 * marginDims.height, + // identical margins left and right + left = marginDims.width, + right = marginDims.width; + + return `${top}px ${right}px ${bottom}px ${left}px`; + }; + + const marginChanges = Object.assign([], { + queueIfNeeded({ style }, margin) { + if (style.margin !== margin) { + this.push(() => { + style.margin = margin; + }); + } + }, + perform() { + win.requestAnimationFrame(() => { + for (let change of this) { + change(); + } + }); + }, + }); + + marginChanges.queueIfNeeded( + this.getLetterboxingDefaultRule(aBrowser), + buildMarginStyleString(containerWidth, containerHeight) + ); + + const marginStyleString = + !isNewTab && // new tabs cannot have extra UI components + (containerHeight > parentHeight || containerWidth > parentWidth) + ? // optional UI components such as the notification box, the find bar + // or devtools are constraining this browser's size: recompute custom + buildMarginStyleString(parentWidth, parentHeight) + : ""; // otherwise we can keep the default letterboxing margins + marginChanges.queueIfNeeded(aBrowser, marginStyleString);
// If the size of the content is already quantized, we do nothing. - if (aBrowser.style.margin == `${margins.height}px ${margins.width}px`) { + if (!marginChanges.length) { log("_roundContentView[" + logId + "] is_rounded == true"); if (this._isLetterboxingTesting) { log( @@ -549,31 +609,24 @@ class _RFPHelper { return; }
- win.requestAnimationFrame(() => { - log( - "_roundContentView[" + - logId + - "] setting margins to " + - margins.width + - " x " + - margins.height - ); - // One cannot (easily) control the color of a margin unfortunately. - // An initial attempt to use a border instead of a margin resulted - // in offset event dispatching; so for now we use a colorless margin. - aBrowser.style.margin = `${margins.height}px ${margins.width}px`; - }); + log( + "_roundContentView[" + logId + "] setting margins to " + marginStyleString + ); + // One cannot (easily) control the color of a margin unfortunately. + // An initial attempt to use a border instead of a margin resulted + // in offset event dispatching; so for now we use a colorless margin. + marginChanges.perform(); }
_clearContentViewMargin(aBrowser) { - aBrowser.ownerGlobal.requestAnimationFrame(() => { - aBrowser.style.margin = ""; - }); + aBrowser.classList.add("exclude-letterboxing"); }
_updateMarginsForTabsInWindow(aWindow) { let tabBrowser = aWindow.gBrowser;
+ tabBrowser.tabpanels?.classList.add("letterboxing"); + for (let tab of tabBrowser.tabs) { let browser = tab.linkedBrowser; this._addOrClearContentMargin(browser); @@ -607,7 +660,10 @@ class _RFPHelper { tabBrowser.removeTabsProgressListener(this); aWindow.removeEventListener("TabOpen", this);
- // Clear all margins and tooltip for all browsers. + // revert tabpanel's style to default + tabBrowser.tabpanels?.classList.remove("letterboxing"); + + // and restore default margins on each browser element for (let tab of tabBrowser.tabs) { let browser = tab.linkedBrowser; this._clearContentViewMargin(browser);
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 377411d5dedc5709c69cba134634c4b42a18e379 Author: hackademix giorgio@maone.net AuthorDate: Thu Nov 10 22:59:17 2022 +0100
Bug 41434: Letterboxing, improve logging. --- .../components/resistfingerprinting/RFPHelper.jsm | 61 ++++------------------ 1 file changed, 11 insertions(+), 50 deletions(-)
diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index 60ce0b3313c9..cb50a1a9a470 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -421,8 +421,8 @@ class _RFPHelper { * content viewport. */ async _roundContentView(aBrowser, isNewTab = false) { - let logId = Math.random(); - log("_roundContentView[" + logId + "]"); + let logPrefix = `_roundContentView[${Math.random()}]`; + log(logPrefix); aBrowser.classList.remove("exclude-letterboxing"); let win = aBrowser.ownerGlobal; let browserContainer = aBrowser @@ -441,17 +441,9 @@ class _RFPHelper { );
log( - "_roundContentView[" + - logId + - "] contentWidth=" + - contentWidth + - " contentHeight=" + - contentHeight + - " containerWidth=" + - containerWidth + - " containerHeight=" + - containerHeight + - " " + `${logPrefix} contentWidth=${contentWidth} contentHeight=${contentHeight} parentWidth=${parentWidth} parentHeight=${parentHeight} containerWidth=${containerWidth} containerHeight=${containerHeight}${ + isNewTab ? " (new tab)." : "." + }` );
if (containerWidth === 0) { @@ -461,16 +453,7 @@ class _RFPHelper {
const calcMargins = (aWidth, aHeight) => { let result; - log( - "_roundContentView[" + - logId + - "] calcMargins(" + - aWidth + - ", " + - aHeight + - ")" - ); - + log(`${logPrefix} calcMargins(${aWidth}, ${aHeight})`); // If the set is empty, we will round the content with the default // stepping size. if (!this._letterboxingDimensions.length) { @@ -479,16 +462,7 @@ class _RFPHelper { height: this.steppedRange(aHeight), }; log( - "_roundContentView[" + - logId + - "] calcMargins(" + - aWidth + - ", " + - aHeight + - ") = " + - result.width + - " x " + - result.height + `${logPrefix} calcMargins(${aWidth}, ${aHeight}) = ${result.width} x ${result.height}` ); return result; } @@ -529,16 +503,7 @@ class _RFPHelper { }
log( - "_roundContentView[" + - logId + - "] calcMargins(" + - aWidth + - ", " + - aHeight + - ") = " + - result.width + - " x " + - result.height + `${logPrefix} calcMargins(${aWidth}, ${aHeight}) = ${result.width} x ${result.height}` ); return result; }; @@ -594,12 +559,10 @@ class _RFPHelper {
// If the size of the content is already quantized, we do nothing. if (!marginChanges.length) { - log("_roundContentView[" + logId + "] is_rounded == true"); + log(`${logPrefix} is_rounded == true`); if (this._isLetterboxingTesting) { log( - "_roundContentView[" + - logId + - "] is_rounded == true test:letterboxing:update-margin-finish" + `${logPrefix} is_rounded == true test:letterboxing:update-margin-finish` ); Services.obs.notifyObservers( null, @@ -609,9 +572,7 @@ class _RFPHelper { return; }
- log( - "_roundContentView[" + logId + "] setting margins to " + marginStyleString - ); + log(`${logPrefix} setting margins to ${marginStyleString}`); // One cannot (easily) control the color of a margin unfortunately. // An initial attempt to use a border instead of a margin resulted // in offset event dispatching; so for now we use a colorless margin.
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit e62c2067db13b3d1f2c5dd065674f8b06015e7c4 Author: hackademix giorgio@maone.net AuthorDate: Thu Nov 10 23:02:47 2022 +0100
Bug 31064: Letterboxing, exempt browser extensions. --- toolkit/components/resistfingerprinting/RFPHelper.jsm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index cb50a1a9a470..78cf4ee4b33e 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -381,7 +381,9 @@ class _RFPHelper { // ... privileged pages contentPrincipal.isSystemPrincipal || // ... about: URIs EXCEPT about:blank - (currentURI.schemeIs("about") && currentURI.filePath !== "blank") + (currentURI.schemeIs("about") && currentURI.filePath !== "blank") || + // ... browser extensions + contentPrincipal.addonPolicy ); }
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 321a85ed02dcf6a8a32a48697df3f94c022a1f0f Author: hackademix giorgio@maone.net AuthorDate: Fri Nov 11 22:24:35 2022 +0100
Bug 32411: Letterboxing, exempt view-source: URIs. --- toolkit/components/resistfingerprinting/RFPHelper.jsm | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index 78cf4ee4b33e..fde005fc6e21 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -382,6 +382,8 @@ class _RFPHelper { contentPrincipal.isSystemPrincipal || // ... about: URIs EXCEPT about:blank (currentURI.schemeIs("about") && currentURI.filePath !== "blank") || + // ... source code + currentURI.schemeIs("view-source") || // ... browser extensions contentPrincipal.addonPolicy );
This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 95d8ea66018470abad73ee6af1f3d3a96ab18ff4 Author: Richard Pospesel richard@torproject.org AuthorDate: Mon Oct 28 17:42:17 2019 -0700
Bug 32220: Improve the letterboxing experience
CSS and JS changes to alter the UX surrounding letterboxing. The browser element containing page content is now anchored to the bottom of the toolbar, and the remaining letterbox margin is the same color as the firefox chrome. The letterbox margin and outline are tied to the currently selected theme.
Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1594455 --- browser/base/content/browser.css | 8 ++++++++ toolkit/components/resistfingerprinting/RFPHelper.jsm | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 2ea45e3a40b7..b9b42dc2a769 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -104,10 +104,18 @@ body { **/ .letterboxing .browserStack > browser:not(.exclude-letterboxing) { margin: 0; /* to be dynamically set by RFHelper.jsm */ + outline: 1px solid var(--chrome-content-separator-color); }
browser.exclude-letterboxing { margin: 0 !important; + outline: initial; +} + +/* extend down the toolbar's colors when letterboxing is enabled */ +.letterboxing { + background-color: var(--toolbar-bgcolor); + background-image: var(--toolbar-bgimage); }
#toolbar-menubar[autohide="true"] { diff --git a/toolkit/components/resistfingerprinting/RFPHelper.jsm b/toolkit/components/resistfingerprinting/RFPHelper.jsm index fde005fc6e21..c6f257111099 100644 --- a/toolkit/components/resistfingerprinting/RFPHelper.jsm +++ b/toolkit/components/resistfingerprinting/RFPHelper.jsm @@ -515,6 +515,7 @@ class _RFPHelper { // Calculating the margins around the browser element in order to round the // content viewport. We will use a 200x100 stepping if the dimension set // is not given. + // Margin and outline colors are set in browser.css (.letterboxing * selectors).
const buildMarginStyleString = (aWidth, aHeight) => { const marginDims = calcMargins(aWidth, aHeight); @@ -577,9 +578,10 @@ class _RFPHelper { }
log(`${logPrefix} setting margins to ${marginStyleString}`); - // One cannot (easily) control the color of a margin unfortunately. - // An initial attempt to use a border instead of a margin resulted - // in offset event dispatching; so for now we use a colorless margin. + // Here we set the browser's margin to round its content size. + // A "border" visual is created by using a CSS outline, which does't + // affect layout, while the background appearance is borrowed from the + // toolbar and set in the .letterboxing ancestor (see browser.css). marginChanges.perform(); }
tor-commits@lists.torproject.org