Closed Bug 835730 Opened 11 years ago Closed 11 years ago

nsBrowserGlue.js does not shut down properly when the profile shuts down

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 21

People

(Reporter: gsvelto, Assigned: gsvelto)

References

Details

Attachments

(1 file, 1 obsolete file)

nsBrowserGlue.js currently listens to xpcom-shutdown for part of its cleanup, this should be done instead after a profile-before-change event, additionally the places shutdown code does not respond properly to profile-before-change events causing problems in some unit tests (see bug 820438).
The patch removes the xpcom-shutdown hook and responds to profile-before-change instead and it also resolves the problem with places shutdown seen in bug 820438. This is the try run:

https://tbpl.mozilla.org/?tree=Try&rev=2ac1b575010c
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Attachment #707501 - Flags: review?(mak77)
Comment on attachment 707501 [details] [diff] [review]
Properly tear down components when the profile is being shut down

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

::: browser/components/nsBrowserGlue.js
@@ +351,5 @@
>      if (this._isPlacesShutdownObserver)
>        os.removeObserver(this, "places-shutdown");
>      os.removeObserver(this, "defaultURIFixup-using-keyword-pref");
>      os.removeObserver(this, "handle-xul-text-link");
> +    os.removeObserver(this, "profile-before-change");

please file a bug in Firefox/General to use the fact nsBrowserGlue supports weak references, thus we can addObserver(,, true) and never RemoveObserver, that means we can likely kill _dispose() method, moving any remaining stuff to onProfileShutdown or onPlacesShutdown.

@@ +425,1 @@
>      BrowserNewTabPreloader.uninit();

please add a comment at the beginning of _onProfileShutdsown stating that any component depending on Places should be finalized in _onPlacesShutdown.

@@ +1025,3 @@
>    /**
>     * Places shut-down tasks
>     * - back up bookmarks if needed.

please add another bullet point at the beginning stating "- finalize components depending on Places"

@@ +1029,5 @@
>     *
>     * Note: quit-application-granted notification is received twice
>     *       so replace this method with a no-op when first called.
>     */
> +  _onPlacesShutdown: function BG__onPlacesShutdown() {

please while here remove the "Note" from the javadoc, since looks like it comes from an ancient time where we were finalizing at quit-application-granted.
Attachment #707501 - Flags: review?(mak77) → review+
The changes apply to comments only so I won't re-submit it to try; the previous run was all green except for what looks like an intermittent issue on WinXP.
Attachment #707501 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/e881841cd418
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
> please file a bug in Firefox/General to use the fact nsBrowserGlue supports weak
> references, thus we can addObserver(,, true) and never RemoveObserver, that means
> we can likely kill _dispose() method, moving any remaining stuff to onProfileShutdown
> or onPlacesShutdown.
This is now Bug 836789
Depends on: 836789
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: