Skip to content

Commit

Permalink
Bug 1394207 - Export a function to show the sidebar without firing fo…
Browse files Browse the repository at this point in the history
…cus for session restore;r=Gijs

MozReview-Commit-ID: uHrShpl2xJ

--HG--
extra : rebase_source : b9a79d541171982c6860edec366722821844f3e1
  • Loading branch information
bgrins committed Sep 6, 2017
1 parent 935f53a commit 2ed7602
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions browser/base/content/browser-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ var SidebarUI = {
}

this._box.setAttribute("width", sourceUI._box.boxObject.width);
this._show(commandID);
this.showInitially(commandID);

return true;
},
Expand Down Expand Up @@ -229,7 +229,7 @@ var SidebarUI = {
}

if (document.getElementById(commandID)) {
this._show(commandID);
this.showInitially(commandID);
} else {
// Remove the |sidebarcommand| attribute, because the element it
// refers to no longer exists, so we should assume this sidebar
Expand Down Expand Up @@ -335,6 +335,17 @@ var SidebarUI = {
});
},

/**
* Show the sidebar, without firing the focused event or logging telemetry.
* This is intended to be used when the sidebar is opened automatically
* when a window opens (not triggered by user interaction).
*
* @param {string} commandID ID of the xul:broadcaster element to use.
*/
showInitially(commandID) {
return this._show(commandID);
},

/**
* Implementation for show. Also used internally for sidebars that are shown
* when a window is opened and we don't want to ping telemetry.
Expand Down
2 changes: 1 addition & 1 deletion browser/components/sessionstore/SessionStore.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -4087,7 +4087,7 @@ var SessionStoreInternal = {
}
var sidebar = aWindow.document.getElementById("sidebar-box");
if (sidebar.getAttribute("sidebarcommand") != aSidebar) {
aWindow.SidebarUI.show(aSidebar);
aWindow.SidebarUI.showInitially(aSidebar);
}
// since resizing/moving a window brings it to the foreground,
// we might want to re-focus the last focused window
Expand Down

0 comments on commit 2ed7602

Please sign in to comment.