Bug 106394 - If ImageLoader's loadEventSender or errorEventSender fires after document is detached, the document will be leaked.
Summary: If ImageLoader's loadEventSender or errorEventSender fires after document is ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-01-08 16:11 PST by Yongjun Zhang
Modified: 2013-01-09 10:53 PST (History)
4 users (show)

See Also:


Attachments
Also deref the element in dispatchPendingLoadEvent and dispatchPendingErrorEvent if the document was detached. (2.76 KB, patch)
2013-01-08 17:22 PST, Yongjun Zhang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yongjun Zhang 2013-01-08 16:11:32 PST
If load the following HTML into OS X Safari and use heap to count the number of HTMLDocuments, you will see the number keeps growing, which indicates HTMLDocuments are not released.

<html>
<script type="text/javascript">

    window.addEventListener('DOMContentLoaded', function () {
        setTimeout(function() {location.reload();}, 100);
        
        for (var k=0; k<2000; k++) {
            setTimeout(function () {
                for (var i=0; i<20; i++) {
                    var bubble = document.createElement('img');
                    bubble.src = "http://www.myfakeserver.com/fake_image.png";
                    document.getElementById('map_439582365').appendChild(bubble);
                }
            }, k*25/10);
        }

    }, false);
</script>
<div id="map_439582365">
</div>
</body></html>
Comment 1 Yongjun Zhang 2013-01-08 16:13:53 PST
rdar://problem/12910603
Comment 2 Yongjun Zhang 2013-01-08 17:22:54 PST
Created attachment 181811 [details]
Also deref the element in dispatchPendingLoadEvent and dispatchPendingErrorEvent if the document was detached.
Comment 3 Alexey Proskuryakov 2013-01-09 10:05:32 PST
Comment on attachment 181811 [details]
Also deref the element in dispatchPendingLoadEvent and dispatchPendingErrorEvent if the document was detached.

Great catch!
Comment 4 David Kilzer (:ddkilzer) 2013-01-09 10:07:07 PST
<rdar://problem/12910603>
Comment 5 Yongjun Zhang 2013-01-09 10:33:31 PST
Comment on attachment 181811 [details]
Also deref the element in dispatchPendingLoadEvent and dispatchPendingErrorEvent if the document was detached.

thanks ap!
Comment 6 WebKit Review Bot 2013-01-09 10:53:34 PST
Comment on attachment 181811 [details]
Also deref the element in dispatchPendingLoadEvent and dispatchPendingErrorEvent if the document was detached.

Clearing flags on attachment: 181811

Committed r139209: <http://trac.webkit.org/changeset/139209>
Comment 7 WebKit Review Bot 2013-01-09 10:53:38 PST
All reviewed patches have been landed.  Closing bug.