Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: chrome/browser/resources/options/password_manager.js

Issue 7274015: Keep the original index of password list items when filtering, so the right password can be deleted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/options/password_manager_list.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/password_manager.js
===================================================================
--- chrome/browser/resources/options/password_manager.js (revision 90611)
+++ chrome/browser/resources/options/password_manager.js (working copy)
@@ -153,9 +153,15 @@
// Implement password searching here in javascript, rather than in C++.
// The number of saved passwords shouldn't be too big for us to handle.
var query = this.lastQuery_;
- var filter = function(entry) {
+ var filter = function(entry, index, list) {
James Hawkins 2011/06/28 01:27:18 |list| is unused?
Mike Mammarella 2011/06/28 01:30:27 Correct, but it's apparently passed so I included
James Hawkins 2011/06/28 01:31:22 Can't we not include it, like we did before?
Mike Mammarella 2011/06/28 01:34:19 We could, but I almost rewrote this by hand just b
// Search both URL and username.
- return entry[0].indexOf(query) >= 0 || entry[1].indexOf(query) >= 0;
+ if (entry[0].indexOf(query) >= 0 || entry[1].indexOf(query) >= 0) {
+ // Keep the original index so we can delete correctly. See also
+ // deleteItemAtIndex() in password_manager_list.js that uses this.
+ entry[3] = index;
+ return true;
+ }
+ return false;
};
entries = entries.filter(filter);
}
« no previous file with comments | « no previous file | chrome/browser/resources/options/password_manager_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698