Closed Bug 343282 Opened 19 years ago Closed 19 years ago

bfcache is slow

Categories

(Toolkit :: Password Manager, defect)

x86
Windows 2000
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.8.1beta2

People

(Reporter: Peter6, Assigned: mwu)

References

Details

(Keywords: perf, regression)

Attachments

(1 file, 5 obsolete files)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20060630 Minefield/3.0a1 ID:2006063012 [cairo] after discussion on moz forum we're not sure when this regressed, but back and forwards speed has dropped a lot in the past week or so. I have safebrowsing disabled, so that shouldn't be the cause repro: open a page open another page move back and forwards result: it's slow, far from instant
Even though Peter stated *usefull* comments would be welcome, I want to note that for me back/forward navigation never felt as fast as in Opera or IE. Maybe there is a regression, but maybe bfcache also needs some more love in general.
regressionwindow: works in 20060627 1541pdt build fails in 20060627 2248pdt build http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&filetype=match&whotype=match&sortby=Date&hours=2&date=explicit&mindate=20060627+1500&maxdate=20060627+2248&cvsroot=%2Fcvsroot reproduce: Open a mozillazine forums Open a post repeatedly switch back and forwards between the 2 result: 1) it takes a while to respond when you press the <- or -> button 2. I notice that out of a large number of tries at leat 10-20 % of the time the page seems loading (blue load bar, or whatever it's called)
Severity: normal → major
Flags: blocking1.9a1?
Keywords: perf
When I change the code to directly return NS_OK in nsPasswordManager::OnStateChange, then the bug seems to disappear in my debug build. So this seems like a regression from bug 221634.
Blocks: 221634
Definitely not Core: Session History, then.
Component: History: Session → Password Manager
Product: Core → Firefox
QA Contact: history.session → password.manager
Assignee: nobody → michael.wu
So this happens because the new code uses an unload event listener on the window, which actually works instead of the old code, which used an event listener on the document, which didn't work. So it seems that with the old code, the password manager wasn't cleaned up when a different page was visited. Isn't that a memory leak? The new code properly calls nsPasswordManager::Unload now during the unload of the window, so the new code is actually doing now what passwordmanager was always supposed to do. But setting unload event handlers on the window causes bfcache to stop working, this is intentional, see: http://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching (first list-item in introduction)
Attached patch patch (obsolete) — Splinter Review
This fixes the issue by using the pagehide event instead of the unload event. There is one problem with it, though. Going back into history to a cached document with password fields don't show the password, this is intentional: http://lxr.mozilla.org/seamonkey/source/content/base/src/nsDocument.cpp#4652 So I guess a pageshow event handler needs to be added, that does the same as the domcontentloaded event handler, except that event handler needs to be removed when the domcontentloaded event has fired, or something like that.
Blocks: 343169
Flags: blocking-firefox2?
Attached patch Fix stuff (obsolete) — Splinter Review
The good news is that this fixes things, eliminates a lot of code, and generally works. The bad news is that we now fill in the form on both DOMContentLoaded *and* pageshow. However, chances are low that it would be noticed since we don't fill things in if there's something already there.
Attachment #228300 - Attachment is obsolete: true
Attachment #228401 - Flags: review?(enndeakin)
Flags: blocking-firefox2? → blocking-firefox2+
Target Milestone: --- → Firefox 2 beta2
Make OnStateChange a little smaller.
Attachment #228401 - Attachment is obsolete: true
Attachment #228492 - Flags: review?(enndeakin)
Attachment #228401 - Flags: review?(enndeakin)
Comment on attachment 228492 [details] [diff] [review] Use pageshow/pagehide instead of unload Looks OK, but you may want to get an additional review from someone familiar with the bfcache.
Attachment #228492 - Flags: review?(enndeakin) → review+
Attachment #228492 - Flags: review?(bryner)
While looking at the patches for bfcache, I noticed there's a STATE_RESTORING bit for nsIWebProgressListener. I prefer using this over pageshow, and it also avoids filling in the page twice.
Attachment #228492 - Attachment is obsolete: true
Attachment #228492 - Flags: review?(bryner)
Attachment #228712 - Flags: review?(enndeakin)
Comment on attachment 228712 [details] [diff] [review] Use STATE_RESTORING+pagehide instead of unload Note that the bulk of the patch is just moving the password filling code into its own function.
Attachment #228712 - Flags: review?(bryner)
Eliminate an unnecessary html doc check.
Attachment #228712 - Attachment is obsolete: true
Attachment #229214 - Flags: review?(enndeakin)
Attachment #228712 - Flags: review?(enndeakin)
Attachment #228712 - Flags: review?(bryner)
Attachment #229214 - Flags: review?(bryner)
Comment on attachment 229214 [details] [diff] [review] Use STATE_RESTORING+pagehide instead of unload, v2 >- if (!type.EqualsLiteral("DOMContentLoaded")) >+ if (type.EqualsLiteral("blur") || >+ type.EqualsLiteral("DOMAutoComplete")) > return FillPassword(aEvent); There's also a Blur function in this class. Did you intend to remove it and replace it with this?
Attachment #229214 - Flags: review?(enndeakin) → review+
(In reply to comment #13) > (From update of attachment 229214 [details] [diff] [review] [edit]) > > >- if (!type.EqualsLiteral("DOMContentLoaded")) > >+ if (type.EqualsLiteral("blur") || > >+ type.EqualsLiteral("DOMAutoComplete")) > > return FillPassword(aEvent); > > There's also a Blur function in this class. Did you intend to remove it and > replace it with this? > Huh, I guess it's not necessary. I checked for both to keep the behavior of the function the same as before.
Attachment #229214 - Flags: review?(bryner)
Attachment #229214 - Attachment is obsolete: true
checked in to trunk
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Knocking off the fx2 blocking list because the original bug hasn't landed on branch and isn't blocking, and the new patch that's on that bug has this fix rolled in.
Flags: blocking1.9a1?
Flags: blocking-firefox2-
Flags: blocking-firefox2+
This may have caused Bug 347003, or at least made it worse. Without this patch I don't see the reload loop described in Bug 347003.
Depends on: 347003
(In reply to comment #18) > This may have caused Bug 347003, or at least made it worse. > Without this patch I don't see the reload loop described in Bug 347003. > No, it did not. Reverting this patch merely disables your bfcache. You can set browser.sessionhistory.max_total_viewers to 0 for the same effect.
No longer depends on: 347003
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: