Closed Bug 712342 Opened 14 years ago Closed 14 years ago

make dbStmts an object

Categories

(Toolkit :: Password Manager, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla12

People

(Reporter: espindola, Assigned: espindola)

References

Details

Attachments

(1 file)

No description provided.
Assignee: nobody → respindola
Status: NEW → ASSIGNED
Attachment #583201 - Flags: review?(paul)
Comment on attachment 583201 [details] [diff] [review] make dbStmts an object Review of attachment 583201 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! ::: toolkit/components/passwordmgr/storage-mozStorage.js @@ +176,5 @@ > } > } > }, > _dbConnection : null, // The database connection > + _dbStmts : {}, // Database statements for memoization let's keep this as null just as an indicator that init hasn't been called (and it keeps it aligned with nsFormHistory)
Attachment #583201 - Flags: review?(paul) → review+
Target Milestone: --- → mozilla12
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
(In reply to Paul O'Shannessy [:zpao] from comment #2) > > _dbConnection : null, // The database connection > > + _dbStmts : {}, // Database statements for memoization > > let's keep this as null just as an indicator that init hasn't been called > (and it keeps it aligned with nsFormHistory) And, more importantly, because assigning an object in the prototype means all instances share the same object. As a service there should only end up being one of these, but it's still a bad pattern to avoid (unless specifically desired).
(In reply to Justin Dolske [:Dolske] from comment #5) > (In reply to Paul O'Shannessy [:zpao] from comment #2) > > > > _dbConnection : null, // The database connection > > > + _dbStmts : {}, // Database statements for memoization > > > > let's keep this as null just as an indicator that init hasn't been called > > (and it keeps it aligned with nsFormHistory) > > And, more importantly, because assigning an object in the prototype means > all instances share the same object. As a service there should only end up > being one of these, but it's still a bad pattern to avoid (unless > specifically desired). Doh, of course there was a better reason :) I even have an interview question about that... But yea, as a service it would have been _ok_.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: