Bug 1397426 - Ensure we attempt to activate docShell of current tab after reacting to sidemode or occlusionstate change events. r=billm
authorMike Conley <mconley@mozilla.com>
Thu, 21 Dec 2017 13:40:52 -0500
changeset 452326 2cfdaedf635996efdc462bb12d5075b84b3e93e8
parent 452325 c592bf74cad182c919e808892c1ee3859fb38d53
child 452327 6168b93583526bd6656b649eb5572b5a6869845d
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1397426, 1279086
milestone59.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 1397426 - Ensure we attempt to activate docShell of current tab after reacting to sidemode or occlusionstate change events. r=billm During the macOS fullscreen mode change, the window entering fullscreen reports being occluded for a brief time (presumably due to the "stretch" effect that macOS is applying overtop of the window). This causes us to preserve the layers for the selected tab, and deactivate its docShell. According to https://bugzilla.mozilla.org/show_bug.cgi?id=1279086#c34, we preserve layers like this when minimizing or fully occluding the window. This way, we avoid a flicker when the window is un-minimized or partially revealed. However, if during that transition, the mouse hovers over a background tab (which is the case during the automated tests) and an async tab switcher doesn't already exist, we can trigger a warming attempt on that background tab, which creates an async tab switcher, and causes the switcher to run its init() method. Beyond setting some initial state, the init() method also makes it so that the initial browser at the time of calling init() sets preserve layers to false. If we get into this situation, then what we end up with is a tab that is rendering layers, is no longer preserving them, but the docShell is not activated. Soon after, the async tab switcher responds to the occlusionstatechange event when the window is revealed again. Before this patch, we did nothing, since it was assumed that postActions would eventually activate the docShell. However, since warming isn't currently activated by default, the async tab switcher soon destroys itself, and the initial tab's docShell is never activated. This causes the browser_domFullscreen_fullscreenMode.js test to hang (and probably other bugs as well). This patch makes it so that if we see an occlusionstatechange or sizemodechange event when the async tab switcher exists, and the window is no longer minimized or fully occluded, that we attempt to activate the currently selected tab's docShell. MozReview-Commit-ID: yJTUj8bBrs
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4987,18 +4987,19 @@
                   }
                 }
                 if (this.loadTimer) {
                   this.clearTimer(this.loadTimer);
                   this.loadTimer = null;
                 }
                 this.loadingTab = null;
               } else {
-                // Do nothing. We'll automatically start loading the requested tab in
-                // postActions.
+                // We're no longer minimized or occluded. This means we might want
+                // to activate the current tab's docShell.
+                this.maybeActivateDocShell(gBrowser.selectedTab);
               }
             },
 
             onSwapDocShells(ourBrowser, otherBrowser) {
               // This event fires before the swap. ourBrowser is from
               // our window. We save the state of otherBrowser since ourBrowser
               // needs to take on that state at the end of the swap.