Closed Bug 412381 Opened 17 years ago Closed 16 years ago

Clear Private Data should delete old signons.txt file(s).

Categories

(Toolkit :: Password Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta4

People

(Reporter: Dolske, Assigned: Dolske)

Details

(Keywords: privacy)

Attachments

(1 file, 2 obsolete files)

We've upgraded from signons.txt to signons2.txt and now to signons3.txt. Data is automatically imported from old files, but the old files are not removed.

Clear private data calls nsILoginManager.removeAllLogins(), which should go ahead and nuke any old files.

Related: Bug 329741 discusses deleting other files based on last-modified times.
Assignee: nobody → dolske
Target Milestone: --- → Firefox 3 beta4
Flags: blocking-firefox3?
Keywords: privacy
Attached patch Patch, work in progress (obsolete) — Splinter Review
Comment on attachment 301358 [details] [diff] [review]
Patch, work in progress

>+     * Deletes any stoage files that we're not using any more.

s/stoage/storage/
Wanted, not blocking.
Flags: wanted-firefox3+
Flags: blocking-firefox3?
Flags: blocking-firefox3-
Attached patch Patch v.2 (obsolete) — Splinter Review
Attachment #301358 - Attachment is obsolete: true
Attachment #305706 - Flags: review?(gavin.sharp)
Comment on attachment 305706 [details] [diff] [review]
Patch v.2

>Index: toolkit/components/passwordmgr/src/storage-Legacy.js

>+    _removeOldSignonsFiles : function() {
>+        // Get the location of the user's profile.
>+        var DIR_SERVICE = new Components.Constructor(
>+                "@mozilla.org/file/directory_service;1", "nsIProperties");
>+        var pathname = (new DIR_SERVICE()).get("ProfD", Ci.nsIFile).path;
>+
>+        // We've used a number of prefs over time due to compatibility issues.
>+        // Skip the first entry (the newest) and delete the others.
>+        for (var i = 1; i < this._filenamePrefs.length; i++) {
>+            var prefName = this._filenamePrefs[i];
>+
>+            var filename = this._prefBranch.getCharPref(prefName);
>+
>+            var file = Cc["@mozilla.org/file/local;1"].
>+                       createInstance(Ci.nsILocalFile);
>+            file.initWithPath(pathname);
>+            file.append(filename);

I didn't notice this when I reviewed the original code that this is copied from, but there's no point in using a Constructor when you only get the service once, and you could keep a reference to the profile's nsIFile and clone it each time rather than keeping the pathName and calling createInstance/initWithPath each time. Could also move that logic into a getFileFromPref function and share this code with _getSignonsFile?

Otherwise this looks fine.
Attached patch Patch v.3Splinter Review
Attachment #305706 - Attachment is obsolete: true
Attachment #305869 - Flags: review?(gavin.sharp)
Attachment #305706 - Flags: review?(gavin.sharp)
Attachment #305869 - Attachment is patch: true
Attachment #305869 - Attachment mime type: application/octet-stream → text/plain
Attachment #305869 - Flags: review?(gavin.sharp) → review+
Attachment #305869 - Flags: approval1.9?
Comment on attachment 305869 [details] [diff] [review]
Patch v.3

a=beltzner for 1.9
Attachment #305869 - Flags: approval1.9? → approval1.9+
Checking in toolkit/components/passwordmgr/src/storage-Legacy.js;
  new revision: 1.24; previous revision: 1.23
Checking in toolkit/components/passwordmgr/test/unit/head_storage_legacy_1.js;
  new revision: 1.10; previous revision: 1.9
Checking in toolkit/components/passwordmgr/test/unit/test_storage_legacy_2.js;
  new revision: 1.6; previous revision: 1.5
Status: NEW → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: