Changeset 259080 in webkit
- Timestamp:
- Mar 26, 2020 2:33:33 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r259079 r259080 1 2020-03-26 Chris Dumez <cdumez@apple.com> 2 3 [ Mac wk1] ASSERTION FAILED: m_wrapper under WebCore::XMLHttpRequestUpload::dispatchProgressEvent 4 https://bugs.webkit.org/show_bug.cgi?id=209560 5 <rdar://problem/60887773> 6 7 Reviewed by Geoffrey Garen. 8 9 XMLHttpRequest::hasPendingActivity() was returning false if the XMLHttpRequest object did not 10 have any relevant event listeners. However, the XMLHttpRequestUpload's wrapper lifetime is tried 11 to the lifetime of its XMLHttpRequest wrapper. As a result, both the XMLHttpRequest and 12 XMLHttpRequestUpload wrappers could get garbage collected if the XMLHttpRequest did not have a 13 relevant listener, even though XMLHttpRequestUpload may have a relevant event listeners. We would 14 then hit the assertion when trying to fire an event on this XMLHttpRequestUpload object. 15 16 To address the issue, we update XMLHttpRequest::hasPendingActivity() to return false if both 17 XMLHttpRequest AND XMLHttpRequestUpload have no relevant event listeners. 18 19 No new tests, covered by imported/w3c/web-platform-tests/xhr/send-response-upload-event-progress.htm 20 21 * xml/XMLHttpRequest.cpp: 22 (WebCore::XMLHttpRequest::hasPendingActivity const): 23 * xml/XMLHttpRequestUpload.cpp: 24 (WebCore::XMLHttpRequestUpload::eventListenersDidChange): 25 * xml/XMLHttpRequestUpload.h: 26 1 27 2020-03-26 Ryosuke Niwa <rniwa@webkit.org> 2 28 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r258866 r259080 1183 1183 return true; 1184 1184 1185 if (!m_hasRelevantEventListener )1185 if (!m_hasRelevantEventListener && !(m_upload && m_upload->hasRelevantEventListener())) 1186 1186 return false; 1187 1187 -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.cpp
r246490 r259080 42 42 } 43 43 44 void XMLHttpRequestUpload::eventListenersDidChange() 45 { 46 m_hasRelevantEventListener = hasEventListeners(eventNames().abortEvent) 47 || hasEventListeners(eventNames().errorEvent) 48 || hasEventListeners(eventNames().loadEvent) 49 || hasEventListeners(eventNames().loadendEvent) 50 || hasEventListeners(eventNames().loadstartEvent) 51 || hasEventListeners(eventNames().progressEvent) 52 || hasEventListeners(eventNames().timeoutEvent); 53 } 54 44 55 void XMLHttpRequestUpload::dispatchProgressEvent(const AtomString& type, unsigned long long loaded, unsigned long long total) 45 56 { -
trunk/Source/WebCore/xml/XMLHttpRequestUpload.h
r246490 r259080 41 41 void dispatchProgressEvent(const AtomString& type, unsigned long long loaded, unsigned long long total); 42 42 43 bool hasRelevantEventListener() const { return m_hasRelevantEventListener; } 44 43 45 private: 46 // EventTarget. 47 void eventListenersDidChange() final; 44 48 void refEventTarget() final { ref(); } 45 49 void derefEventTarget() final { deref(); } … … 49 53 50 54 XMLHttpRequest& m_request; 55 bool m_hasRelevantEventListener { false }; 51 56 }; 52 57
Note: See TracChangeset
for help on using the changeset viewer.