Merge m-c to b2g-inbound. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-01-22 22:29:36 -05:00
Родитель 4fde228d98 888bb45716
Коммит 84a70a18cf
6 изменённых файлов: 12 добавлений и 12 удалений

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

@ -233,7 +233,7 @@ this.PlacesBackups = {
let dateObj = aDateObj || new Date();
// Use YYYY-MM-DD (ISO 8601) as it doesn't contain illegal characters
// and makes the alphabetical order of multiple backup files more useful.
return "bookmarks-" + dateObj.toISOString().substr(0, 10) + ".json" +
return "bookmarks-" + dateObj.toLocaleFormat("%Y-%m-%d") + ".json" +
(aCompress ? "lz4" : "");
},

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

@ -20,7 +20,7 @@ add_task(function* test_same_date_same_hash() {
// Save JSON file in backup folder with hash appended
let dateObj = new Date();
let filename = "bookmarks-" + dateObj.toISOString().substr(0, 10) + "_" +
let filename = "bookmarks-" + dateObj.toLocaleFormat("%Y-%m-%d") + "_" +
count + "_" + hash + ".json";
let backupFile = OS.Path.join(backupFolder, filename);
yield OS.File.move(tempPath, backupFile);
@ -53,7 +53,7 @@ add_task(function* test_same_date_diff_hash() {
"bug10169583_bookmarks.json");
let {count, hash} = yield BookmarkJSONUtils.exportToFile(tempPath);
let dateObj = new Date();
let filename = "bookmarks-" + dateObj.toISOString().substr(0, 10) + "_" +
let filename = "bookmarks-" + dateObj.toLocaleFormat("%Y-%m-%d") + "_" +
count + "_" + "differentHash==" + ".json";
let backupFile = OS.Path.join(backupFolder, filename);
yield OS.File.move(tempPath, backupFile);
@ -84,9 +84,9 @@ add_task(function* test_diff_date_same_hash() {
let {count, hash} = yield BookmarkJSONUtils.exportToFile(tempPath);
let oldDate = new Date(2014, 1, 1);
let curDate = new Date();
let oldFilename = "bookmarks-" + oldDate.toISOString().substr(0, 10) + "_" +
let oldFilename = "bookmarks-" + oldDate.toLocaleFormat("%Y-%m-%d") + "_" +
count + "_" + hash + ".json";
let newFilename = "bookmarks-" + curDate.toISOString().substr(0, 10) + "_" +
let newFilename = "bookmarks-" + curDate.toLocaleFormat("%Y-%m-%d") + "_" +
count + "_" + hash + ".json";
let backupFile = OS.Path.join(backupFolder, oldFilename);
let newBackupFile = OS.Path.join(backupFolder, newFilename);

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

@ -21,7 +21,7 @@ function run_test() {
let dateObj = new Date();
dateObj.setYear(dateObj.getFullYear() + 1);
let name = PlacesBackups.getFilenameForDate(dateObj);
do_check_eq(name, "bookmarks-" + dateObj.toISOString().substr(0, 10) + ".json");
do_check_eq(name, "bookmarks-" + dateObj.toLocaleFormat("%Y-%m-%d") + ".json");
files = bookmarksBackupDir.directoryEntries;
while (files.hasMoreElements()) {
let entry = files.getNext().QueryInterface(Ci.nsIFile);

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

@ -33,7 +33,7 @@ add_task(function() {
do_check_eq(backupFiles.length, 1);
let matches = OS.Path.basename(backupFiles[0]).match(PlacesBackups.filenamesRegex);
do_check_eq(matches[1], new Date().toISOString().substr(0, 10));
do_check_eq(matches[1], new Date().toLocaleFormat("%Y-%m-%d"));
do_check_eq(matches[2], count);
do_check_eq(matches[3], hash);
@ -49,7 +49,7 @@ add_task(function() {
recentBackup = yield PlacesBackups.getMostRecentBackup();
do_check_neq(recentBackup, OS.Path.join(backupFolder, oldBackupName));
matches = OS.Path.basename(recentBackup).match(PlacesBackups.filenamesRegex);
do_check_eq(matches[1], new Date().toISOString().substr(0, 10));
do_check_eq(matches[1], new Date().toLocaleFormat("%Y-%m-%d"));
do_check_eq(matches[2], count + 1);
do_check_neq(matches[3], hash);

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

@ -402,7 +402,7 @@ function shutdownPlaces(aKeepAliveConnection)
const FILENAME_BOOKMARKS_HTML = "bookmarks.html";
const FILENAME_BOOKMARKS_JSON = "bookmarks-" +
(new Date().toISOString().substr(0, 10)) + ".json";
(new Date().toLocaleFormat("%Y-%m-%d")) + ".json";
/**
* Creates a bookmarks.html file in the profile folder from a given source file.
@ -514,7 +514,7 @@ function check_JSON_backup(aIsAutomaticBackup) {
let bookmarksBackupDir = gProfD.clone();
bookmarksBackupDir.append("bookmarkbackups");
let files = bookmarksBackupDir.directoryEntries;
let backup_date = new Date().toISOString().substr(0, 10);
let backup_date = new Date().toLocaleFormat("%Y-%m-%d");
while (files.hasMoreElements()) {
let entry = files.getNext().QueryInterface(Ci.nsIFile);
if (PlacesBackups.filenamesRegex.test(entry.leafName)) {

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

@ -23,7 +23,7 @@ add_task(function () {
let randomDate = new Date(dateObj.getFullYear() - 1,
Math.floor(12 * Math.random()),
Math.floor(28 * Math.random()));
let dateString = randomDate.toISOString().substr(0, 10);
let dateString = randomDate.toLocaleFormat("%Y-%m-%d");
if (dates.indexOf(dateString) == -1)
dates.push(dateString);
}
@ -49,7 +49,7 @@ add_task(function () {
yield PlacesBackups.create(NUMBER_OF_BACKUPS);
// Add today's backup.
dates.push(dateObj.toISOString().substr(0, 10));
dates.push(dateObj.toLocaleFormat("%Y-%m-%d"));
// Check backups. We have 11 dates but we the max number is 10 so the
// oldest backup should have been removed.