Bug 1011581 - Remove the unused optional parameter aFileExt in PlacesBackup r=mak

This commit is contained in:
Althaf Hameez 2014-05-21 08:39:00 +02:00
parent 7e98c5ef35
commit 227f326e2e
2 changed files with 6 additions and 14 deletions

View File

@ -1124,7 +1124,7 @@ BrowserGlue.prototype = {
// from bookmarks.html, we will try to restore from JSON
if (importBookmarks && !restoreDefaultBookmarks && !importBookmarksHTML) {
// get latest JSON backup
lastBackupFile = yield PlacesBackups.getMostRecentBackup("json");
lastBackupFile = yield PlacesBackups.getMostRecentBackup();
if (lastBackupFile) {
// restore from JSON backup
yield BookmarkJSONUtils.importFromFile(lastBackupFile, true);

View File

@ -256,19 +256,15 @@ this.PlacesBackups = {
/**
* Get the most recent backup file.
*
* @param [optional] aFileExt
* Force file extension. Either "html" or "json".
* Will check for both if not defined.
* @returns nsIFile backup file
*/
getMostRecent: function PB_getMostRecent(aFileExt) {
getMostRecent: function PB_getMostRecent() {
Deprecated.warning(
"PlacesBackups.getMostRecent is deprecated and will be removed in a future version",
"https://bugzilla.mozilla.org/show_bug.cgi?id=859695");
let fileExt = aFileExt || "(json|html)";
for (let i = 0; i < this._entries.length; i++) {
let rx = new RegExp("\." + fileExt + "$");
let rx = new RegExp("\.json$");
if (this._entries[i].leafName.match(rx))
return this._entries[i];
}
@ -278,18 +274,14 @@ this.PlacesBackups = {
/**
* Get the most recent backup file.
*
* @param [optional] aFileExt
* Force file extension. Either "html" or "json".
* Will check for both if not defined.
* @return {Promise}
* @result the path to the file.
*/
getMostRecentBackup: function PB_getMostRecentBackup(aFileExt) {
getMostRecentBackup: function PB_getMostRecentBackup() {
return Task.spawn(function* () {
let fileExt = aFileExt || "(json|html)";
let entries = yield this.getBackupFiles();
for (let entry of entries) {
let rx = new RegExp("\." + fileExt + "$");
let rx = new RegExp("\.json$");
if (OS.Path.basename(entry).match(rx)) {
return entry;
}
@ -334,7 +326,7 @@ this.PlacesBackups = {
// we also want to copy this new backup to it.
// This way we ensure the latest valid backup is the same saved by the
// user. See bug 424389.
let mostRecentBackupFile = yield this.getMostRecentBackup("json");
let mostRecentBackupFile = yield this.getMostRecentBackup();
if (!mostRecentBackupFile ||
hash != getHashFromFilename(OS.Path.basename(mostRecentBackupFile))) {
let name = this.getFilenameForDate();