Source/WebCore/ChangeLog

 12012-03-21 Allan Sandfeld Jensen <allan.jensen@nokia.com>
 2
 3 Event dispatching in XMLHttpRequestProgressEventThrottle should go through XMLHttpRequestProgressEventThrottle::dispatchEvent
 4 https://bugs.webkit.org/show_bug.cgi?id=46743
 5
 6 Reviewed by NOBODY (OOPS!).
 7 Based on original patch by Anton D'Auria
 8
 9 * xml/XMLHttpRequest.cpp:
 10 (WebCore::XMLHttpRequest::callReadyStateChangeListener):
 11 * xml/XMLHttpRequestProgressEventThrottle.cpp:
 12 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent):
 13 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchEvent):
 14 (WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
 15 (WebCore::XMLHttpRequestProgressEventThrottle::dispatchPausedEvent):
 16 (WebCore::XMLHttpRequestProgressEventThrottle::fired):
 17 * xml/XMLHttpRequestProgressEventThrottle.h:
 18 (XMLHttpRequestProgressEventThrottle):
 19
1202012-03-21 Alexey Proskuryakov <ap@apple.com>
221
322 Remove obsolete File attributes

Source/WebCore/xml/XMLHttpRequest.cpp

@@void XMLHttpRequest::callReadyStateChangeListener()
389389 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willChangeXHRReadyState(scriptExecutionContext(), this);
390390
391391 if (m_async || (m_state <= OPENED || m_state == DONE))
392  m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
 392 m_progressEventThrottle.dispatchReadyStateChangeEvent(XMLHttpRequestProgressEvent::create(eventNames().readystatechangeEvent), m_state == DONE ? FlushProgressEvent : DoNotFlushProgressEvent);
393393
394394 InspectorInstrumentation::didChangeXHRReadyState(cookie);
395395

Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp

@@void XMLHttpRequestProgressEventThrottle::dispatchProgressEvent(bool lengthCompu
6969 m_total = total;
7070}
7171
72 void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
 72void XMLHttpRequestProgressEventThrottle::dispatchReadyStateChangeEvent(PassRefPtr<Event> event, ProgressEventAction progressEventAction)
 73{
 74 if (progressEventAction == FlushProgressEvent)
 75 flushProgressEvent();
 76
 77 dispatchEvent(event);
 78}
 79
 80void XMLHttpRequestProgressEventThrottle::dispatchEvent(PassRefPtr<Event> event)
7381{
7482 ASSERT(!suspended());
7583 // We should not have any pending events from a previous resume.
7684 ASSERT(!m_pausedEvent);
7785
78  if (progressEventAction == FlushProgressEvent)
79  flushProgressEvent();
80 
8186 m_target->dispatchEvent(event);
8287}
8388

@@void XMLHttpRequestProgressEventThrottle::flushProgressEvent()
101106 // We stop the timer as this is called when no more events are supposed to occur.
102107 stop();
103108
104  m_target->dispatchEvent(event);
 109 dispatchEvent(event);
105110}
106111
107112void XMLHttpRequestProgressEventThrottle::dispatchPausedEvent()

@@void XMLHttpRequestProgressEventThrottle::dispatchPausedEvent()
110115 if (!m_pausedEvent)
111116 return;
112117
113  m_target->dispatchEvent(m_pausedEvent);
 118 dispatchEvent(m_pausedEvent);
114119 m_pausedEvent = 0;
115120}
116121

@@void XMLHttpRequestProgressEventThrottle::fired()
125130 return;
126131 }
127132
128  m_target->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
 133 dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().progressEvent, m_lengthComputable, m_loaded, m_total));
129134 m_total = 0;
130135 m_loaded = 0;
131136}

Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.h

@@public:
4949 virtual ~XMLHttpRequestProgressEventThrottle();
5050
5151 void dispatchProgressEvent(bool lengthComputable, unsigned long long loaded, unsigned long long total);
52  void dispatchEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
 52 void dispatchReadyStateChangeEvent(PassRefPtr<Event>, ProgressEventAction = DoNotFlushProgressEvent);
 53 void dispatchEvent(PassRefPtr<Event>);
5354 void dispatchEventAndLoadEnd(PassRefPtr<Event>);
5455
5556 void suspend();