[tbb-commits] [tor-browser] 16/57: Bug 41434: Letterboxing, improve logging.

gitolite role git at cupani.torproject.org
Mon Dec 5 13:01:52 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-102.5.0esr-12.0-2
in repository tor-browser.

commit b5b4ca4752be0c4de9b1853bd9d439a8cbb87054
Author: hackademix <giorgio at 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.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list