Changeset 73335 in webkit
- Timestamp:
- Dec 4, 2010 12:40:10 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73331 r73335 1 2010-12-04 Gavin Peters <gavinp@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Implement onload events for <link rel=prefetch> 6 https://bugs.webkit.org/show_bug.cgi?id=50187 7 8 * fast/dom/HTMLLinkElement/link-and-subresource-test-expected.txt: Added. 9 * fast/dom/HTMLLinkElement/link-and-subresource-test.html: Added. 10 * fast/dom/HTMLLinkElement/prefetch-expected.txt: 11 * fast/dom/HTMLLinkElement/prefetch-onload-expected.txt: Added. 12 * fast/dom/HTMLLinkElement/prefetch-onload.html: Added. 13 * fast/dom/HTMLLinkElement/prefetch.html: 14 * http/tests/misc/prefetch-purpose.html: 15 * platform/gtk/Skipped: 16 * platform/mac/Skipped: 17 * platform/qt/Skipped: 18 * platform/win/Skipped: 19 1 20 2010-12-04 Martin Robinson <mrobinson@igalia.com> 2 21 -
trunk/LayoutTests/fast/dom/HTMLLinkElement/prefetch-expected.txt
r63032 r73335 1 1 prefetch.link has MIME type application/octet-stream 2 2 This test requires DumpRenderTree to see the log of what resources are loaded. 3 4 SUCCESS! prefetch onload called. -
trunk/LayoutTests/fast/dom/HTMLLinkElement/prefetch.html
r63032 r73335 1 1 <body> 2 2 <script> 3 function log(message) { 4 var item = document.createElement("li"); 5 item.appendChild(document.createTextNode(message)); 6 document.getElementById("console").appendChild(item); 7 } 8 function prefetch_onload() { 9 log("SUCCESS! prefetch onload called."); 10 layoutTestController.notifyDone(); 11 } 3 12 if (window.layoutTestController) { 4 13 layoutTestController.waitUntilDone(); 5 14 layoutTestController.dumpAsText(); 6 15 layoutTestController.dumpResourceResponseMIMETypes(); 7 setTimeout("layoutTestController.notifyDone()",50);8 16 } 9 17 </script> 10 18 <html> 11 19 <p>This test requires DumpRenderTree to see the log of what resources are loaded. 12 <link href="prefetch.link" rel="prefetch"> 20 <link href="prefetch.link" rel="prefetch" onload="prefetch_onload()"> 21 <p><ol id="console"></ol> 13 22 </html> 14 23 -
trunk/LayoutTests/http/tests/misc/prefetch-purpose.html
r69420 r73335 13 13 } 14 14 </script> 15 <link href="resources/prefetch-purpose.php" rel="prefetch" >15 <link href="resources/prefetch-purpose.php" rel="prefetch" onload="finishUp()"> 16 16 </head> 17 <body onload="setTimeout('finishUp()', 50);">17 <body> 18 18 <p>Nothing to see here, this page should replace itself with resources/prefetch-purpose.php almost instantly. 19 19 </body> -
trunk/LayoutTests/platform/gtk/Skipped
r73329 r73335 5118 5118 5119 5119 # Link prefetch is disabled by default 5120 fast/dom/HTMLLinkElement/link-and-subresource-test.html 5120 5121 fast/dom/HTMLLinkElement/prefetch.html 5122 fast/dom/HTMLLinkElement/prefetch-onload.html 5121 5123 5122 5124 # LayoutTestController::pageProperty is not implemented for GTK yet. -
trunk/LayoutTests/platform/mac/Skipped
r73175 r73335 185 185 186 186 # Link prefetch is disabled by default 187 fast/dom/HTMLLinkElement/link-and-subresource-test.html 187 188 fast/dom/HTMLLinkElement/prefetch.html 189 fast/dom/HTMLLinkElement/prefetch-onload.html 188 190 http/tests/misc/prefetch-purpose.html 189 191 -
trunk/LayoutTests/platform/qt/Skipped
r73241 r73335 5150 5150 5151 5151 # Link prefetch is disabled by default 5152 fast/dom/HTMLLinkElement/link-and-subresource-test.html 5152 5153 fast/dom/HTMLLinkElement/prefetch.html 5154 fast/dom/HTMLLinkElement/prefetch-onload.html 5153 5155 http/tests/misc/prefetch-purpose.html 5154 5156 -
trunk/LayoutTests/platform/win/Skipped
r73317 r73335 947 947 948 948 # Link prefetch is disabled by default 949 fast/dom/HTMLLinkElement/link-and-subresource-test.html 949 950 fast/dom/HTMLLinkElement/prefetch.html 951 fast/dom/HTMLLinkElement/prefetch-onload.html 950 952 http/tests/misc/prefetch-purpose.html 951 953 -
trunk/WebCore/ChangeLog
r73330 r73335 1 2010-12-04 Gavin Peters <gavinp@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Implement onload events for <link rel=prefetch> 6 https://bugs.webkit.org/show_bug.cgi?id=50187 7 8 Tests: fast/dom/HTMLLinkElement/link-and-subresource-test.html 9 fast/dom/HTMLLinkElement/prefetch-onload.html 10 11 * html/HTMLLinkElement.cpp: 12 (WebCore::HTMLLinkElement::HTMLLinkElement): 13 (WebCore::HTMLLinkElement::~HTMLLinkElement): 14 (WebCore::HTMLLinkElement::parseMappedAttribute): 15 (WebCore::HTMLLinkElement::process): 16 (WebCore::HTMLLinkElement::onloadTimerFired): 17 (WebCore::HTMLLinkElement::notifyFinished): 18 * html/HTMLLinkElement.h: 19 * loader/cache/CachedResource.cpp: 20 (WebCore::CachedResource::data): 21 1 22 2010-12-04 Xan Lopez <xlopez@igalia.com> 2 23 -
trunk/WebCore/html/HTMLLinkElement.cpp
r71767 r73335 49 49 inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* document, bool createdByParser) 50 50 : HTMLElement(tagName, document) 51 #if ENABLE(LINK_PREFETCH) 52 , m_onloadTimer(this, &HTMLLinkElement::onloadTimerFired) 53 #endif 51 54 , m_disabledState(Unset) 52 55 , m_loading(false) … … 71 74 document()->removePendingSheet(); 72 75 } 76 77 #if ENABLE(LINK_PREFETCH) 78 if (m_cachedLinkPrefetch) 79 m_cachedLinkPrefetch->removeClient(this); 80 #endif 73 81 } 74 82 … … 134 142 else if (attr->name() == onbeforeloadAttr) 135 143 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr)); 144 #if ENABLE(LINK_PREFETCH) 145 else if (attr->name() == onloadAttr) 146 setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr)); 147 #endif 136 148 else { 137 149 if (attr->name() == titleAttr && m_sheet) … … 204 216 205 217 #if ENABLE(LINK_PREFETCH) 206 if (m_relAttribute.m_isLinkPrefetch && m_url.isValid() && document()->frame()) 207 document()->cachedResourceLoader()->requestLinkPrefetch(m_url); 218 if (m_relAttribute.m_isLinkPrefetch && m_url.isValid() && document()->frame()) { 219 m_cachedLinkPrefetch = document()->cachedResourceLoader()->requestLinkPrefetch(m_url); 220 if (m_cachedLinkPrefetch) 221 m_cachedLinkPrefetch->addClient(this); 222 } 208 223 #endif 209 224 … … 357 372 } 358 373 374 #if ENABLE(LINK_PREFETCH) 375 void HTMLLinkElement::onloadTimerFired(Timer<HTMLLinkElement>* timer) 376 { 377 ASSERT_UNUSED(timer, timer == &m_onloadTimer); 378 dispatchEvent(Event::create(eventNames().loadEvent, false, false)); 379 } 380 381 void HTMLLinkElement::notifyFinished(CachedResource* resource) 382 { 383 m_onloadTimer.startOneShot(0); 384 if (m_cachedLinkPrefetch.get() == resource) { 385 m_cachedLinkPrefetch->removeClient(this); 386 m_cachedLinkPrefetch = 0; 387 } 388 } 389 #endif 390 359 391 bool HTMLLinkElement::sheetLoaded() 360 392 { -
trunk/WebCore/html/HTMLLinkElement.h
r66057 r73335 28 28 #include "CachedResourceHandle.h" 29 29 #include "HTMLElement.h" 30 #include "Timer.h" 30 31 31 32 namespace WebCore { 32 33 33 34 class CachedCSSStyleSheet; 35 class CachedResource; 34 36 class KURL; 35 37 … … 78 80 virtual void parseMappedAttribute(Attribute*); 79 81 82 #if ENABLE(LINK_PREFETCH) 83 void onloadTimerFired(Timer<HTMLLinkElement>*); 84 #endif 80 85 void process(); 81 86 static void processCallback(Node*); … … 86 91 // from CachedResourceClient 87 92 virtual void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet* sheet); 93 #if ENABLE(LINK_PREFETCH) 94 virtual void notifyFinished(CachedResource*); 95 #endif 88 96 virtual bool sheetLoaded(); 89 97 … … 113 121 CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; 114 122 RefPtr<CSSStyleSheet> m_sheet; 123 #if ENABLE(LINK_PREFETCH) 124 CachedResourceHandle<CachedResource> m_cachedLinkPrefetch; 125 Timer<HTMLLinkElement> m_onloadTimer; 126 #endif 115 127 KURL m_url; 116 128 String m_type; -
trunk/WebCore/loader/cache/CachedResource.cpp
r72303 r73335 116 116 return; 117 117 118 setLoading(false); 118 119 CachedResourceClientWalker w(m_clients); 119 120 while (CachedResourceClient* c = w.next())
Note: See TracChangeset
for help on using the changeset viewer.