Closed Bug 815605 Opened 12 years ago Closed 12 years ago

Ensure the registered observer gets removed in places.js shared module

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(firefox17 fixed, firefox18 fixed, firefox19 fixed, firefox20 fixed, firefox-esr10 fixed, firefox-esr17 fixed)

RESOLVED FIXED
Tracking Status
firefox17 --- fixed
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed
firefox-esr10 --- fixed
firefox-esr17 --- fixed

People

(Reporter: AndreeaMatei, Assigned: AndreeaMatei)

References

Details

(Whiteboard: [lib])

Attachments

(1 file)

At this moment, in removeAllHistory() method from places.js we don't ensure the removal of the observer, in case of a failure. We need to update that.
Whiteboard: [lib]
Attached patch patch v1Splinter Review
Ensuring we remove the observer with a try-finally block.
Assignee: nobody → andreea.matei
Status: NEW → ASSIGNED
Attachment #689628 - Flags: review?(hskupin)
Attachment #689628 - Flags: review?(dave.hunt)
With this changed I don't get any more "Browsing History has been cleared" failures, at least on default.
Comment on attachment 689628 [details] [diff] [review]
patch v1

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

::: lib/places.js
@@ +104,5 @@
>  function removeAllHistory() {
>    const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
>  
> +  // Set up an observer and a flag so we get notified when remove completes
> +  var finishedStateFlag = false;

Nit for the future. Shorter names are preferred. A simple 'finished' would have been enough.

@@ +107,5 @@
> +  // Set up an observer and a flag so we get notified when remove completes
> +  var finishedStateFlag = false;
> +  var observer = {
> +    observe: function (aSubject, aTopic, aData) {
> +      finishedStateFlag = true;

I still think we should also remove the observer here. Otherwise another notification could be caught which you would expect for another action. But this can be a follow-up bug. Please make sure to file it. And it should include all instances where we make use of observers in our libs and tests.
Attachment #689628 - Flags: review?(hskupin)
Attachment #689628 - Flags: review?(dave.hunt)
Attachment #689628 - Flags: review+
http://hg.mozilla.org/qa/mozmill-tests/rev/77fb1ae5fe44 (default)

(In reply to Andreea Matei [:AndreeaMatei] from comment #2)
> With this changed I don't get any more "Browsing History has been cleared"
> failures, at least on default.

Lets see if that is true. If yes we can even close bug 800800.
(In reply to Andreea Matei [:AndreeaMatei] from comment #2)
> With this changed I don't get any more "Browsing History has been cleared"
> failures, at least on default.

It's still happening on default:
http://mozmill-ci.blargon7.com/#/functional/report/352218d7e3125c857fc1d37167f01644

So this change doesn't fix bug 800800.
No longer blocks: 800800
That is a different failure, the one in bug 800800 is "Browsing History has been cleared" from removeAllHistory(), reproducible on Windows only.
Right, my fault. Please make sure to get it filed cause it seems to be regressed by a feature change in Firefox.
Blocks: 800800
This works as expected and the patch applies cleanly to all other branches.
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: