[tbb-commits] [torbutton/master] Bug #14429, Part 2. Run quantizer only once per window

gk at torproject.org gk at torproject.org
Mon Apr 6 09:03:28 UTC 2015


commit 046bce076aea058e41dfc05e7949429bdf800a2b
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Sun Mar 29 23:09:27 2015 -0700

    Bug #14429, Part 2. Run quantizer only once per window
---
 src/chrome/content/content-sizer.js |   14 ++++++--------
 src/chrome/content/torbutton.js     |    2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/chrome/content/content-sizer.js b/src/chrome/content/content-sizer.js
index af6bc80..f3710f7 100644
--- a/src/chrome/content/content-sizer.js
+++ b/src/chrome/content/content-sizer.js
@@ -5,10 +5,10 @@
 
 /* jshint esnext: true */
 
-// __quantizeBrowserSizeOnLoad(window, xStep, yStep)__.
-// Once a window is fully loaded, ensures that gBrowser width and height are multiples of
+// __quantizeBrowserSize(window, xStep, yStep)__.
+// Ensures that gBrowser width and height are multiples of
 // xStep and yStep.
-let quantizeBrowserSizeOnLoad = function (window, xStep, yStep) {
+let quantizeBrowserSize = function (window, xStep, yStep) {
 
 // Use Task.jsm to avoid callback hell.
 Cu.import("resource://gre/modules/Task.jsm");
@@ -247,7 +247,7 @@ let updateDimensions = function (gBrowser, xStep, yStep) {
 // __quantizeBrowserSizeNow(window, xStep, yStep)__.
 // Ensures that gBrowser width and height are multiples of xStep and yStep, and always as
 // large as possible inside the chrome window.
-let quantizeBrowserSizeNow = function (window, xStep, yStep) {
+let quantizeBrowserSizeMain = function (window, xStep, yStep) {
   let gBrowser = window.gBrowser,
       container = window.gBrowser.parentElement,
       updater = event => updateDimensions(gBrowser, xStep, yStep),
@@ -278,9 +278,7 @@ let quantizeBrowserSizeNow = function (window, xStep, yStep) {
   bindPrefAndInit("extensions.torbutton.resize_windows", activate);
 };
 
-let onLoad = () => quantizeBrowserSizeNow(window, xStep, yStep);
-window.gBrowser.addEventListener("load", onLoad, true);
-return () => window.gBrowser.removeEventListener("load", onLoad, true);
+quantizeBrowserSizeMain(window, xStep, yStep);
 
-// quantizeBrowserSizeOnLoad
+// quantizeBrowserSize
 };
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index c071ec3..7d6486f 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -636,7 +636,7 @@ function torbutton_init() {
     createTorCircuitDisplay(m_tb_control_host, m_tb_control_port, m_tb_control_pass,
                             "extensions.torbutton.display_circuit");
 
-    quantizeBrowserSizeOnLoad(window, 200, 100);
+    quantizeBrowserSize(window, 200, 100);
 
     torbutton_log(3, 'init completed');
 }



More information about the tbb-commits mailing list