Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 1217803002: Protect readystatechange event dispatch on XMLHttpRequest. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 m_state = newState; 657 m_state = newState;
658 dispatchReadyStateChangeEvent(); 658 dispatchReadyStateChangeEvent();
659 } 659 }
660 } 660 }
661 661
662 void XMLHttpRequest::dispatchReadyStateChangeEvent() 662 void XMLHttpRequest::dispatchReadyStateChangeEvent()
663 { 663 {
664 if (!executionContext()) 664 if (!executionContext())
665 return; 665 return;
666 666
667 // We need this protection because dispatchReadyStateChangeEvent may
668 // dispatch multiple events.
669 ScopedEventDispatchProtect protect(&m_eventDispatchRecursionLevel);
667 if (m_async || (m_state <= OPENED || m_state == DONE)) { 670 if (m_async || (m_state <= OPENED || m_state == DONE)) {
668 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect orXhrReadyStateChangeEvent::data(executionContext(), this)); 671 TRACE_EVENT1("devtools.timeline", "XHRReadyStateChange", "data", Inspect orXhrReadyStateChangeEvent::data(executionContext(), this));
669 XMLHttpRequestProgressEventThrottle::DeferredEventAction action = XMLHtt pRequestProgressEventThrottle::Ignore; 672 XMLHttpRequestProgressEventThrottle::DeferredEventAction action = XMLHtt pRequestProgressEventThrottle::Ignore;
670 if (m_state == DONE) { 673 if (m_state == DONE) {
671 if (m_error) 674 if (m_error)
672 action = XMLHttpRequestProgressEventThrottle::Clear; 675 action = XMLHttpRequestProgressEventThrottle::Clear;
673 else 676 else
674 action = XMLHttpRequestProgressEventThrottle::Flush; 677 action = XMLHttpRequestProgressEventThrottle::Flush;
675 } 678 }
676 m_progressEventThrottle->dispatchReadyStateChangeEvent(Event::create(Eve ntTypeNames::readystatechange), action); 679 m_progressEventThrottle->dispatchReadyStateChangeEvent(Event::create(Eve ntTypeNames::readystatechange), action);
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 visitor->trace(m_responseDocumentParser); 1865 visitor->trace(m_responseDocumentParser);
1863 visitor->trace(m_progressEventThrottle); 1866 visitor->trace(m_progressEventThrottle);
1864 visitor->trace(m_upload); 1867 visitor->trace(m_upload);
1865 visitor->trace(m_blobLoader); 1868 visitor->trace(m_blobLoader);
1866 XMLHttpRequestEventTarget::trace(visitor); 1869 XMLHttpRequestEventTarget::trace(visitor);
1867 DocumentParserClient::trace(visitor); 1870 DocumentParserClient::trace(visitor);
1868 ActiveDOMObject::trace(visitor); 1871 ActiveDOMObject::trace(visitor);
1869 } 1872 }
1870 1873
1871 } // namespace blink 1874 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698