Changeset 85375 in webkit
- Timestamp:
- Apr 29, 2011 5:57:39 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r85374 r85375 1 2011-04-29 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Alexey Proskuryakov. 4 5 REGRESSION: r83938 abandons GC memory 6 https://bugs.webkit.org/show_bug.cgi?id=59604 7 8 Test an edge case of an image that has finished loading but has not yet 9 fired its load event. 10 11 * fast/dom/gc-image-element-expected.txt: Added. 12 * fast/dom/gc-image-element.html: Added. 13 1 14 2011-04-29 Emil Eklund <eae@chromium.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r85374 r85375 1 2011-04-29 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Alexey Proskuryakov. 4 5 REGRESSION: r83938 abandons GC memory 6 https://bugs.webkit.org/show_bug.cgi?id=59604 7 8 This bug was caused by script and image elements waiting indefinitely 9 for their loads to finish. 10 11 * bindings/js/JSNodeCustom.cpp: 12 (WebCore::isReachableFromDOM): Don't test for the load event firing, 13 since the load event doesn't fire in cases of canceled or errored loads. 14 Instead, test hasPendingActivity(). 15 16 Don't do this test at all for script elements because script elements 17 can't load while outside the document. (fast/dom/script-element-gc.html 18 verifies that this is correct.) 19 20 * html/HTMLImageElement.cpp: 21 (WebCore::HTMLImageElement::hasPendingActivity): 22 * html/HTMLImageElement.h: 23 * loader/ImageLoader.cpp: 24 (WebCore::ImageEventSender::hasPendingEvents): 25 (WebCore::ImageLoader::hasPendingLoadEvent): 26 * loader/ImageLoader.h: Added API for finding out if an image element 27 has pending activity. 28 29 * loader/cache/CachedResource.cpp: 30 (WebCore::CachedResource::setRequest): All loads are supposed to end in 31 data(allDataReceived = true) or error(), but in the edge case of a 32 canceled load, all we get is a call to setRequest(0). Be sure to 33 record that we're no longer loading in that case, otherwise our element 34 will leak forever, waiting for its load to complete. 35 1 36 2011-04-29 Emil Eklund <eae@chromium.org> 2 37 -
trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp
r84812 r85375 28 28 29 29 #include "Attr.h" 30 #include "CachedImage.h" 31 #include "CachedScript.h" 30 32 #include "CDATASection.h" 31 33 #include "Comment.h" … … 104 106 { 105 107 if (!node->inDocument()) { 106 // If a wrapper is the last reference to an image or scriptelement108 // If a wrapper is the last reference to an image element 107 109 // that is loading but not in the document, the wrapper is observable 108 110 // because it is the only thing keeping the image element alive, and if 109 // the imageelement is destroyed, its load event will not fire.111 // the element is destroyed, its load event will not fire. 110 112 // FIXME: The DOM should manage this issue without the help of JavaScript wrappers. 111 if (node->hasTagName(imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent())112 return true;113 if (node->hasTagName(scriptTag) && !static_cast<HTMLScriptElement*>(node)->haveFiredLoadEvent())114 return true;113 if (node->hasTagName(imgTag)) { 114 if (static_cast<HTMLImageElement*>(node)->hasPendingActivity()) 115 return true; 116 } 115 117 #if ENABLE(VIDEO) 116 if (node->hasTagName(audioTag) && !static_cast<HTMLAudioElement*>(node)->paused()) 117 return true; 118 else if (node->hasTagName(audioTag)) { 119 if (!static_cast<HTMLAudioElement*>(node)->paused()) 120 return true; 121 } 118 122 #endif 119 123 -
trunk/Source/WebCore/html/HTMLImageElement.cpp
r69868 r85375 386 386 } 387 387 388 bool HTMLImageElement::hasPendingActivity() 389 { 390 return (cachedImage() && cachedImage()->isLoading()) || m_imageLoader.hasPendingLoadEvent(); 391 } 392 388 393 void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const 389 394 { -
trunk/Source/WebCore/html/HTMLImageElement.h
r78232 r85375 74 74 75 75 bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } 76 bool hasPendingActivity(); 76 77 77 78 protected: -
trunk/Source/WebCore/loader/ImageLoader.cpp
r76248 r85375 68 68 void dispatchPendingEvents(); 69 69 70 #if !ASSERT_DISABLED71 70 bool hasPendingEvents(ImageLoader* loader) { return m_dispatchSoonList.find(loader) != notFound; } 72 #endif73 71 74 72 private: … … 313 311 } 314 312 313 bool ImageLoader::hasPendingLoadEvent() 314 { 315 return loadEventSender().hasPendingEvents(this); 316 } 317 315 318 ImageEventSender::ImageEventSender(const AtomicString& eventType) 316 319 : m_eventType(eventType) -
trunk/Source/WebCore/loader/ImageLoader.h
r66223 r85375 59 59 bool haveFiredBeforeLoadEvent() const { return m_firedBeforeLoad; } 60 60 bool haveFiredLoadEvent() const { return m_firedLoad; } 61 bool hasPendingLoadEvent(); 61 62 62 63 static void dispatchPendingBeforeLoadEvents(); -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r84110 r85375 250 250 m_status = Pending; 251 251 m_request = request; 252 253 // All loads finish with data(allDataReceived = true) or error(), except for 254 // canceled loads, which silently set our request to 0. Be sure to set our 255 // loading flag to false in that case, so we don't seem to continue loading 256 // forever. 257 if (!m_request) 258 setLoading(false); 259 252 260 if (canDelete() && !inCache()) 253 261 delete this;
Note: See TracChangeset
for help on using the changeset viewer.