diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js
index 7762c1e85f52..dc1350493897 100644
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -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 {
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 147938521b54..16267e5f9426 100755
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -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",
diff --git a/browser/base/content/global-scripts.inc b/browser/base/content/global-scripts.inc
index 7624432fac8f..11925da2239a 100755
--- a/browser/base/content/global-scripts.inc
+++ b/browser/base/content/global-scripts.inc
@@ -7,7 +7,6 @@
# file so that ESLint works correctly:
# tools/lint/eslint/eslint-plugin-mozilla/lib/environments/browser-window.js
-
diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js
index 615d32bb9e60..5d9ec28cd3b8 100644
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.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.