Bug 1369751 - avoid constructing the sidebar browser before first paint, r=mikedeboer.

This commit is contained in:
Florian Quèze 2017-06-09 15:11:07 +02:00
Родитель dc628a8ae3
Коммит fc7a0af0d3
1 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -20,11 +20,23 @@
* - group this attribute must be set to "sidebar". * - group this attribute must be set to "sidebar".
*/ */
var SidebarUI = { var SidebarUI = {
browser: null, // Avoid getting the browser element from init() to avoid triggering the
// <browser> constructor during startup if the sidebar is hidden.
get browser() {
if (this._browser)
return this._browser;
return this._browser = document.getElementById("sidebar");
},
POSITION_START_PREF: "sidebar.position_start", POSITION_START_PREF: "sidebar.position_start",
_box: null, _box: null,
_title: null, // The constructor of this label accesses the browser element due to the
// control="sidebar" attribute, so avoid getting this label during startup.
get _title() {
if (this.__title)
return this.__title;
return this.__title = document.getElementById("sidebar-title");
},
_splitter: null, _splitter: null,
_icon: null, _icon: null,
_reversePositionButton: null, _reversePositionButton: null,
@ -34,8 +46,6 @@ var SidebarUI = {
init() { init() {
this._box = document.getElementById("sidebar-box"); this._box = document.getElementById("sidebar-box");
this.browser = document.getElementById("sidebar");
this._title = document.getElementById("sidebar-title");
this._splitter = document.getElementById("sidebar-splitter"); this._splitter = document.getElementById("sidebar-splitter");
this._icon = document.getElementById("sidebar-icon"); this._icon = document.getElementById("sidebar-icon");
this._reversePositionButton = document.getElementById("sidebar-reverse-position"); this._reversePositionButton = document.getElementById("sidebar-reverse-position");