Bug 1472212 - Prevent focusing on the tab's content area during session restoration for special URLs for new tabs. draft
authorJay Lim <jlim@mozilla.com>
Fri, 20 Jul 2018 19:47:56 -0400
changeset 828639 0253c55229c44128e9c08a17d449cd24f9c7857b
parent 828638 9f15e83ed961d4c5eb1408bfc5412eefaa95f99c
child 828640 90336537ec96d82c9a7e73ae3a634c5b2a4fb489
push id118687
push userbmo:jay@imjching.com
push dateSun, 12 Aug 2018 15:25:52 +0000
bugs1472212
milestone63.0a1
Bug 1472212 - Prevent focusing on the tab's content area during session restoration for special URLs for new tabs. 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
@@ -4064,17 +4064,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
@@ -1359,18 +1359,18 @@ var UITour = {
     } else if (aMenuName == "urlbar") {
       aWindow.gURLBar.closePopup();
     } else if (aMenuName == "pageActionPanel") {
       aWindow.BrowserPageActions.panelNode.hidePopup();
     }
   },
 
   showNewTab(aWindow, aBrowser) {
+    aWindow.gURLBar.focus();
     aWindow.openLinkIn("about:newtab", "current", {targetBrowser: aBrowser});
-    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);