mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/components/migration.
This commit is contained in:
parent
7b4185d1ff
commit
0682c46bab
5 changed files with 30 additions and 30 deletions
|
|
@ -167,7 +167,7 @@ ChromeProfileMigrator.prototype.getLastUsedDate =
|
|||
};
|
||||
|
||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
|
||||
get: function Chrome_sourceProfiles() {
|
||||
get: function() {
|
||||
if ("__sourceProfiles" in this)
|
||||
return this.__sourceProfiles;
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
|
|||
});
|
||||
|
||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
|
||||
get: function Chrome_sourceHomePageURL() {
|
||||
get: function() {
|
||||
let prefsFile = this._chromeUserDataFolder.clone();
|
||||
prefsFile.append("Preferences");
|
||||
if (prefsFile.exists()) {
|
||||
|
|
@ -243,7 +243,7 @@ Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
|
|||
});
|
||||
|
||||
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceLocked", {
|
||||
get: function Chrome_sourceLocked() {
|
||||
get: function() {
|
||||
// There is an exclusive lock on some SQLite databases. Assume they are locked for now.
|
||||
return true;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ History.prototype = {
|
|||
return true;
|
||||
},
|
||||
|
||||
migrate: function H_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
let places = [];
|
||||
let typedURLs = MSMigrationUtils.getTypedURLs("Software\\Microsoft\\Internet Explorer");
|
||||
let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
|
||||
|
|
@ -349,7 +349,7 @@ Settings.prototype = {
|
|||
return true;
|
||||
},
|
||||
|
||||
migrate: function S_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
// Converts from yes/no to a boolean.
|
||||
let yesNoToBoolean = v => v == "yes";
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ Settings.prototype = {
|
|||
* @param [optional] aTransformFn
|
||||
* Conversion function from the Registry format to the pref format.
|
||||
*/
|
||||
_set: function S__set(aPath, aKey, aPref, aTransformFn) {
|
||||
_set: function(aPath, aKey, aPref, aTransformFn) {
|
||||
let value = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
||||
aPath, aKey);
|
||||
// Don't import settings that have never been flipped.
|
||||
|
|
@ -509,7 +509,7 @@ IEProfileMigrator.prototype.getLastUsedDate = function IE_getLastUsedDate() {
|
|||
};
|
||||
|
||||
Object.defineProperty(IEProfileMigrator.prototype, "sourceHomePageURL", {
|
||||
get: function IE_get_sourceHomePageURL() {
|
||||
get: function() {
|
||||
let defaultStartPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
|
||||
kMainKey, "Default_Page_URL");
|
||||
let startPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ Bookmarks.prototype = {
|
|||
return this.__toolbarFolderName;
|
||||
},
|
||||
|
||||
migrate: function B_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
return Task.spawn(function* () {
|
||||
// Import to the bookmarks menu.
|
||||
let folderGuid = PlacesUtils.bookmarks.menuGuid;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ this.MigratorPrototype = {
|
|||
* aProfile is a value returned by the sourceProfiles getter (see
|
||||
* above).
|
||||
*/
|
||||
getResources: function MP_getResources(/* aProfile */) {
|
||||
getResources: function(/* aProfile */) {
|
||||
throw new Error("getResources must be overridden");
|
||||
},
|
||||
|
||||
|
|
@ -203,7 +203,7 @@ this.MigratorPrototype = {
|
|||
*
|
||||
* @see nsIBrowserProfileMigrator
|
||||
*/
|
||||
getMigrateData: function MP_getMigrateData(aProfile) {
|
||||
getMigrateData: function(aProfile) {
|
||||
let resources = this._getMaybeCachedResources(aProfile);
|
||||
if (!resources) {
|
||||
return [];
|
||||
|
|
@ -212,7 +212,7 @@ this.MigratorPrototype = {
|
|||
return types.reduce((a, b) => { a |= b; return a }, 0);
|
||||
},
|
||||
|
||||
getBrowserKey: function MP_getBrowserKey() {
|
||||
getBrowserKey: function() {
|
||||
return this.contractID.match(/\=([^\=]+)$/)[1];
|
||||
},
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ this.MigratorPrototype = {
|
|||
*
|
||||
* @see nsIBrowserProfileMigrator
|
||||
*/
|
||||
migrate: function MP_migrate(aItems, aStartup, aProfile) {
|
||||
migrate: function(aItems, aStartup, aProfile) {
|
||||
let resources = this._getMaybeCachedResources(aProfile);
|
||||
if (resources.length == 0)
|
||||
throw new Error("migrate called for a non-existent source");
|
||||
|
|
@ -426,7 +426,7 @@ this.MigratorPrototype = {
|
|||
},
|
||||
|
||||
/** * PRIVATE STUFF - DO NOT OVERRIDE ***/
|
||||
_getMaybeCachedResources: function PMB__getMaybeCachedResources(aProfile) {
|
||||
_getMaybeCachedResources: function(aProfile) {
|
||||
let profileKey = aProfile ? aProfile.id : "";
|
||||
if (this._resourcesByProfile) {
|
||||
if (profileKey in this._resourcesByProfile)
|
||||
|
|
@ -487,7 +487,7 @@ this.MigrationUtils = Object.freeze({
|
|||
* the callback function passed to |migrate|.
|
||||
* @return the wrapped function.
|
||||
*/
|
||||
wrapMigrateFunction: function MU_wrapMigrateFunction(aFunction, aCallback) {
|
||||
wrapMigrateFunction: function(aFunction, aCallback) {
|
||||
return function() {
|
||||
let success = false;
|
||||
try {
|
||||
|
|
@ -520,7 +520,7 @@ this.MigrationUtils = Object.freeze({
|
|||
*
|
||||
* @see nsIStringBundle
|
||||
*/
|
||||
getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
|
||||
getLocalizedString: function(aKey, aReplacements) {
|
||||
aKey = aKey.replace(/_(canary|chromium)$/, "_chrome");
|
||||
|
||||
const OVERRIDES = {
|
||||
|
|
@ -678,7 +678,7 @@ this.MigrationUtils = Object.freeze({
|
|||
* @return profile migrator implementing nsIBrowserProfileMigrator, if it can
|
||||
* import any data, null otherwise.
|
||||
*/
|
||||
getMigrator: function MU_getMigrator(aKey) {
|
||||
getMigrator: function(aKey) {
|
||||
let migrator = null;
|
||||
if (this._migrators.has(aKey)) {
|
||||
migrator = this._migrators.get(aKey);
|
||||
|
|
@ -1071,7 +1071,7 @@ this.MigrationUtils = Object.freeze({
|
|||
/**
|
||||
* Cleans up references to migrators and nsIProfileInstance instances.
|
||||
*/
|
||||
finishMigration: function MU_finishMigration() {
|
||||
finishMigration: function() {
|
||||
gMigrators = null;
|
||||
gProfileStartup = null;
|
||||
gMigrationBundle = null;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function Bookmarks(aBookmarksFile) {
|
|||
Bookmarks.prototype = {
|
||||
type: MigrationUtils.resourceTypes.BOOKMARKS,
|
||||
|
||||
migrate: function B_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
return Task.spawn(function* () {
|
||||
let dict = yield new Promise(resolve =>
|
||||
PropertyListUtils.read(this._file, resolve)
|
||||
|
|
@ -188,7 +188,7 @@ History.prototype = {
|
|||
// Helper method for converting the visit date property to a PRTime value.
|
||||
// The visit date is stored as a string, so it's not read as a Date
|
||||
// object by PropertyListUtils.
|
||||
_parseCocoaDate: function H___parseCocoaDate(aCocoaDateStr) {
|
||||
_parseCocoaDate: function(aCocoaDateStr) {
|
||||
let asDouble = parseFloat(aCocoaDateStr);
|
||||
if (!isNaN(asDouble)) {
|
||||
// reference date of NSDate.
|
||||
|
|
@ -199,7 +199,7 @@ History.prototype = {
|
|||
return 0;
|
||||
},
|
||||
|
||||
migrate: function H_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
PropertyListUtils.read(this._file, function migrateHistory(aDict) {
|
||||
try {
|
||||
if (!aDict)
|
||||
|
|
@ -270,7 +270,7 @@ MainPreferencesPropertyList.prototype = {
|
|||
/**
|
||||
* @see PropertyListUtils.read
|
||||
*/
|
||||
read: function MPPL_read(aCallback) {
|
||||
read: function(aCallback) {
|
||||
if ("_dict" in this) {
|
||||
aCallback(this._dict);
|
||||
return;
|
||||
|
|
@ -296,7 +296,7 @@ MainPreferencesPropertyList.prototype = {
|
|||
|
||||
// Workaround for nsIBrowserProfileMigrator.sourceHomePageURL until
|
||||
// it's replaced with an async method.
|
||||
_readSync: function MPPL__readSync() {
|
||||
_readSync: function() {
|
||||
if ("_dict" in this)
|
||||
return this._dict;
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ function Preferences(aMainPreferencesPropertyListInstance) {
|
|||
Preferences.prototype = {
|
||||
type: MigrationUtils.resourceTypes.SETTINGS,
|
||||
|
||||
migrate: function MPR_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
this._mainPreferencesPropertyList.read(aDict => {
|
||||
Task.spawn(function* () {
|
||||
if (!aDict)
|
||||
|
|
@ -370,7 +370,7 @@ Preferences.prototype = {
|
|||
* at all.
|
||||
* @return whether or not aMozPref was set.
|
||||
*/
|
||||
_set: function MPR_set(aSafariKey, aMozPref, aConvertFunction) {
|
||||
_set: function(aSafariKey, aMozPref, aConvertFunction) {
|
||||
if (this._dict.has(aSafariKey)) {
|
||||
let safariVal = this._dict.get(aSafariKey);
|
||||
let mozVal = aConvertFunction !== undefined ?
|
||||
|
|
@ -417,7 +417,7 @@ Preferences.prototype = {
|
|||
// we set it for all languages.
|
||||
// As for the font type of the default font (serif/sans-serif), the default
|
||||
// type for the given language is used (set in font.default.LANGGROUP).
|
||||
_migrateFontSettings: function MPR__migrateFontSettings() {
|
||||
_migrateFontSettings: function() {
|
||||
// If "Never use font sizes smaller than [ ] is set", migrate it for all
|
||||
// languages.
|
||||
if (this._dict.has("WebKitMinimumFontSize")) {
|
||||
|
|
@ -453,7 +453,7 @@ Preferences.prototype = {
|
|||
},
|
||||
|
||||
// Get the language group for the system locale.
|
||||
_getLocaleLangGroup: function MPR__getLocaleLangGroup() {
|
||||
_getLocaleLangGroup: function() {
|
||||
let locale = Services.locale.getLocaleComponentForUserAgent();
|
||||
|
||||
// See nsLanguageAtomService::GetLanguageGroup
|
||||
|
|
@ -506,7 +506,7 @@ function SearchStrings(aMainPreferencesPropertyListInstance) {
|
|||
SearchStrings.prototype = {
|
||||
type: MigrationUtils.resourceTypes.OTHERDATA,
|
||||
|
||||
migrate: function SS_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
this._mainPreferencesPropertyList.read(MigrationUtils.wrapMigrateFunction(
|
||||
function migrateSearchStrings(aDict) {
|
||||
if (!aDict)
|
||||
|
|
@ -534,7 +534,7 @@ function WebFoundationCookieBehavior(aWebFoundationFile) {
|
|||
WebFoundationCookieBehavior.prototype = {
|
||||
type: MigrationUtils.resourceTypes.SETTINGS,
|
||||
|
||||
migrate: function WFPL_migrate(aCallback) {
|
||||
migrate: function(aCallback) {
|
||||
PropertyListUtils.read(this._file, MigrationUtils.wrapMigrateFunction(
|
||||
function migrateCookieBehavior(aDict) {
|
||||
if (!aDict)
|
||||
|
|
@ -614,7 +614,7 @@ SafariProfileMigrator.prototype.getLastUsedDate = function SM_getLastUsedDate()
|
|||
};
|
||||
|
||||
Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyList", {
|
||||
get: function get_mainPreferencesPropertyList() {
|
||||
get: function() {
|
||||
if (this._mainPreferencesPropertyList === undefined) {
|
||||
let file = FileUtils.getDir("UsrPrfs", [], false);
|
||||
if (file.exists()) {
|
||||
|
|
@ -633,7 +633,7 @@ Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyL
|
|||
});
|
||||
|
||||
Object.defineProperty(SafariProfileMigrator.prototype, "sourceHomePageURL", {
|
||||
get: function get_sourceHomePageURL() {
|
||||
get: function() {
|
||||
if (this.mainPreferencesPropertyList) {
|
||||
let dict = this.mainPreferencesPropertyList._readSync();
|
||||
if (dict.has("HomePage"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue