Bug 1506063 - Simplify gDragSpaceObserver. r=johannh
authorDão Gottwald <dao@mozilla.com>
Fri, 09 Nov 2018 10:16:34 +0000
changeset 445389 659558129d322157a852051b6f11e5858c17bc8c
parent 445388 f6d29b57e6ba9d75d535c510d199df9b918e0c7b
child 445390 981eb3885ff2d2edc9408d44dab9610594a930f7
push id35015
push userdluca@mozilla.com
push dateFri, 09 Nov 2018 17:45:20 +0000
treeherdermozilla-central@2f1158e5e0ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1506063
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1506063 - Simplify gDragSpaceObserver. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D11448
browser/base/content/browser-tabsintitlebar.js
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -99,32 +99,24 @@ function onTitlebarMaxClick() {
 }
 
 // Adds additional drag space to the window by listening to
 // the corresponding preference.
 var gDragSpaceObserver = {
   pref: "browser.tabs.extraDragSpace",
 
   init() {
-    this._update();
     Services.prefs.addObserver(this.pref, this);
+    this.observe();
   },
 
   uninit() {
     Services.prefs.removeObserver(this.pref, this);
   },
 
-  observe(aSubject, aTopic, aPrefName) {
-    if (aTopic != "nsPref:changed" || aPrefName != this.pref) {
-      return;
-    }
-
-    this._update();
-  },
-
-  _update() {
+  observe() {
     if (Services.prefs.getBoolPref(this.pref)) {
       document.documentElement.setAttribute("extradragspace", "true");
     } else {
       document.documentElement.removeAttribute("extradragspace");
     }
   },
 };