Closed
Bug 726334
Opened 12 years ago
Closed 12 years ago
nsFormFillController::mFocusedInput can keep nodes alive longer than needed
Categories
(Toolkit :: Form Manager, defect)
Tracking
()
RESOLVED
FIXED
mozilla13
People
(Reporter: smaug, Assigned: smaug)
References
Details
(Whiteboard: [snappy:p3][MemShrink:P2])
Attachments
(1 file, 3 obsolete files)
15.29 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
If I read the code correctly nsFormFillController::mFocusedInput can actually in some cases keep node alive longer than needed.
Comment 1•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #0) > If I read the code correctly nsFormFillController::mFocusedInput can > actually in some cases keep node alive longer than needed. how often does this happen?
Comment 2•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #0) > If I read the code correctly nsFormFillController::mFocusedInput can > actually in some cases keep node alive longer than needed. Could you be more specific?
Assignee | ||
Comment 3•12 years ago
|
||
Something like hiding focused input element and moving it to another document might cause this to happen. I don't know how often this happens, since this is still speculation. Something is keeping input elements alive occasionally, though.
Comment 4•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #3) > Something like hiding focused input element and moving it to another > document might > cause this to happen. > I don't know how often this happens, since this is still speculation. > Something is keeping input elements alive occasionally, though. We need a needs-telemetry whiteboard entry. In meantime I'm P4ing this until telemetry(or something) can show us extent of this problem.
Whiteboard: [snappy] → [snappy:p4]
Comment 5•12 years ago
|
||
I keep accidentally using a non-existent snappy:p4 priority
Whiteboard: [snappy:p4] → [snappy:p3]
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → bugs
Assignee | ||
Comment 6•12 years ago
|
||
I hadn't realized formfillcontroller is a service, which makes the situation even worse. Chrome code really shouldn't keep strong references to content nodes. It is just way too easy to leak some of them accidentally. I'll ask review if the tryserver results look good. https://tbpl.mozilla.org/?tree=Try&rev=915c6d323e19
Assignee | ||
Comment 7•12 years ago
|
||
Bah, looks like the patch crashes nicely :(
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #599005 -
Attachment is obsolete: true
Assignee | ||
Comment 9•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=842460184f27
Assignee | ||
Comment 10•12 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=ee6e64a48620 This should actually pass the input.list tests. Need to be careful with mListNode handling so that we always have pointer to it when needed. The patch makes FFC to never own any dom nodes. All the nodes it has pointer to are controlled via mutationobservers.
Attachment #599013 -
Attachment is obsolete: true
Attachment #599284 -
Flags: review?
Assignee | ||
Updated•12 years ago
|
Attachment #599284 -
Flags: review? → review?(gavin.sharp)
Comment 11•12 years ago
|
||
Comment on attachment 599284 [details] [diff] [review] patch nit: I noticed a couple of "if("s (missing space) If you're going to start adding the formfillcontroller as an nsIMutationObserver for more than just list elements (i.e. also for the inputs themselves), you'll need to add a checks to avoid calling RevalidateDataList() for changes to the <input>. r- because of that. >diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp > nsFormFillController::~nsFormFillController() >+ if (mListNode) { >+ if (mFocusedInputNode) { These changes shouldn't be necessary since RemoveWindowListeners (called later in this function) calls StopControllingInput(). In theory that also takes care of clearing mPwmgrInputs, though only if the relevant windows still have documents, which might not be as reliable, I guess? >diff --git a/toolkit/components/satchel/nsFormFillController.h b/toolkit/components/satchel/nsFormFillController.h >+ nsDataHashtable<nsPtrHashKey<const nsINode>, PRInt32> mPwmgrInputs; Might as well make this nsDataHashtable<nsPtrHashKey<const nsINode>, bool>, no?
Attachment #599284 -
Flags: review?(gavin.sharp) → review-
Assignee | ||
Comment 12•12 years ago
|
||
(In reply to Gavin Sharp (use gavin@gavinsharp.com for email) from comment #11) > Comment on attachment 599284 [details] [diff] [review] > patch > > nit: I noticed a couple of "if("s (missing space) Hmm, where did those come from. strange. > > If you're going to start adding the formfillcontroller as an > nsIMutationObserver for more than just list elements (i.e. also for the > inputs themselves), you'll need to add a checks to avoid calling > RevalidateDataList() for changes to the <input>. r- because of that. Why? > These changes shouldn't be necessary since RemoveWindowListeners (called > later in this function) calls StopControllingInput(). In theory that also > takes care of clearing mPwmgrInputs, though only if the relevant windows > still have documents, which might not be as reliable, I guess? Yeah. > Might as well make this nsDataHashtable<nsPtrHashKey<const nsINode>, bool>, > no? Sure, I just didn't change the existing value type.
Whiteboard: [snappy:p3] → [snappy:p3][MemShrink]
Assignee | ||
Comment 13•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #12) > > These changes shouldn't be necessary since RemoveWindowListeners (called > > later in this function) calls StopControllingInput(). In theory that also > > takes care of clearing mPwmgrInputs, though only if the relevant windows > > still have documents, which might not be as reliable, I guess? Actually, that is not enough. I don't see what guarantees that mDocShells has any items.
Whiteboard: [snappy:p3][MemShrink] → [snappy:p3]
Whiteboard: [snappy:p3] → [snappy:p3][MemShrink]
Updated•12 years ago
|
Whiteboard: [snappy:p3][MemShrink] → [snappy:p3][MemShrink:P2]
Comment 14•12 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #13) > Actually, that is not enough. I don't see what guarantees that mDocShells > has any items. You're right - it's theoretically possible for mPwmgrInputs to be populated without AttachToBrowser having been called. I don't think that happens in practice because form fill controller is always hooked up to every docshell in Firefox (even if form filling is disabled). I guess that's a good thing since we'd otherwise leak all these inputs indefinitely...
Assignee | ||
Comment 15•12 years ago
|
||
Contains is inclusive http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-node-contains
Attachment #599284 -
Attachment is obsolete: true
Attachment #599413 -
Flags: review?(gavin.sharp)
Comment 16•12 years ago
|
||
Comment on attachment 599413 [details] [diff] [review] patch thanks for fixing this
Attachment #599413 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 17•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2d065305b7d2 Thanks for quick review!
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Target Milestone: --- → mozilla13
You need to log in
before you can comment on or make changes to this bug.
Description
•