Bug 1276701 - Remove Windows code from Safari migrator. r=Gijs

MozReview-Commit-ID: CuV2xSmXnq
This commit is contained in:
Jinank Jain 2016-08-23 14:49:39 -07:00
Родитель 4fab0b64e1
Коммит 3fc0725787
4 изменённых файлов: 11 добавлений и 62 удалений

Просмотреть файл

@ -33,7 +33,7 @@ var gMigrationBundle = null;
XPCOMUtils.defineLazyGetter(this, "gAvailableMigratorKeys", function() {
if (AppConstants.platform == "win") {
return [
"firefox", "edge", "ie", "chrome", "chromium", "safari", "360se",
"firefox", "edge", "ie", "chrome", "chromium", "360se",
"canary"
];
}
@ -547,7 +547,7 @@ this.MigrationUtils = Object.freeze({
* @param aKey internal name of the migration source.
* Supported values: ie (windows),
* edge (windows),
* safari (mac/windows),
* safari (mac),
* canary (mac/windows),
* chrome (mac/windows/linux),
* chromium (mac/windows/linux),

Просмотреть файл

@ -346,22 +346,6 @@ Preferences.prototype = {
this._set("WebKitDisplayImagesKey", "permissions.default.image",
webkitVal => webkitVal ? 1 : 2);
if (AppConstants.platform == "win") {
// Cookie-accept policy.
// For the OS X version, see WebFoundationCookieBehavior.
// Setting Safari Firefox
// Always Accept 0 0
// Accept from Originating 2 1
// Never Accept 1 2
let firefoxVal = 0;
if (webkitVal != 0) {
firefoxVal = webkitVal == 1 ? 2 : 1;
}
this._set("WebKitCookieStorageAcceptPolicy",
"network.cookie.cookieBehavior",
firefoxVal);
}
this._migrateFontSettings();
yield this._migrateDownloadsFolder();
@ -493,17 +477,10 @@ Preferences.prototype = {
},
_migrateDownloadsFolder: Task.async(function* () {
// Windows Safari uses DownloadPath while Mac uses DownloadsPath.
// Check both for future compatibility.
let key;
if (this._dict.has("DownloadsPath"))
key = "DownloadsPath";
else if (this._dict.has("DownloadPath"))
key = "DownloadPath";
else
if (!this._dict.has("DownloadsPath"))
return;
let downloadsFolder = FileUtils.File(this._dict.get(key));
let downloadsFolder = FileUtils.File(this._dict.get("DownloadsPath"));
// If the download folder is set to the Desktop or to ~/Downloads, set the
// folderList pref appropriately so that "Desktop"/Downloads is shown with
@ -552,7 +529,6 @@ SearchStrings.prototype = {
// On OS X, the cookie-accept policy preference is stored in a separate
// property list.
// For the Windows version, check Preferences.migrate.
function WebFoundationCookieBehavior(aWebFoundationFile) {
this._file = aWebFoundationFile;
}
@ -590,12 +566,7 @@ function SafariProfileMigrator() {
SafariProfileMigrator.prototype = Object.create(MigratorPrototype);
SafariProfileMigrator.prototype.getResources = function SM_getResources() {
let profileDir;
if (AppConstants.platform == "macosx") {
profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
} else {
profileDir = FileUtils.getDir("AppData", ["Apple Computer", "Safari"], false);
}
let profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
if (!profileDir.exists())
return null;
@ -617,12 +588,7 @@ SafariProfileMigrator.prototype.getResources = function SM_getResources() {
// Apple may fix this at some point.
pushProfileFileResource("ReadingList.plist", Bookmarks);
let prefsDir;
if (AppConstants.platform == "macosx") {
prefsDir = FileUtils.getDir("UsrPrfs", [], false);
} else {
prefsDir = FileUtils.getDir("AppData", ["Apple Computer", "Preferences"], false);
}
let prefsDir = FileUtils.getDir("UsrPrfs", [], false);
let prefs = this.mainPreferencesPropertyList;
if (prefs) {
@ -630,24 +596,15 @@ SafariProfileMigrator.prototype.getResources = function SM_getResources() {
resources.push(new SearchStrings(prefs));
}
if (AppConstants.platform == "macosx") {
// On OS X, the cookie-accept policy preference is stored in a separate
// property list.
let wfFile = FileUtils.getFile("UsrPrfs", ["com.apple.WebFoundation.plist"]);
if (wfFile.exists())
resources.push(new WebFoundationCookieBehavior(wfFile));
}
let wfFile = FileUtils.getFile("UsrPrfs", ["com.apple.WebFoundation.plist"]);
if (wfFile.exists())
resources.push(new WebFoundationCookieBehavior(wfFile));
return resources;
};
SafariProfileMigrator.prototype.getLastUsedDate = function SM_getLastUsedDate() {
let profileDir;
if (AppConstants.platform == "macosx") {
profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
} else {
profileDir = FileUtils.getDir("AppData", ["Apple Computer", "Safari"], false);
}
let profileDir = FileUtils.getDir("ULibDir", ["Safari"], false);
let datePromises = ["Bookmarks.plist", "History.plist"].map(file => {
let path = OS.Path.join(profileDir.path, file);
return OS.File.stat(path).catch(_ => null).then(info => {
@ -662,12 +619,7 @@ SafariProfileMigrator.prototype.getLastUsedDate = function SM_getLastUsedDate()
Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyList", {
get: function get_mainPreferencesPropertyList() {
if (this._mainPreferencesPropertyList === undefined) {
let file;
if (AppConstants.platform == "macosx") {
file = FileUtils.getDir("UsrPrfs", [], false);
} else {
file = FileUtils.getDir("AppData", ["Apple Computer", "Preferences"], false);
}
let file = FileUtils.getDir("UsrPrfs", [], false);
if (file.exists()) {
file.append("com.apple.Safari.plist");
if (file.exists()) {

Просмотреть файл

@ -39,7 +39,6 @@
<radio id="ie" label="&importFromIE.label;" accesskey="&importFromIE.accesskey;"/>
<radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
<radio id="chromium" label="&importFromChromium.label;" accesskey="&importFromChromium.accesskey;"/>
<radio id="safari" label="&importFromSafari.label;" accesskey="&importFromSafari.accesskey;"/>
<radio id="canary" label="&importFromCanary.label;" accesskey="&importFromCanary.accesskey;"/>
<radio id="360se" label="&importFrom360se.label;" accesskey="&importFrom360se.accesskey;"/>
#elifdef XP_MACOSX

Просмотреть файл

@ -39,13 +39,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'360seProfileMigrator.js',
'EdgeProfileMigrator.js',
'IEProfileMigrator.js',
'SafariProfileMigrator.js',
]
EXTRA_JS_MODULES += [
'ESEDBReader.jsm',
'MSMigrationUtils.jsm',
]
DEFINES['HAS_SAFARI_MIGRATOR'] = True
DEFINES['HAS_360SE_MIGRATOR'] = True
DEFINES['HAS_IE_MIGRATOR'] = True
DEFINES['HAS_EDGE_MIGRATOR'] = True