Bug 1472212 - Prevent focusing on the tab's content area during session restoration for special URLs for new tabs. r=dao
☠☠ backed out by 9a4b8f268757 ☠ ☠
authorJay Lim <jlim@mozilla.com>
Fri, 20 Jul 2018 19:47:56 -0400
changeset 499440 c3c22abaf108a020590266c1a707a2c37de512d8
parent 499439 a28443371b944ee00b1267dd5b9a22da6d28353b
child 499441 9ff5280fc25a119d1aa80329b79c07b9910b5768
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)
reviewersdao
bugs1472212
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 1472212 - Prevent focusing on the tab's content area during session restoration for special URLs for new tabs. r=dao Since about:newtab now runs in the privileged content process, SessionStore will attempt restore the tab's content whenever we perform a process switch. This causes the tab's content area to be focused. We will add a condition to prevent focusing on the tab's content area. This patch also focuses on the URL bar first before opening a new tab to avoid flickering. MozReview-Commit-ID: FRKR6pReiZz
browser/components/sessionstore/SessionStore.jsm
browser/components/uitour/UITour.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -4066,17 +4066,17 @@ var SessionStoreInternal = {
 
     browser.messageManager.sendAsyncMessage("SessionStore:restoreTabContent",
       {loadArguments, isRemotenessUpdate,
        reason: aOptions.restoreContentReason ||
                RESTORE_TAB_CONTENT_REASON.SET_STATE,
        requestTime: Services.telemetry.msSystemNow()});
 
     // Focus the tab's content area.
-    if (aTab.selected) {
+    if (aTab.selected && !window.isBlankPageURL(uri)) {
       browser.focus();
     }
   },
 
   /**
    * Marks a given pending tab as restoring.
    *
    * @param aTab
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -1360,22 +1360,22 @@ var UITour = {
     } else if (aMenuName == "urlbar") {
       aWindow.gURLBar.closePopup();
     } else if (aMenuName == "pageActionPanel") {
       aWindow.BrowserPageActions.panelNode.hidePopup();
     }
   },
 
   showNewTab(aWindow, aBrowser) {
+    aWindow.gURLBar.focus();
     let url = "about:newtab";
     aWindow.openLinkIn(url, "current", {
       targetBrowser: aBrowser,
       triggeringPrincipal: Services.scriptSecurityManager.createCodebasePrincipal(Services.io.newURI(url), {}),
     });
-    aWindow.gURLBar.focus();
   },
 
   _hideAnnotationsForPanel(aEvent, aShouldClosePanel, aTargetPositionCallback) {
     let win = aEvent.target.ownerGlobal;
     let hideHighlightMethod = null;
     let hideInfoMethod = null;
     if (aShouldClosePanel) {
       hideHighlightMethod = aWin => this.hideHighlight(aWin);