Bug 1497599 - Lazify progressmeter Custom Element connection;r=paolo
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 10 Oct 2018 17:12:00 +0000
changeset 499034 8ca368cb3bbfdc279c11fc706ee4b799208b33a7
parent 499033 5162ce7f1c51fbf3b91e78690814ed9f7bdb38f7
child 499035 8f52497c3d96f9f193a82ab2e715230ea77528db
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1497599
milestone64.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 1497599 - Lazify progressmeter Custom Element connection;r=paolo As outlined by MozXULElement, we: - delay connectedCallback logic until after parse - wait for isConnectedAndReady before running attributeChangedCallbacks;r=paolo Differential Revision: https://phabricator.services.mozilla.com/D8150
toolkit/content/widgets/progressmeter.js
--- a/toolkit/content/widgets/progressmeter.js
+++ b/toolkit/content/widgets/progressmeter.js
@@ -64,28 +64,35 @@ class MozProgressmeter extends MozXULEle
     return val;
   }
 
   isUndetermined() {
     return this.getAttribute("mode") == "undetermined";
   }
 
   connectedCallback() {
+    if (this.delayConnectedCallback()) {
+      return;
+    }
     this._initUI();
   }
 
   disconnectedCallback() {
     this.runAnimation = false;
   }
 
   static get observedAttributes() {
     return [ "mode" ];
   }
 
   attributeChangedCallback(name, oldValue, newValue) {
+    if (!this.isConnectedAndReady) {
+      return;
+    }
+
     if (name === "mode" && oldValue != newValue) {
       this._initUI();
     }
   }
 
   _initUI() {
     let isUndetermined = this.isUndetermined();
     let content = isUndetermined ?