Backed out changeset 7e6da74099fe (bug 1383367)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Fri, 28 Jul 2017 09:45:19 +0200
changeset 420312 f74d81e43bb5b9b13a6fd5351205582949f97870
parent 420311 466818a625e91a40818d3467a80d0befd26a4038
child 420313 d53d6c1d5c70d4f8849dd188d8b9460eb1a60960
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1383367
milestone56.0a1
backs out7e6da74099fe44de96396783c43b8e3e0c5b70a4
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
Backed out changeset 7e6da74099fe (bug 1383367)
toolkit/modules/BrowserUtils.jsm
--- a/toolkit/modules/BrowserUtils.jsm
+++ b/toolkit/modules/BrowserUtils.jsm
@@ -11,58 +11,16 @@ const {interfaces: Ci, utils: Cu, classe
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
   "resource://gre/modules/PlacesUtils.jsm");
 
 Cu.importGlobalProperties(["URL"]);
 
-let reflowObservers = new WeakMap();
-
-function ReflowObserver(doc) {
-  this._doc = doc;
-
-  doc.docShell.addWeakReflowObserver(this);
-  reflowObservers.set(this._doc, this);
-
-  this.callbacks = [];
-}
-
-ReflowObserver.prototype = {
-  QueryInterface: XPCOMUtils.generateQI(["nsIReflowObserver", "nsISupportsWeakReference"]),
-
-  _onReflow() {
-    reflowObservers.delete(this._doc);
-    this._doc.docShell.removeWeakReflowObserver(this);
-
-    for (let callback of this.callbacks) {
-      try {
-        callback();
-      } catch (e) {
-        Cu.reportError(e);
-      }
-    }
-  },
-
-  reflow() {
-    this._onReflow();
-  },
-
-  reflowInterruptible() {
-    this._onReflow();
-  },
-};
-
-const FLUSH_TYPES = {
-  "style": Ci.nsIDOMWindowUtils.FLUSH_STYLE,
-  "layout": Ci.nsIDOMWindowUtils.FLUSH_LAYOUT,
-  "display": Ci.nsIDOMWindowUtils.FLUSH_DISPLAY,
-};
-
 this.BrowserUtils = {
 
   /**
    * Prints arguments separated by a space and appends a new line.
    */
   dumpLn(...args) {
     for (let a of args)
       dump(a + " ");
@@ -663,68 +621,9 @@ this.BrowserUtils = {
 
     url = url.replace(/%s/g, encodedParam).replace(/%S/g, param);
     if (hasPOSTParam) {
       postData = decodedPostData.replace(/%s/g, encodedParam)
                                 .replace(/%S/g, param);
     }
     return [url, postData];
   },
-
-  /**
-   * Calls the given function when the given document has just reflowed,
-   * and returns a promise which resolves to its return value after it
-   * has been called.
-   *
-   * The function *must not trigger any reflows*, or make any changes
-   * which would require a layout flush.
-   *
-   * @param {Document} doc
-   * @param {function} callback
-   * @returns {Promise}
-   */
-  promiseReflowed(doc, callback) {
-    let observer = reflowObservers.get(doc);
-    if (!observer) {
-      observer = new ReflowObserver(doc);
-      reflowObservers.set(doc, observer);
-    }
-
-    return new Promise((resolve, reject) => {
-      observer.callbacks.push(() => {
-        try {
-          resolve(callback());
-        } catch (e) {
-          reject(e);
-        }
-      });
-    });
-  },
-
-  /**
-   * Calls the given function as soon as a layout flush of the given
-   * type is not necessary, and returns a promise which resolves to the
-   * callback's return value after it executes.
-   *
-   * The function *must not trigger any reflows*, or make any changes
-   * which would require a layout flush.
-   *
-   * @param {Document} doc
-   * @param {string} flushType
-   *        The flush type required. Must be one of:
-   *
-   *          - "style"
-   *          - "layout"
-   *          - "display"
-   * @param {function} callback
-   * @returns {Promise}
-   */
-  async promiseLayoutFlushed(doc, flushType, callback) {
-    let utils = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
-                   .getInterface(Ci.nsIDOMWindowUtils);
-
-    if (!utils.needsFlush(FLUSH_TYPES[flushType])) {
-      return callback();
-    }
-
-    return this.promiseReflowed(doc, callback);
-  },
 };