Bug 1325374 - Specify more globals in browser.js/nsBrowserGlue.js, and start fixing up some of places. r=mossop

MozReview-Commit-ID: C22lTfaUzHB

--HG--
extra : rebase_source : 8d186d18814a84363ebf2657dd7584a26edd845f
This commit is contained in:
Mark Banner 2016-12-22 12:14:05 +00:00
parent 59a8c923af
commit 071c48e792
7 changed files with 62 additions and 2 deletions

View File

@ -6,12 +6,34 @@
var Ci = Components.interfaces;
var Cu = Components.utils;
var Cc = Components.classes;
var Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/ContextualIdentityService.jsm");
Cu.import("resource://gre/modules/NotificationDB.jsm");
// lazy module getters
/* global AboutHome:false, AddonWatcher:false, AppConstants: false,
BrowserUITelemetry:false, BrowserUsageTelemetry:false, BrowserUtils:false,
CastingApps:false, CharsetMenu:false, Color:false, ContentSearch:false,
Deprecated:false, E10SUtils:false, FormValidationHandler:false,
GMPInstallManager:false, LightweightThemeManager:false, Log:false,
LoginManagerParent:false, NewTabUtils:false, PageThumbs:false,
PluralForm:false, Preferences:false, PrivateBrowsingUtils:false,
ProcessHangMonitor:false, PromiseUtils:false, ReaderMode:false,
ReaderParent:false, RecentWindow:false, SessionStore:false,
ShortcutUtils:false, SimpleServiceDiscovery:false, SitePermissions:false,
Social:false, TabCrashHandler:false, Task:false, TelemetryStopwatch:false,
Translation:false, UITour:false, UpdateUtils:false, Weave:false,
fxAccounts:false, gDevTools:false, gDevToolsBrowser:false, webrtcUI:false
*/
/**
* IF YOU ADD OR REMOVE FROM THIS LIST, PLEASE UPDATE THE LIST ABOVE AS WELL.
* XXX Bug 1325373 is for making eslint detect these automatically.
*/
[
["AboutHome", "resource:///modules/AboutHome.jsm"],
["AddonWatcher", "resource://gre/modules/AddonWatcher.jsm"],
@ -67,6 +89,14 @@ if (AppConstants.MOZ_CRASHREPORTER) {
}
// lazy service getters
/* global Favicons:false, WindowsUIUtils:false, gAboutNewTabService:false,
gDNSService:false
*/
/**
* IF YOU ADD OR REMOVE FROM THIS LIST, PLEASE UPDATE THE LIST ABOVE AS WELL.
* XXX Bug 1325373 is for making eslint detect these automatically.
*/
[
["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"],
["WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],

View File

@ -18,6 +18,28 @@ XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", "@mozilla.org/windows
XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-service;1", "nsIAlertsService");
// lazy module getters
/* global AboutHome:false, AboutNewTab:false, AddonManager:false, AddonWatcher:false,
AsyncShutdown:false, AutoCompletePopup:false, BookmarkHTMLUtils:false,
BookmarkJSONUtils:false, BrowserUITelemetry:false, BrowserUsageTelemetry:false,
CaptivePortalWatcher:false, ContentClick:false, ContentPrefServiceParent:false,
ContentSearch:false, DateTimePickerHelper:false, DirectoryLinksProvider:false,
Feeds:false, FileUtils:false, FormValidationHandler:false, Integration:false,
LightweightThemeManager:false, LoginHelper:false, LoginManagerParent:false,
NetUtil:false, NewTabMessages:false, NewTabUtils:false, OS:false,
PageThumbs:false, PdfJs:false, PermissionUI:false, PlacesBackups:false,
PlacesUtils:false, PluralForm:false, PrivateBrowsingUtils:false,
ProcessHangMonitor:false, ReaderParent:false, RecentWindow:false,
RemotePrompt:false, SelfSupportBackend:false, SessionStore:false,
ShellService:false, SimpleServiceDiscovery:false, TabCrashHandler:false,
Task:false, UITour:false, URLBarZoom:false, WebChannel:false,
WindowsRegistry:false, webrtcUI:false */
/**
* IF YOU ADD OR REMOVE FROM THIS LIST, PLEASE UPDATE THE LIST ABOVE AS WELL.
* XXX Bug 1325373 is for making eslint detect these automatically.
*/
[
["AboutHome", "resource:///modules/AboutHome.jsm"],
["AboutNewTab", "resource:///modules/AboutNewTab.jsm"],

View File

@ -5,6 +5,11 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise",
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
// Imported via PlacesOverlay.xul
/* global doGetPlacesControllerForCommand:false, PlacesControllerDragHelper:false,
PlacesUIUtils:false
*/
// We need to cache this before test runs...
var cachedLeftPaneFolderIdGetter;
var getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");

View File

@ -12,6 +12,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/LoadContextInfo.jsm");
// Import common head.
/* import-globals-from ../../../../../toolkit/components/places/tests/head_common.js */
var commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false);
if (commonFile) {
let uri = Services.io.newFileURI(commonFile);

View File

@ -134,7 +134,8 @@ module.exports = {
// comment directives
if (type == "BlockComment") {
let value = node.value.trim();
let match = /^globals?\s+(.+)$/.exec(value);
value = value.replace(/\n/g, '');
let match = /^globals?\s+(.+)/.exec(value);
if (match) {
let values = parseBooleanConfig(match[1].trim(), node);
for (let name of Object.keys(values)) {

View File

@ -23,6 +23,7 @@ var definitions = [
/^loader\.lazyRequireGetter\(this, "(\w+)"/,
/^XPCOMUtils\.defineLazyGetter\(this, "(\w+)"/,
/^XPCOMUtils\.defineLazyModuleGetter\(this, "(\w+)"/,
/^XPCOMUtils\.defineLazyPreferenceGetter\(this, "(\w+)"/,
/^XPCOMUtils\.defineLazyServiceGetter\(this, "(\w+)"/,
/^XPCOMUtils\.defineConstant\(this, "(\w+)"/,
/^DevToolsUtils\.defineLazyModuleGetter\(this, "(\w+)"/,

View File

@ -169,7 +169,7 @@
"passwords.jsm": ["Password", "DumpPasswords"],
"PdfJsNetwork.jsm": ["NetworkManager"],
"PhoneNumberMetaData.jsm": ["PHONE_NUMBER_META_DATA"],
"PlacesUtils.jsm": ["PlacesUtils", "PlacesAggregatedTransaction", "PlacesCreateFolderTransaction", "PlacesCreateBookmarkTransaction", "PlacesCreateSeparatorTransaction", "PlacesCreateLivemarkTransaction", "PlacesMoveItemTransaction", "PlacesRemoveItemTransaction", "PlacesEditItemTitleTransaction", "PlacesEditBookmarkURITransaction", "PlacesSetItemAnnotationTransaction", "PlacesSetPageAnnotationTransaction", "PlacesEditBookmarkKeywordTransaction", "PlacesEditBookmarkPostDataTransaction", "PlacesEditItemDateAddedTransaction", "PlacesEditItemLastModifiedTransaction", "PlacesSortFolderByNameTransaction", "PlacesTagURITransaction", "PlacesUntagURITransaction"],
"PlacesUtils.jsm": ["PlacesUtils", "PlacesAggregatedTransaction", "PlacesCreateFolderTransaction", "PlacesCreateBookmarkTransaction", "PlacesCreateSeparatorTransaction", "PlacesCreateLivemarkTransaction", "PlacesMoveItemTransaction", "PlacesRemoveItemTransaction", "PlacesEditItemTitleTransaction", "PlacesEditBookmarkURITransaction", "PlacesEditLivemarkFeedURITransaction", "PlacesEditLivemarkSiteURITransaction", "PlacesSetItemAnnotationTransaction", "PlacesSetPageAnnotationTransaction", "PlacesEditBookmarkKeywordTransaction", "PlacesEditBookmarkPostDataTransaction", "PlacesEditItemDateAddedTransaction", "PlacesEditItemLastModifiedTransaction", "PlacesSortFolderByNameTransaction", "PlacesTagURITransaction", "PlacesUntagURITransaction"],
"PluginProvider.jsm": [],
"PointerAdapter.jsm": ["PointerRelay", "PointerAdapter"],
"policies.js": ["ErrorHandler", "SyncScheduler"],