Closed Bug 698738 Opened 13 years ago Closed 13 years ago

Use the observer method for idle-daily and formhistory-expire-now in nsFormHistory.js

Categories

(Toolkit :: Form Manager, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: espindola, Assigned: espindola)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Comment on attachment 570988 [details] [diff] [review]
Use the observer method for idle-daily and formhistory-expire-now in nsFormHistory.js

Review of attachment 570988 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/satchel/nsFormHistory.js
@@ +394,2 @@
>          else
>              this.log("Oops! Unexpected notification: " + topic);

may you please convert this into a switch clause?
Comment on attachment 570988 [details] [diff] [review]
Use the observer method for idle-daily and formhistory-expire-now in nsFormHistory.js

Review of attachment 570988 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/satchel/nsFormHistory.js
@@ +139,5 @@
>          this.messageManager.addMessageListener("FormHistory:FormSubmitEntries", this);
>  
>          // Add observers
> +        Services.obs.addObserver(this, "idle-daily", false);
> +        Services.obs.addObserver(this, "formhistory-expire-now", false);

You may use 'true' (add as a weak ref here) IMO, but let reviewer decide.

@@ +394,2 @@
>          else
>              this.log("Oops! Unexpected notification: " + topic);

+1
Attachment #570988 - Flags: feedback?(honzab.moz) → feedback+
> You may use 'true' (add as a weak ref here) IMO, but let reviewer decide.

nsFormHistory is used as a service [@mozilla.org/satchel/form-history;1], to support my suggestion.
(In reply to Honza Bambas (:mayhemer) from comment #3)

> >          // Add observers
> > +        Services.obs.addObserver(this, "idle-daily", false);
> > +        Services.obs.addObserver(this, "formhistory-expire-now", false);
> 
> You may use 'true' (add as a weak ref here) IMO, but let reviewer decide.

fwiw, this is happening in another bug (bug 698570 exactly). It's hard to follow on all of these bugs without correct dependencies.
Blocks: 698570
Comment on attachment 572029 [details] [diff] [review]
Use the observer method for idle-daily and formhistory-expire-now in nsFormHistory.js

Review of attachment 572029 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with these fixed.
The weak references will be handled in the blocked bug.

::: toolkit/components/satchel/nsFormHistory.js
@@ +400,5 @@
>              this.updatePrefs();
> +            break;
> +        case "idle-daily":
> +        case "formhistory-expire-now":
> +            this.expireOldEntries();

missing break here

@@ +406,1 @@
>              this.log("Oops! Unexpected notification: " + topic);

nit: I know it's useless, but I like to have a break in default too, mostly because default doesn't have to be the last option in a switch, so if anyone moves it around, he may miss the break.
Attachment #572029 - Flags: review?(mak77) → review+
Comment on attachment 572029 [details] [diff] [review]
Use the observer method for idle-daily and formhistory-expire-now in nsFormHistory.js

Review of attachment 572029 [details] [diff] [review]:
-----------------------------------------------------------------

f+ and supporting mak's comments.
Attachment #572029 - Flags: feedback?(honzab.moz) → feedback+
https://hg.mozilla.org/mozilla-central/rev/3424159bce7a
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: