Bug 1381853 - lazy load browserPlacesViews.js into the browser window, r=mconley.

This commit is contained in:
Florian Quèze 2017-07-23 00:17:56 +02:00
Родитель d31ab0dd40
Коммит c41a960d40
4 изменённых файлов: 13 добавлений и 5 удалений

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

@ -2,6 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file is loaded into the browser window scope.
/* eslint-env mozilla/browser-window */
XPCOMUtils.defineLazyScriptGetter(this, ["PlacesToolbar", "PlacesMenu",
"PlacesPanelview", "PlacesPanelMenuView"],
"chrome://browser/content/places/browserPlacesViews.js");
var StarUI = {
_itemId: -1,
uri: null,
@ -1939,6 +1946,11 @@ var BookmarkingUI = {
let query = "place:queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
"&maxResults=42&excludeQueries=1";
// XPCOMUtils.defineLazyScriptGetter can't return class constructors, so
// trigger the getter once without using the result before calling
// PlacesPanelview as a constructor.
PlacesPanelview;
this._panelMenuView = new PlacesPanelview(document.getElementById("panelMenu_bookmarksMenu"),
panelview, query);
} else {

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

@ -12,6 +12,7 @@ var Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/NotificationDB.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",

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

@ -7,7 +7,6 @@
# file so that ESLint works correctly:
# tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
<script type="application/javascript" src="chrome://browser/content/places/browserPlacesViews.js"/>
<script type="application/javascript" src="chrome://browser/content/browser.js"/>
<script type="application/javascript" src="chrome://browser/content/customizableui/panelUI.js"/>
<script type="application/javascript" src="chrome://global/content/viewSourceUtils.js"/>

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

@ -4,10 +4,6 @@
/* eslint-env mozilla/browser-window */
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
/**
* The base view implements everything that's common to the toolbar and
* menu views.