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