Bug 1129930 - JavaScript error: chrome://browser/content/preferences/in-content/preferences.js, line 82: TypeError: getComputedStyle(...) is null. r=Gijs
authorIan Moody <moz-ian@perix.co.uk>
Thu, 05 Feb 2015 16:48:46 +0000
changeset 227779 f6d265d88cb4876c5796f67588a05092f4312bda
parent 227778 165cb27ebbc9c4181fb0daaa52c4274ad57e2011
child 227780 eecd602fe207ee20a96cc40f7612f20e70dcb599
push id28239
push userryanvm@gmail.com
push dateFri, 06 Feb 2015 13:52:40 +0000
treeherdermozilla-central@03b0004eba32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1129930
milestone38.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 1129930 - JavaScript error: chrome://browser/content/preferences/in-content/preferences.js, line 82: TypeError: getComputedStyle(...) is null. r=Gijs
browser/components/preferences/in-content/preferences.js
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -64,50 +64,55 @@ function init_all() {
   });
   categories.addEventListener("mousedown", function() {
     this.removeAttribute("keyboard-navigation");
   });
 
   window.addEventListener("hashchange", onHashChange);
   gotoPref();
 
+  init_dynamic_padding();
+
   var initFinished = new CustomEvent("Initialized", {
     'bubbles': true,
     'cancelable': true
   });
   document.dispatchEvent(initFinished);
 
   let helpCmd = document.getElementById("help-button");
   helpCmd.addEventListener("command", helpButtonCommand);
 
-  // Make the space above the categories list shrink on low window heights
+  // Wait until initialization of all preferences are complete before
+  // notifying observers that the UI is now ready.
+  Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
+}
+
+window.addEventListener("unload", function onUnload() {
+  gSubDialog.uninit();
+});
+
+// Make the space above the categories list shrink on low window heights
+function init_dynamic_padding() {
+  let categories = document.getElementById("categories");
   let catPadding = Number.parseInt(getComputedStyle(categories)
                                      .getPropertyValue('padding-top'));
   let fullHeight = categories.lastElementChild.getBoundingClientRect().bottom;
   let mediaRule = `
   @media (max-height: ${fullHeight}px) {
     #categories {
       padding-top: calc(100vh - ${fullHeight - catPadding}px);
     }
   }
   `;
   let mediaStyle = document.createElementNS('http://www.w3.org/1999/xhtml', 'html:style');
   mediaStyle.setAttribute('type', 'text/css');
   mediaStyle.appendChild(document.createCDATASection(mediaRule));
   document.documentElement.appendChild(mediaStyle);
-
-  // Wait until initialization of all preferences are complete before
-  // notifying observers that the UI is now ready.
-  Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
 }
 
-window.addEventListener("unload", function onUnload() {
-  gSubDialog.uninit();
-});
-
 function onHashChange() {
   gotoPref();
 }
 
 function gotoPref(aCategory) {
   let categories = document.getElementById("categories");
   const kDefaultCategoryInternalName = categories.firstElementChild.value;
   let hash = document.location.hash;