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

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

Issue 60203010: XHR.abort(): no event dispatching in completed/non-started states. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 bool sendFlag = m_loader; 849 bool sendFlag = m_loader;
850 850
851 if (!internalAbort()) 851 if (!internalAbort())
852 return; 852 return;
853 853
854 clearResponse(); 854 clearResponse();
855 855
856 // Clear headers as required by the spec 856 // Clear headers as required by the spec
857 m_requestHeaders.clear(); 857 m_requestHeaders.clear();
858 858
859 if ((m_state <= OPENED && !sendFlag) || m_state == DONE) 859 if ((m_state <= OPENED && !sendFlag) || m_state == DONE) {
860 // No readystatechange event is dispatched.
860 m_state = UNSENT; 861 m_state = UNSENT;
861 else { 862 return;
862 ASSERT(!m_loader);
863 changeState(DONE);
864 m_state = UNSENT;
865 } 863 }
866 864
865 ASSERT(!m_loader);
866 changeState(DONE);
867 m_state = UNSENT;
868
867 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent: :create(EventTypeNames::abort)); 869 m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent: :create(EventTypeNames::abort));
868 if (!m_uploadComplete) { 870 if (!m_uploadComplete) {
869 m_uploadComplete = true; 871 m_uploadComplete = true;
870 if (m_upload && m_uploadEventsAllowed) 872 if (m_upload && m_uploadEventsAllowed)
871 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::creat e(EventTypeNames::abort)); 873 m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::creat e(EventTypeNames::abort));
872 } 874 }
873 } 875 }
874 876
875 void XMLHttpRequest::clearVariablesForLoading() 877 void XMLHttpRequest::clearVariablesForLoading()
876 { 878 {
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 { 1366 {
1365 return EventTargetNames::XMLHttpRequest; 1367 return EventTargetNames::XMLHttpRequest;
1366 } 1368 }
1367 1369
1368 ExecutionContext* XMLHttpRequest::executionContext() const 1370 ExecutionContext* XMLHttpRequest::executionContext() const
1369 { 1371 {
1370 return ActiveDOMObject::executionContext(); 1372 return ActiveDOMObject::executionContext();
1371 } 1373 }
1372 1374
1373 } // namespace WebCore 1375 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698