Closed Bug 283116 Opened 20 years ago Closed 20 years ago

browser.js Shutdown can have exception in removeObserver

Categories

(Firefox :: Tabbed Browser, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox1.5

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Keywords: memory-leak, Whiteboard: [patch])

Attachments

(1 file, 2 obsolete files)

So the analysis in bug 283088 was at least partly incorrect. In browser.js, the following two addObserver and removeObserver calls are supposedly balanced: http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/browser/base/content/browser.js&rev=1.382&mark=691-692#686 http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/browser/base/content/browser.js&rev=1.382&mark=905#900 However, they're only really balanced if the last tab closed in a window is the one that was there when it was opened. I made the mistake of adding the second of these, which breaks the whole rest of the Shutdown function. If the addObserver call cited above is actually still needed, I'm really not sure what needs to be done. However, I'm hoping that it's not still needed. I'll look into it.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → Firefox1.1
Attached patch patch (obsolete) — Splinter Review
Here's an idea: let's not make the first browser window different from all the rest and have the disablehistory="true" attribute, at let's not try to duplicate everything browser.xml would do without that disablehistory="true". I haven't found any regressions from this yet, but I've only been running it briefly. It seems logical. If I do catch something, though, there's always the workaround of changing the disablehistory attribute on that one browser after startup...
Attachment #175099 - Flags: review?(mconnor)
Does the seamonkey tabbrowser have code like that too?
The equivalent seamonkey tabbrowser code is even messier and used to have references to two bugs (bug 113076 and bug 139522) the second of which has security implications.
...but that code doesn't have the problematic browser:purge-session-history observer.
Comment on attachment 175099 [details] [diff] [review] patch I don't think this should break anything, but we should have lots of time to pick up regressions if they happen. I do agree that they shouldn't based on this, as cvs blame puts this as a perf boost fix for blank homepages. I don't know if tinderboxen have about:blank as homepages, but I doubt this should affect startup that much, especially as compared to the downside on the other end.
Attachment #175099 - Flags: review?(mconnor) → review+
(In reply to comment #5) > I do agree that they shouldn't based on this, as cvs blame puts this as a perf > boost fix for blank homepages. Ah, I didn't see that in cvs blame anywhere. That actually does sound like a valid reason (esp. if it prevents history from being loaded until after we've shown the browser window). I'll look into this a bit more (since the alternative is quite simple as well).
Attached patch patch (obsolete) — Splinter Review
It actually does seem to make a startup order difference (and not just for about:blank as a homepage). (I was looking at whether global history was created before or after the first paint, and that creation probably involves reading in the global history database.) So this makes the code a little clearer (adds a comment and moves the addObserver to along with the rest of the code), and adds the fix of removing the disablehistory attribute dynamically.
Attachment #175099 - Attachment is obsolete: true
Attachment #175181 - Flags: review?(mconnor)
Comment on attachment 175181 [details] [diff] [review] patch there's something wrong here...
Attachment #175181 - Flags: review?(mconnor) → review-
Comment on attachment 175181 [details] [diff] [review] patch r=me, just add a blank line before the comment about the disablehistory attribute. This is definitely a lot better, and given some of the mork perf issues with loading global history with huge history files, it probably would make a bigger impact than I was expecting.
Attachment #175181 - Flags: review- → review+
Attachment #175181 - Flags: review+ → review-
Attached patch patchSplinter Review
I forgot to remove the removeObserver call.
Attachment #175181 - Attachment is obsolete: true
Attachment #175186 - Flags: review?(mconnor)
*** Bug 265906 has been marked as a duplicate of this bug. ***
Comment on attachment 175186 [details] [diff] [review] patch ok. same nit about the line before the disablehistory comment, mostly style consistency
Attachment #175186 - Flags: review?(mconnor) → review+
Fix checked in to trunk, 2005-02-22 17:35 -0800.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Note that this was fixing a mistake I made in bug 239833.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: