[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components.

This commit is contained in:
athenian200 2020-02-06 06:40:05 -06:00 • committed by Roy Tam
commit 2ffeaf901d
4 changed files with 48 additions and 48 deletions

View file

@ -63,12 +63,12 @@ DistributionCustomizer.prototype = {
return this._ioSvc; return this._ioSvc;
}, },
_makeURI: function DIST__makeURI(spec) { _makeURI: function (spec) {
return this._ioSvc.newURI(spec, null, null); return this._ioSvc.newURI(spec, null, null);
}, },
_parseBookmarksSection: _parseBookmarksSection:
function DIST_parseBookmarksSection(parentId, section) { function (parentId, section) {
let keys = []; let keys = [];
for (let i in enumerate(this._ini.getKeys(section))) for (let i in enumerate(this._ini.getKeys(section)))
keys.push(i); keys.push(i);
@ -177,7 +177,7 @@ DistributionCustomizer.prototype = {
}, },
_customizationsApplied: false, _customizationsApplied: false,
applyCustomizations: function DIST_applyCustomizations() { applyCustomizations: function () {
this._customizationsApplied = true; this._customizationsApplied = true;
if (!this._iniFile) if (!this._iniFile)
return this._checkCustomizationComplete(); return this._checkCustomizationComplete();
@ -190,7 +190,7 @@ DistributionCustomizer.prototype = {
}, },
_bookmarksApplied: false, _bookmarksApplied: false,
applyBookmarks: function DIST_applyBookmarks() { applyBookmarks: function () {
this._bookmarksApplied = true; this._bookmarksApplied = true;
if (!this._iniFile) if (!this._iniFile)
return this._checkCustomizationComplete(); return this._checkCustomizationComplete();
@ -230,7 +230,7 @@ DistributionCustomizer.prototype = {
}, },
_prefDefaultsApplied: false, _prefDefaultsApplied: false,
applyPrefDefaults: function DIST_applyPrefDefaults() { applyPrefDefaults: function () {
this._prefDefaultsApplied = true; this._prefDefaultsApplied = true;
if (!this._iniFile) if (!this._iniFile)
return this._checkCustomizationComplete(); return this._checkCustomizationComplete();
@ -321,7 +321,7 @@ DistributionCustomizer.prototype = {
return this._checkCustomizationComplete(); return this._checkCustomizationComplete();
}, },
_checkCustomizationComplete: function DIST__checkCustomizationComplete() { _checkCustomizationComplete: function () {
let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile; let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile;
if (this._customizationsApplied && this._bookmarksApplied && if (this._customizationsApplied && this._bookmarksApplied &&
prefDefaultsApplied) { prefDefaultsApplied) {

View file

@ -80,7 +80,7 @@ AboutRedirector.prototype = {
/** /**
* Gets the module name from the given URI. * Gets the module name from the given URI.
*/ */
_getModuleName: function AboutRedirector__getModuleName(aURI) { _getModuleName: function (aURI) {
// Strip out the first ? or #, and anything following it // Strip out the first ? or #, and anything following it
let name = (/[^?#]+/.exec(aURI.path))[0]; let name = (/[^?#]+/.exec(aURI.path))[0];
return name.toLowerCase(); return name.toLowerCase();

View file

@ -278,7 +278,7 @@ nsBrowserContentHandler.prototype = {
classID: Components.ID("{5d0ce354-df01-421a-83fb-7ead0990c24e}"), classID: Components.ID("{5d0ce354-df01-421a-83fb-7ead0990c24e}"),
_xpcom_factory: { _xpcom_factory: {
createInstance: function bch_factory_ci(outer, iid) { createInstance: function (outer, iid) {
if (outer) if (outer)
throw Components.results.NS_ERROR_NO_AGGREGATION; throw Components.results.NS_ERROR_NO_AGGREGATION;
return gBrowserContentHandler.QueryInterface(iid); return gBrowserContentHandler.QueryInterface(iid);
@ -308,7 +308,7 @@ nsBrowserContentHandler.prototype = {
nsICommandLineValidator]), nsICommandLineValidator]),
/* nsICommandLineHandler */ /* nsICommandLineHandler */
handle : function bch_handle(cmdLine) { handle : function (cmdLine) {
if (cmdLine.handleFlag("browser", false)) { if (cmdLine.handleFlag("browser", false)) {
// Passing defaultArgs, so use NO_EXTERNAL_URIS // Passing defaultArgs, so use NO_EXTERNAL_URIS
openWindow(null, this.chromeURL, "_blank", openWindow(null, this.chromeURL, "_blank",
@ -601,7 +601,7 @@ nsBrowserContentHandler.prototype = {
mFeatures : null, mFeatures : null,
getFeatures : function bch_features(cmdLine) { getFeatures : function (cmdLine) {
if (this.mFeatures === null) { if (this.mFeatures === null) {
this.mFeatures = ""; this.mFeatures = "";
@ -629,7 +629,7 @@ nsBrowserContentHandler.prototype = {
/* nsIContentHandler */ /* nsIContentHandler */
handleContent : function bch_handleContent(contentType, context, request) { handleContent : function (contentType, context, request) {
try { try {
var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"] var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"]
.getService(nsIWebNavigationInfo); .getService(nsIWebNavigationInfo);
@ -647,7 +647,7 @@ nsBrowserContentHandler.prototype = {
}, },
/* nsICommandLineValidator */ /* nsICommandLineValidator */
validate : function bch_validate(cmdLine) { validate : function (cmdLine) {
// Other handlers may use osint so only handle the osint flag if the url // Other handlers may use osint so only handle the osint flag if the url
// flag is also present and the command line is valid. // flag is also present and the command line is valid.
var osintFlagIdx = cmdLine.findFlag("osint", false); var osintFlagIdx = cmdLine.findFlag("osint", false);
@ -699,7 +699,7 @@ nsDefaultCommandLineHandler.prototype = {
classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"), classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"),
/* nsISupports */ /* nsISupports */
QueryInterface : function dch_QI(iid) { QueryInterface : function (iid) {
if (!iid.equals(nsISupports) && if (!iid.equals(nsISupports) &&
!iid.equals(nsICommandLineHandler)) !iid.equals(nsICommandLineHandler))
throw Components.results.NS_ERROR_NO_INTERFACE; throw Components.results.NS_ERROR_NO_INTERFACE;
@ -712,7 +712,7 @@ nsDefaultCommandLineHandler.prototype = {
#endif #endif
/* nsICommandLineHandler */ /* nsICommandLineHandler */
handle : function dch_handle(cmdLine) { handle : function (cmdLine) {
var urilist = []; var urilist = [];
#ifdef XP_WIN #ifdef XP_WIN

View file

@ -68,7 +68,7 @@ const BOOKMARKS_BACKUP_MAX_BACKUPS = 10;
// Factory object // Factory object
const BrowserGlueServiceFactory = { const BrowserGlueServiceFactory = {
_instance: null, _instance: null,
createInstance: function BGSF_createInstance(outer, iid) { createInstance: function (outer, iid) {
if (outer != null) if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION; throw Components.results.NS_ERROR_NO_AGGREGATION;
return this._instance == null ? return this._instance == null ?
@ -113,7 +113,7 @@ BrowserGlue.prototype = {
_isPlacesDatabaseLocked: false, _isPlacesDatabaseLocked: false,
_migrationImportsDefaultBookmarks: false, _migrationImportsDefaultBookmarks: false,
_setPrefToSaveSession: function BG__setPrefToSaveSession(aForce) { _setPrefToSaveSession: function (aForce) {
if (!this._saveSession && !aForce) if (!this._saveSession && !aForce)
return; return;
@ -126,7 +126,7 @@ BrowserGlue.prototype = {
}, },
#ifdef MOZ_SERVICES_SYNC #ifdef MOZ_SERVICES_SYNC
_setSyncAutoconnectDelay: function BG__setSyncAutoconnectDelay() { _setSyncAutoconnectDelay: function () {
// Assume that a non-zero value for services.sync.autoconnectDelay should override // Assume that a non-zero value for services.sync.autoconnectDelay should override
if (Services.prefs.prefHasUserValue("services.sync.autoconnectDelay")) { if (Services.prefs.prefHasUserValue("services.sync.autoconnectDelay")) {
let prefDelay = Services.prefs.getIntPref("services.sync.autoconnectDelay"); let prefDelay = Services.prefs.getIntPref("services.sync.autoconnectDelay");
@ -150,7 +150,7 @@ BrowserGlue.prototype = {
#endif #endif
// nsIObserver implementation // nsIObserver implementation
observe: function BG_observe(subject, topic, data) { observe: function (subject, topic, data) {
switch (topic) { switch (topic) {
case "notifications-open-settings": case "notifications-open-settings":
this._openPermissions(subject); this._openPermissions(subject);
@ -323,7 +323,7 @@ BrowserGlue.prototype = {
}, },
// initialization (called on application startup) // initialization (called on application startup)
_init: function BG__init() { _init: function () {
let os = Services.obs; let os = Services.obs;
os.addObserver(this, "notifications-open-settings", false); os.addObserver(this, "notifications-open-settings", false);
os.addObserver(this, "prefservice:after-app-defaults", false); os.addObserver(this, "prefservice:after-app-defaults", false);
@ -356,7 +356,7 @@ BrowserGlue.prototype = {
}, },
// cleanup (called on application shutdown) // cleanup (called on application shutdown)
_dispose: function BG__dispose() { _dispose: function () {
let os = Services.obs; let os = Services.obs;
os.removeObserver(this, "notifications-open-settings"); os.removeObserver(this, "notifications-open-settings");
os.removeObserver(this, "prefservice:after-app-defaults"); os.removeObserver(this, "prefservice:after-app-defaults");
@ -391,7 +391,7 @@ BrowserGlue.prototype = {
} catch (ex) {} } catch (ex) {}
}, },
_onAppDefaults: function BG__onAppDefaults() { _onAppDefaults: function () {
// apply distribution customizations (prefs) // apply distribution customizations (prefs)
// other customizations are applied in _finalUIStartup() // other customizations are applied in _finalUIStartup()
this._distributionCustomizer.applyPrefDefaults(); this._distributionCustomizer.applyPrefDefaults();
@ -399,7 +399,7 @@ BrowserGlue.prototype = {
// runs on startup, before the first command line handler is invoked // runs on startup, before the first command line handler is invoked
// (i.e. before the first window is opened) // (i.e. before the first window is opened)
_finalUIStartup: function BG__finalUIStartup() { _finalUIStartup: function () {
this._sanitizer.onStartup(); this._sanitizer.onStartup();
// check if we're in safe mode // check if we're in safe mode
if (Services.appinfo.inSafeMode) { if (Services.appinfo.inSafeMode) {
@ -433,7 +433,7 @@ BrowserGlue.prototype = {
Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
}, },
_setUpUserAgentOverrides: function BG__setUpUserAgentOverrides() { _setUpUserAgentOverrides: function () {
UserAgentOverrides.init(); UserAgentOverrides.init();
if (Services.prefs.getBoolPref("general.useragent.complexOverride.moodle")) { if (Services.prefs.getBoolPref("general.useragent.complexOverride.moodle")) {
@ -507,7 +507,7 @@ BrowserGlue.prototype = {
}, },
// the first browser window has finished initializing // the first browser window has finished initializing
_onFirstWindowLoaded: function BG__onFirstWindowLoaded() { _onFirstWindowLoaded: function () {
#ifdef XP_WIN #ifdef XP_WIN
// For windows seven, initialize the jump list module. // For windows seven, initialize the jump list module.
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1"; const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
@ -529,7 +529,7 @@ BrowserGlue.prototype = {
* All components depending on Places should be shut down in * All components depending on Places should be shut down in
* _onPlacesShutdown() and not here. * _onPlacesShutdown() and not here.
*/ */
_onProfileShutdown: function BG__onProfileShutdown() { _onProfileShutdown: function () {
BrowserNewTabPreloader.uninit(); BrowserNewTabPreloader.uninit();
UserAgentOverrides.uninit(); UserAgentOverrides.uninit();
#ifdef MOZ_WEBRTC #ifdef MOZ_WEBRTC
@ -541,7 +541,7 @@ BrowserGlue.prototype = {
}, },
// All initial windows have opened. // All initial windows have opened.
_onWindowsRestored: function BG__onWindowsRestored() { _onWindowsRestored: function () {
// Show update notification, if needed. // Show update notification, if needed.
if (Services.prefs.prefHasUserValue("app.update.postupdate")) if (Services.prefs.prefHasUserValue("app.update.postupdate"))
this._showUpdateNotification(); this._showUpdateNotification();
@ -644,7 +644,7 @@ BrowserGlue.prototype = {
} }
}, },
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) { _onQuitRequest: function (aCancelQuit, aQuitType) {
// If user has already dismissed quit request, then do nothing // If user has already dismissed quit request, then do nothing
if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data) if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
return; return;
@ -776,7 +776,7 @@ BrowserGlue.prototype = {
} }
}, },
_showUpdateNotification: function BG__showUpdateNotification() { _showUpdateNotification: function () {
Services.prefs.clearUserPref("app.update.postupdate"); Services.prefs.clearUserPref("app.update.postupdate");
var um = Cc["@mozilla.org/updates/update-manager;1"]. var um = Cc["@mozilla.org/updates/update-manager;1"].
@ -877,7 +877,7 @@ BrowserGlue.prototype = {
} }
}, },
_showPluginUpdatePage: function BG__showPluginUpdatePage() { _showPluginUpdatePage: function () {
// Pale Moon: disable this functionality from BrowserGlue, people are // Pale Moon: disable this functionality from BrowserGlue, people are
// already notified if they visit a page with an outdated plugin, and // already notified if they visit a page with an outdated plugin, and
// they can check properly from the plugins page as well. // they can check properly from the plugins page as well.
@ -912,7 +912,7 @@ BrowserGlue.prototype = {
* Set to true by safe-mode dialog to indicate we must restore default * Set to true by safe-mode dialog to indicate we must restore default
* bookmarks. * bookmarks.
*/ */
_initPlaces: function BG__initPlaces(aInitialMigrationPerformed) { _initPlaces: function (aInitialMigrationPerformed) {
// We must instantiate the history service since it will tell us if we // We must instantiate the history service since it will tell us if we
// need to import or restore bookmarks due to first-run, corruption or // need to import or restore bookmarks due to first-run, corruption or
// forced migration (due to a major schema change). // forced migration (due to a major schema change).
@ -1078,7 +1078,7 @@ BrowserGlue.prototype = {
* - export bookmarks as HTML, if so configured. * - export bookmarks as HTML, if so configured.
* - finalize components depending on Places. * - finalize components depending on Places.
*/ */
_onPlacesShutdown: function BG__onPlacesShutdown() { _onPlacesShutdown: function () {
this._sanitizer.onShutdown(); this._sanitizer.onShutdown();
PageThumbs.uninit(); PageThumbs.uninit();
@ -1134,7 +1134,7 @@ BrowserGlue.prototype = {
* Determine whether to backup bookmarks or not. * Determine whether to backup bookmarks or not.
* @return true if bookmarks should be backed up, false if not. * @return true if bookmarks should be backed up, false if not.
*/ */
_shouldBackupBookmarks: function BG__shouldBackupBookmarks() { _shouldBackupBookmarks: function () {
let lastBackupFile = PlacesBackups.getMostRecent(); let lastBackupFile = PlacesBackups.getMostRecent();
// Should backup bookmarks if there are no backups or the maximum interval between // Should backup bookmarks if there are no backups or the maximum interval between
@ -1146,7 +1146,7 @@ BrowserGlue.prototype = {
/** /**
* Backup bookmarks. * Backup bookmarks.
*/ */
_backupBookmarks: function BG__backupBookmarks() { _backupBookmarks: function () {
return Task.spawn(function() { return Task.spawn(function() {
// Backup bookmarks if there are no backups or the maximum interval between // Backup bookmarks if there are no backups or the maximum interval between
// backups elapsed. // backups elapsed.
@ -1163,7 +1163,7 @@ BrowserGlue.prototype = {
/** /**
* Show the notificationBox for a locked places database. * Show the notificationBox for a locked places database.
*/ */
_showPlacesLockedNotificationBox: function BG__showPlacesLockedNotificationBox() { _showPlacesLockedNotificationBox: function () {
var applicationName = gBrandBundle.GetStringFromName("brandShortName"); var applicationName = gBrandBundle.GetStringFromName("brandShortName");
var placesBundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties"); var placesBundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
var title = placesBundle.GetStringFromName("lockPrompt.title"); var title = placesBundle.GetStringFromName("lockPrompt.title");
@ -1197,7 +1197,7 @@ BrowserGlue.prototype = {
notification.persistence = -1; // Until user closes it notification.persistence = -1; // Until user closes it
}, },
_migrateUI: function BG__migrateUI() { _migrateUI: function () {
const UI_VERSION = 22; const UI_VERSION = 22;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#"; const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0; let currentUIVersion = 0;
@ -1477,7 +1477,7 @@ BrowserGlue.prototype = {
Services.prefs.setIntPref("browser.migration.version", UI_VERSION); Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
}, },
_hasExistingNotificationPermission: function BG__hasExistingNotificationPermission() { _hasExistingNotificationPermission: function () {
let enumerator = Services.perms.enumerator; let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) { while (enumerator.hasMoreElements()) {
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission); let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
@ -1488,7 +1488,7 @@ BrowserGlue.prototype = {
return false; return false;
}, },
_notifyNotificationsUpgrade: function BG__notifyNotificationsUpgrade() { _notifyNotificationsUpgrade: function () {
if (!this._hasExistingNotificationPermission()) { if (!this._hasExistingNotificationPermission()) {
return; return;
} }
@ -1533,14 +1533,14 @@ BrowserGlue.prototype = {
return false; return false;
}, },
_getPersist: function BG__getPersist(aSource, aProperty) { _getPersist: function (aSource, aProperty) {
var target = this._dataSource.GetTarget(aSource, aProperty, true); var target = this._dataSource.GetTarget(aSource, aProperty, true);
if (target instanceof Ci.nsIRDFLiteral) if (target instanceof Ci.nsIRDFLiteral)
return target.Value; return target.Value;
return null; return null;
}, },
_setPersist: function BG__setPersist(aSource, aProperty, aTarget) { _setPersist: function (aSource, aProperty, aTarget) {
this._dirty = true; this._dirty = true;
try { try {
var oldTarget = this._dataSource.GetTarget(aSource, aProperty, true); var oldTarget = this._dataSource.GetTarget(aSource, aProperty, true);
@ -1570,12 +1570,12 @@ BrowserGlue.prototype = {
// public nsIBrowserGlue members // public nsIBrowserGlue members
// ------------------------------ // ------------------------------
sanitize: function BG_sanitize(aParentWindow) { sanitize: function (aParentWindow) {
this._sanitizer.sanitize(aParentWindow); this._sanitizer.sanitize(aParentWindow);
}, },
ensurePlacesDefaultQueriesInitialized: ensurePlacesDefaultQueriesInitialized:
function BG_ensurePlacesDefaultQueriesInitialized() { function () {
// This is actual version of the smart bookmarks, must be increased every // This is actual version of the smart bookmarks, must be increased every
// time smart bookmarks change. // time smart bookmarks change.
// When adding a new smart bookmark below, its newInVersion property must // When adding a new smart bookmark below, its newInVersion property must
@ -1610,7 +1610,7 @@ BrowserGlue.prototype = {
} }
let batch = { let batch = {
runBatched: function BG_EPDQI_runBatched() { runBatched: function () {
let menuIndex = 0; let menuIndex = 0;
let toolbarIndex = 0; let toolbarIndex = 0;
let bundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties"); let bundle = Services.strings.createBundle("chrome://browser/locale/places/places.properties");
@ -1732,7 +1732,7 @@ BrowserGlue.prototype = {
}, },
// this returns the most recent non-popup browser window // this returns the most recent non-popup browser window
getMostRecentBrowserWindow: function BG_getMostRecentBrowserWindow() { getMostRecentBrowserWindow: function () {
return RecentWindow.getMostRecentBrowserWindow(); return RecentWindow.getMostRecentBrowserWindow();
}, },
@ -1748,7 +1748,7 @@ BrowserGlue.prototype = {
* lesser evil than sending a tab to a specific device (from e.g. Fennec) * lesser evil than sending a tab to a specific device (from e.g. Fennec)
* and having nothing happen on the receiving end. * and having nothing happen on the receiving end.
*/ */
_onDisplaySyncURI: function _onDisplaySyncURI(data) { _onDisplaySyncURI: function (data) {
try { try {
let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser; let tabbrowser = RecentWindow.getMostRecentBrowserWindow({private: false}).gBrowser;
@ -1778,7 +1778,7 @@ ContentPermissionPrompt.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
_getChromeWindow: function CPP_getChromeWindow(aWindow) { _getChromeWindow: function (aWindow) {
var chromeWin = aWindow var chromeWin = aWindow
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
@ -1814,7 +1814,7 @@ ContentPermissionPrompt.prototype = {
* @param aAnchorId The id for the PopupNotification anchor. * @param aAnchorId The id for the PopupNotification anchor.
* @param aOptions Options for the PopupNotification * @param aOptions Options for the PopupNotification
*/ */
_showPrompt: function CPP_showPrompt(aRequest, aMessage, aPermission, aActions, _showPrompt: function (aRequest, aMessage, aPermission, aActions,
aNotificationId, aAnchorId, aOptions) { aNotificationId, aAnchorId, aOptions) {
function onFullScreen() { function onFullScreen() {
popup.remove(); popup.remove();
@ -2005,7 +2005,7 @@ ContentPermissionPrompt.prototype = {
"web-notifications-notification-icon", options); "web-notifications-notification-icon", options);
}, },
_promptPointerLock: function CPP_promtPointerLock(aRequest, autoAllow) { _promptPointerLock: function (aRequest, autoAllow) {
let requestingURI = aRequest.principal.URI; let requestingURI = aRequest.principal.URI;
let originString = requestingURI.schemeIs("file") ? requestingURI.path : requestingURI.host; let originString = requestingURI.schemeIs("file") ? requestingURI.path : requestingURI.host;
@ -2042,7 +2042,7 @@ ContentPermissionPrompt.prototype = {
"pointerLock-notification-icon", null); "pointerLock-notification-icon", null);
}, },
prompt: function CPP_prompt(request) { prompt: function (request) {
// Only allow exactly one permission rquest here. // Only allow exactly one permission rquest here.
let types = request.types.QueryInterface(Ci.nsIArray); let types = request.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) { if (types.length != 1) {