Changeset 62957 in webkit
- Timestamp:
- Jul 9, 2010 8:55:57 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62952 r62957 1 2010-07-09 Michael Nordman <michaeln@google.com> 2 3 Reviewed by Dumitru Daniliuc. 4 5 Add a layout test to verify the expected number of progress events are raised by the appcache, 6 and that those events have properly set 'lengthComputable', 'loaded', and 'total' attributes. 7 Also update a couple of other tests that depend on counting the number of progress events to 8 determine success or failure to now expect the additional final progress event that is being 9 raised. 10 https://bugs.webkit.org/show_bug.cgi?id=37602 11 12 * http/tests/appcache/foreign-iframe-main-expected.txt: 13 * http/tests/appcache/progress-counter-expected.txt: Added. 14 * http/tests/appcache/progress-counter.html: Added. 15 * http/tests/appcache/resources/different-https-origin-resource.html: 16 * http/tests/appcache/resources/progress-counter.manifest: Added. 17 1 18 2010-07-09 Ben Murdoch <benm@google.com> 2 19 -
trunk/LayoutTests/http/tests/appcache/foreign-iframe-main-expected.txt
r40354 r62957 6 6 progress 7 7 progress 8 progress 8 9 cached 9 10 SUCCESS -
trunk/LayoutTests/http/tests/appcache/resources/different-https-origin-resource.html
r58433 r62957 21 21 finish(); 22 22 } 23 function progressHandler(e) 24 { 25 // The only resource listed in the manifest file is in a different https origin and should be skipped. 26 if (e.loaded != 0 || e.total != 0) 27 fail(); 28 } 23 29 24 applicationCache.onprogress = function() { fail(); }30 applicationCache.onprogress = progressHandler; 25 31 applicationCache.onnoupdate = function() { finish(); } 26 32 applicationCache.oncached = function() { finish(); } -
trunk/WebCore/ChangeLog
r62955 r62957 1 2010-07-09 Michael Nordman <michaeln@google.com> 2 3 Reviewed by Dumitru Daniliuc. 4 5 Use class ProgressEvent when raising appcache related progress events and 6 set the 'total', 'loaded', and 'lengthComputable' attributes. 7 Also raise the final progress event with the 'total' and 'loaded' attribute 8 values are equal to one another to keep pace with the spec for this feature. 9 https://bugs.webkit.org/show_bug.cgi?id=37602 10 11 Test: http/tests/appcache/progress-counter.html 12 13 * loader/appcache/ApplicationCacheGroup.cpp: 14 (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): 15 (WebCore::ApplicationCacheGroup::didFinishLoadingManifest): 16 (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): 17 (WebCore::ApplicationCacheGroup::startLoadingEntry): 18 (WebCore::CallCacheListenerTask::create): 19 (WebCore::CallCacheListenerTask::performTask): 20 (WebCore::CallCacheListenerTask::CallCacheListenerTask): 21 (WebCore::ApplicationCacheGroup::postListenerTask): 22 * loader/appcache/ApplicationCacheGroup.h: 23 (WebCore::ApplicationCacheGroup::postListenerTask): 24 * loader/appcache/ApplicationCacheHost.cpp: 25 (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): 26 (WebCore::ApplicationCacheHost::stopDeferringEvents): 27 (WebCore::ApplicationCacheHost::dispatchDOMEvent): 28 * loader/appcache/ApplicationCacheHost.h: 29 (WebCore::ApplicationCacheHost::DeferredEvent::DeferredEvent): 30 1 31 2010-07-09 Sebastian Dröge <sebastian.droege@collabora.co.uk> 2 32 -
trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp
r62927 r62957 58 58 , m_updateStatus(Idle) 59 59 , m_downloadingPendingMasterResourceLoadersCount(0) 60 , m_progressTotal(0) 61 , m_progressDone(0) 60 62 , m_frame(0) 61 63 , m_storageID(0) … … 752 754 m_cacheBeingUpdated->setFallbackURLs(manifest.fallbackURLs); 753 755 m_cacheBeingUpdated->setAllowsAllNetworkRequests(manifest.allowAllNetworkRequests); 754 756 757 m_progressTotal = m_pendingEntries.size(); 758 m_progressDone = 0; 759 755 760 startLoadingEntry(); 756 761 } … … 860 865 if (oldNewestCache) 861 866 cacheStorage().remove(oldNewestCache.get()); 862 // Fire the success events. 867 868 // Fire the final progress event. 869 ASSERT(m_progressDone == m_progressTotal); 870 postListenerTask(ApplicationCacheHost::PROGRESS_EVENT, m_progressTotal, m_progressDone, m_associatedDocumentLoaders); 871 872 // Fire the success event. 863 873 postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders); 864 874 } else { … … 927 937 EntryMap::const_iterator it = m_pendingEntries.begin(); 928 938 929 postListenerTask(ApplicationCacheHost::PROGRESS_EVENT, m_associatedDocumentLoaders); 939 postListenerTask(ApplicationCacheHost::PROGRESS_EVENT, m_progressTotal, m_progressDone, m_associatedDocumentLoaders); 940 m_progressDone++; 930 941 931 942 ASSERT(!m_currentHandle); … … 1026 1037 class CallCacheListenerTask : public ScriptExecutionContext::Task { 1027 1038 public: 1028 static PassOwnPtr<CallCacheListenerTask> create(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID )1039 static PassOwnPtr<CallCacheListenerTask> create(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone) 1029 1040 { 1030 return adoptPtr(new CallCacheListenerTask(loader, eventID ));1041 return adoptPtr(new CallCacheListenerTask(loader, eventID, progressTotal, progressDone)); 1031 1042 } 1032 1043 … … 1041 1052 ASSERT(frame->loader()->documentLoader() == m_documentLoader.get()); 1042 1053 1043 m_documentLoader->applicationCacheHost()->notifyDOMApplicationCache(m_eventID );1054 m_documentLoader->applicationCacheHost()->notifyDOMApplicationCache(m_eventID, m_progressTotal, m_progressDone); 1044 1055 } 1045 1056 1046 1057 private: 1047 CallCacheListenerTask(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID )1058 CallCacheListenerTask(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone) 1048 1059 : m_documentLoader(loader) 1049 1060 , m_eventID(eventID) 1061 , m_progressTotal(progressTotal) 1062 , m_progressDone(progressDone) 1050 1063 { 1051 1064 } … … 1053 1066 RefPtr<DocumentLoader> m_documentLoader; 1054 1067 ApplicationCacheHost::EventID m_eventID; 1068 int m_progressTotal; 1069 int m_progressDone; 1055 1070 }; 1056 1071 1057 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, const HashSet<DocumentLoader*>& loaderSet)1072 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone, const HashSet<DocumentLoader*>& loaderSet) 1058 1073 { 1059 1074 HashSet<DocumentLoader*>::const_iterator loaderSetEnd = loaderSet.end(); 1060 1075 for (HashSet<DocumentLoader*>::const_iterator iter = loaderSet.begin(); iter != loaderSetEnd; ++iter) 1061 postListenerTask(eventID, *iter);1062 } 1063 1064 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, DocumentLoader* loader)1076 postListenerTask(eventID, progressTotal, progressDone, *iter); 1077 } 1078 1079 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone, DocumentLoader* loader) 1065 1080 { 1066 1081 Frame* frame = loader->frame(); … … 1070 1085 ASSERT(frame->loader()->documentLoader() == loader); 1071 1086 1072 frame->document()->postTask(CallCacheListenerTask::create(loader, eventID ));1087 frame->document()->postTask(CallCacheListenerTask::create(loader, eventID, progressTotal, progressDone)); 1073 1088 } 1074 1089 -
trunk/WebCore/loader/appcache/ApplicationCacheGroup.h
r62502 r62957 93 93 94 94 private: 95 static void postListenerTask(ApplicationCacheHost::EventID, const HashSet<DocumentLoader*>&); 96 static void postListenerTask(ApplicationCacheHost::EventID, DocumentLoader*); 95 static void postListenerTask(ApplicationCacheHost::EventID id, const HashSet<DocumentLoader*>& set) { postListenerTask(id, 0, 0, set); } 96 static void postListenerTask(ApplicationCacheHost::EventID id, DocumentLoader* loader) { postListenerTask(id, 0, 0, loader); } 97 static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, const HashSet<DocumentLoader*>&); 98 static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, DocumentLoader*); 99 97 100 void scheduleReachedMaxAppCacheSizeCallback(); 98 101 … … 152 155 typedef HashMap<String, unsigned> EntryMap; 153 156 EntryMap m_pendingEntries; 157 158 // The total number of items to be processed to update the cache group and the number that have been done. 159 int m_progressTotal; 160 int m_progressDone; 154 161 155 162 // Frame used for fetching resources when updating. -
trunk/WebCore/loader/appcache/ApplicationCacheHost.cpp
r54044 r62957 38 38 #include "FrameLoaderClient.h" 39 39 #include "MainResourceLoader.h" 40 #include "ProgressEvent.h" 40 41 #include "ResourceLoader.h" 41 42 #include "ResourceRequest.h" … … 229 230 } 230 231 231 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id )232 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int done) 232 233 { 233 234 if (m_defersEvents) { 234 // Event s aredeferred until document.onload has fired.235 m_deferredEvents.append( id);235 // Event dispatching is deferred until document.onload has fired. 236 m_deferredEvents.append(DeferredEvent(id, total, done)); 236 237 return; 237 238 } 238 if (m_domApplicationCache) { 239 ExceptionCode ec = 0; 240 m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); 241 ASSERT(!ec); 242 } 239 dispatchDOMEvent(id, total, done); 243 240 } 244 241 … … 247 244 RefPtr<DocumentLoader> protect(documentLoader()); 248 245 for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { 249 EventID id = m_deferredEvents[i]; 250 if (m_domApplicationCache) { 251 ExceptionCode ec = 0; 252 m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); 253 ASSERT(!ec); 254 } 246 const DeferredEvent& deferred = m_deferredEvents[i]; 247 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.progressDone); 255 248 } 256 249 m_deferredEvents.clear(); 257 250 m_defersEvents = false; 251 } 252 253 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) 254 { 255 if (m_domApplicationCache) { 256 const AtomicString& eventType = DOMApplicationCache::toEventType(id); 257 ExceptionCode ec = 0; 258 RefPtr<Event> event; 259 if (id == PROGRESS_EVENT) 260 event = ProgressEvent::create(eventType, true, done, total); 261 else 262 event = Event::create(eventType, false, false); 263 m_domApplicationCache->dispatchEvent(event, ec); 264 ASSERT(!ec); 265 } 258 266 } 259 267 -
trunk/WebCore/loader/appcache/ApplicationCacheHost.h
r62508 r62957 108 108 bool swapCache(); 109 109 110 void setDOMApplicationCache(DOMApplicationCache* domApplicationCache);111 void notifyDOMApplicationCache(EventID id);110 void setDOMApplicationCache(DOMApplicationCache*); 111 void notifyDOMApplicationCache(EventID, int progressTotal, int progressDone); 112 112 113 113 void stopDeferringEvents(); // Also raises the events that have been queued up. … … 119 119 DocumentLoader* documentLoader() const { return m_documentLoader; } 120 120 121 struct DeferredEvent { 122 EventID eventID; 123 int progressTotal; 124 int progressDone; 125 DeferredEvent(EventID id, int total, int done) : eventID(id), progressTotal(total), progressDone(done) { } 126 }; 127 121 128 DOMApplicationCache* m_domApplicationCache; 122 129 DocumentLoader* m_documentLoader; 123 130 bool m_defersEvents; // Events are deferred until after document onload. 124 Vector<EventID> m_deferredEvents; 131 Vector<DeferredEvent> m_deferredEvents; 132 133 void dispatchDOMEvent(EventID, int progressTotal, int progressDone); 125 134 126 135 #if PLATFORM(CHROMIUM) -
trunk/WebKit/chromium/ChangeLog
r62950 r62957 1 2010-07-09 Michael Nordman <michaeln@google.com> 2 3 Reviewed by Dumitru Daniliuc. 4 5 Use class ProgressEvent when raising appcache related progress events and 6 set the 'total', 'loaded', and 'lengthComputable' attributes. 7 Also raise the final progress event with the 'total' and 'loaded' attribute 8 values are equal to one another to keep pace with the spec for this feature. 9 https://bugs.webkit.org/show_bug.cgi?id=37602 10 11 * src/ApplicationCacheHost.cpp: 12 (WebCore::ApplicationCacheHost::notifyDOMApplicationCache): 13 (WebCore::ApplicationCacheHost::stopDeferringEvents): 14 (WebCore::ApplicationCacheHost::dispatchDOMEvent): 15 * src/ApplicationCacheHostInternal.h: 16 (WebCore::ApplicationCacheHostInternal::notifyEventListener): 17 (WebCore::ApplicationCacheHostInternal::notifyProgressEventListener): 18 1 19 2010-07-09 David Holloway <dhollowa@chromium.org> 2 20 -
trunk/WebKit/chromium/src/ApplicationCacheHost.cpp
r54044 r62957 38 38 #include "DOMApplicationCache.h" 39 39 #include "Frame.h" 40 #include "ProgressEvent.h" 40 41 #include "Settings.h" 41 42 #include "WebURL.h" … … 196 197 } 197 198 198 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id )199 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int done) 199 200 { 200 201 if (m_defersEvents) { 201 m_deferredEvents.append(id); 202 // Event dispatching is deferred until document.onload has fired. 203 m_deferredEvents.append(DeferredEvent(id, total, done)); 202 204 return; 203 205 } 204 if (m_domApplicationCache) { 205 ExceptionCode ec = 0; 206 m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); 207 ASSERT(!ec); 208 } 206 dispatchDOMEvent(id, total, done); 209 207 } 210 208 … … 213 211 RefPtr<DocumentLoader> protect(documentLoader()); 214 212 for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { 215 EventID id = m_deferredEvents[i]; 216 if (m_domApplicationCache) { 217 ExceptionCode ec = 0; 218 m_domApplicationCache->dispatchEvent(Event::create(DOMApplicationCache::toEventType(id), false, false), ec); 219 ASSERT(!ec); 220 } 213 const DeferredEvent& deferred = m_deferredEvents[i]; 214 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.progressDone); 221 215 } 222 216 m_deferredEvents.clear(); 223 217 m_defersEvents = false; 218 } 219 220 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) 221 { 222 if (m_domApplicationCache) { 223 const AtomicString& eventType = DOMApplicationCache::toEventType(id); 224 ExceptionCode ec = 0; 225 RefPtr<Event> event; 226 if (id == PROGRESS_EVENT) 227 event = ProgressEvent::create(eventType, true, done, total); 228 else 229 event = Event::create(eventType, false, false); 230 m_domApplicationCache->dispatchEvent(event, ec); 231 ASSERT(!ec); 232 } 224 233 } 225 234 -
trunk/WebKit/chromium/src/ApplicationCacheHostInternal.h
r61856 r62957 56 56 virtual void notifyEventListener(WebKit::WebApplicationCacheHost::EventID eventID) 57 57 { 58 m_innerHost->notifyDOMApplicationCache(static_cast<ApplicationCacheHost::EventID>(eventID) );58 m_innerHost->notifyDOMApplicationCache(static_cast<ApplicationCacheHost::EventID>(eventID), 0, 0); 59 59 } 60 60 61 virtual void notifyProgressEventListener(const WebKit::WebURL&, int num_total, int num_complete)61 virtual void notifyProgressEventListener(const WebKit::WebURL&, int progressTotal, int progressDone) 62 62 { 63 // FIXME: Modify webcore's progress event handling to carry the extra info and alter the 64 // layout tests to not fail when the more recently specified 'final' event is raised. 65 // For now, we're eating the extra info and that last event. 66 // See https://bugs.webkit.org/show_bug.cgi?id=37602 67 if (num_complete == num_total) 68 return; 69 notifyEventListener(WebKit::WebApplicationCacheHost::ProgressEvent); 63 m_innerHost->notifyDOMApplicationCache(ApplicationCacheHost::PROGRESS_EVENT, progressTotal, progressDone); 70 64 } 71 65
Note: See TracChangeset
for help on using the changeset viewer.