2011-04-29 Geoffrey Garen <ggaren@apple.com>
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Apr 2011 00:57:39 +0000 (00:57 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Apr 2011 00:57:39 +0000 (00:57 +0000)
commit1d9e9bf18a4d0b5e36bace9e45a834f379ab89fb
treeaafd18ff748f181eda3b0b4c289e53d519ba2057
parentf86c082963c538a83e61b111a01c7dcc15546ca3
2011-04-29  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Alexey Proskuryakov.

        REGRESSION: r83938 abandons GC memory
        https://bugs.webkit.org/show_bug.cgi?id=59604

        This bug was caused by script and image elements waiting indefinitely
        for their loads to finish.

        * bindings/js/JSNodeCustom.cpp:
        (WebCore::isReachableFromDOM): Don't test for the load event firing,
        since the load event doesn't fire in cases of canceled or errored loads.
        Instead, test hasPendingActivity().

        Don't do this test at all for script elements because script elements
        can't load while outside the document. (fast/dom/script-element-gc.html
        verifies that this is correct.)

        * html/HTMLImageElement.cpp:
        (WebCore::HTMLImageElement::hasPendingActivity):
        * html/HTMLImageElement.h:
        * loader/ImageLoader.cpp:
        (WebCore::ImageEventSender::hasPendingEvents):
        (WebCore::ImageLoader::hasPendingLoadEvent):
        * loader/ImageLoader.h: Added API for finding out if an image element
        has pending activity.

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::setRequest): All loads are supposed to end in
        data(allDataReceived = true) or error(), but in the edge case of a
        canceled load, all we get is a call to setRequest(0). Be sure to
        record that we're no longer loading in that case, otherwise our element
        will leak forever, waiting for its load to complete.
2011-04-29  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Alexey Proskuryakov.

        REGRESSION: r83938 abandons GC memory
        https://bugs.webkit.org/show_bug.cgi?id=59604

        Test an edge case of an image that has finished loading but has not yet
        fired its load event.

        * fast/dom/gc-image-element-expected.txt: Added.
        * fast/dom/gc-image-element.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/gc-image-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/gc-image-element.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageElement.h
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/loader/ImageLoader.h
Source/WebCore/loader/cache/CachedResource.cpp