Bug 57997

Summary: Document leaks when navigating away from a scrolled page
Product: WebKit Reporter: Stephanie Lewis <slewis>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, slewis, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.6   
Attachments:
Description Flags
testcase
none
patch darin: review+

Description Stephanie Lewis 2011-04-06 16:18:10 PDT
Created attachment 88541 [details]
testcase

<rdar://problem/9187856> REGRESSION(r75555): ~5-7 MB increase in memory between iBench runs

When navigating away from a page in a scrolled state the scrollbars are reset which fires a scroll event.  WIth the new EventQueue for scroll events the event is never dispatched before the page detaches and keeps the Document alive.  

Solution is to cancel the scroll event when detaching the page. 

To repro:
Load attached testcase
Scroll
navigate to about:blank
close the window.
Comment 1 Stephanie Lewis 2011-04-06 16:48:28 PDT
Created attachment 88542 [details]
patch
Comment 2 Darin Adler 2011-04-06 16:50:24 PDT
Comment on attachment 88542 [details]
patch

I don’t understand this patch. It adds two new functions, but nobody calls the Document function.
Comment 3 Stephanie Lewis 2011-04-06 17:13:00 PDT
the call to to cancelEnqueuedEvents is in Document::detach.  It would be more concise I suppose to just call the QueueEvent function from there and not add a function to Document.
Comment 4 Darin Adler 2011-04-06 17:52:55 PDT
Comment on attachment 88542 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88542&action=review

> Source/WebCore/dom/Document.cpp:3553
> +void Document::cancelEnqueuedEvents()
> +{
> +    m_eventQueue->cancelEnqueuedEvents();
> +}

I suggest just doing this in Document::detach instead of adding a function for it.
Comment 5 Stephanie Lewis 2011-04-06 18:23:57 PDT
committed http://trac.webkit.org/changeset/83128
Comment 6 WebKit Review Bot 2011-04-06 19:04:18 PDT
http://trac.webkit.org/changeset/83128 might have broken SnowLeopard Intel Release (Tests)
The following tests are not passing:
fast/dom/52776.html
fast/text/complex-text-opacity.html
fast/text/international/bidi-AN-after-L.html
fast/text/international/bidi-AN-after-empty-run.html
fast/text/international/bidi-CS-after-AN.html
fast/text/international/bidi-mirror-he-ar.html
fast/text/international/bidi-neutral-run.html
platform/mac/fast/text/international/Geeza-Pro-vertical-metrics-adjustment.html