Bug 1519407 - Don't use promiseDocumentFlushed inside a frame that can be reparented. r=gl
authorMike Conley <mconley@mozilla.com>
Tue, 15 Jan 2019 21:38:06 +0000
changeset 511093 f5e32a61d19437884f4331455fc87e6e4aa6f5c6
parent 511092 675a97d54d1253ab6726a961e432307e239123af
child 511094 959450489bcfc84a4c01cbae0e58b2b0455851e8
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1519407
milestone66.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 1519407 - Don't use promiseDocumentFlushed inside a frame that can be reparented. r=gl Instead of using promiseDocumentFlushed, we optimistically use getBoundsWithoutFlushing to get a recent width for the inspector-splitter-box without flushing, which is probably sufficient to determine whether or not to enter landscape mode. Differential Revision: https://phabricator.services.mozilla.com/D16347
devtools/client/inspector/inspector.js
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -521,22 +521,24 @@ Inspector.prototype = {
    *
    * @return {Boolean} true if the inspector should be in landscape mode.
    */
   useLandscapeMode: function() {
     if (!this.panelDoc) {
       return true;
     }
 
-    const { clientWidth } = this.panelDoc.getElementById("inspector-splitter-box");
+    const splitterBox = this.panelDoc.getElementById("inspector-splitter-box");
+    const { width } = window.windowUtils.getBoundsWithoutFlushing(splitterBox);
+
     return this.is3PaneModeEnabled &&
            (this.toolbox.hostType == Toolbox.HostType.LEFT ||
             this.toolbox.hostType == Toolbox.HostType.RIGHT) ?
-      clientWidth > SIDE_PORTAIT_MODE_WIDTH_THRESHOLD :
-      clientWidth > PORTRAIT_MODE_WIDTH_THRESHOLD;
+      width > SIDE_PORTAIT_MODE_WIDTH_THRESHOLD :
+      width > PORTRAIT_MODE_WIDTH_THRESHOLD;
   },
 
   /**
    * Build Splitter located between the main and side area of
    * the Inspector panel.
    */
   setupSplitter: function() {
     const { width, height, splitSidebarWidth } = this.getSidebarSize();
@@ -579,27 +581,17 @@ Inspector.prototype = {
   },
 
   _onLazyPanelResize: async function() {
     // We can be called on a closed window because of the deferred task.
     if (window.closed) {
       return;
     }
 
-    // Use window.top because promiseDocumentFlushed() in a subframe doesn't
-    // work, see https://bugzilla.mozilla.org/show_bug.cgi?id=1441173
-    const useLandscapeMode = await window.top.promiseDocumentFlushed(() => {
-      return this.useLandscapeMode();
-    });
-
-    if (window.closed) {
-      return;
-    }
-
-    this.splitBox.setState({ vert: useLandscapeMode });
+    this.splitBox.setState({ vert: this.useLandscapeMode() });
     this.emit("inspector-resize");
   },
 
   /**
    * If Toolbox width is less than 600 px, the splitter changes its mode
    * to `horizontal` to support portrait view.
    */
   onPanelWindowResize: function() {