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

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

Issue 521403002: XHR: Abort DocumentParser on internalAbort (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add tests Created 6 years, 3 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
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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 ASSERT(!m_loader); 907 ASSERT(!m_loader);
908 handleRequestError(0, EventTypeNames::abort, receivedLength, expectedLen gth); 908 handleRequestError(0, EventTypeNames::abort, receivedLength, expectedLen gth);
909 } 909 }
910 m_state = UNSENT; 910 m_state = UNSENT;
911 } 911 }
912 912
913 void XMLHttpRequest::clearVariablesForLoading() 913 void XMLHttpRequest::clearVariablesForLoading()
914 { 914 {
915 m_decoder.clear(); 915 m_decoder.clear();
916 916
917 if (m_responseDocumentParser) {
918 #if !ENABLE(OILPAN)
919 m_responseDocumentParser->detach();
920 #endif
921 m_responseDocumentParser = nullptr;
922 }
923
917 m_finalResponseCharset = String(); 924 m_finalResponseCharset = String();
918 } 925 }
919 926
920 bool XMLHttpRequest::internalAbort() 927 bool XMLHttpRequest::internalAbort()
921 { 928 {
922 m_error = true; 929 m_error = true;
923 930
931 if (m_responseDocumentParser && m_responseDocumentParser->isStopped())
tyoshino (SeeGerritForStatus) 2014/09/01 05:06:05 I guess you wanted !m_responseDocumentParser->isS
kouhei (in TOK) 2014/09/01 05:16:57 Done.
932 m_responseDocumentParser->stopParsing();
933
924 clearVariablesForLoading(); 934 clearVariablesForLoading();
925 935
926 InspectorInstrumentation::didFailXHRLoading(executionContext(), this, this); 936 InspectorInstrumentation::didFailXHRLoading(executionContext(), this, this);
927 937
928 if (m_responseLegacyStream && m_state != DONE) 938 if (m_responseLegacyStream && m_state != DONE)
929 m_responseLegacyStream->abort(); 939 m_responseLegacyStream->abort();
930 940
931 if (m_responseStream) { 941 if (m_responseStream) {
932 // When the stream is already closed (including canceled from the 942 // When the stream is already closed (including canceled from the
933 // user), |error| does nothing. 943 // user), |error| does nothing.
(...skipping 30 matching lines...) Expand all
964 // FIXME: when we add the support for multi-part XHR, we will have to 974 // FIXME: when we add the support for multi-part XHR, we will have to
965 // be careful with this initialization. 975 // be careful with this initialization.
966 m_receivedLength = 0; 976 m_receivedLength = 0;
967 977
968 m_response = ResourceResponse(); 978 m_response = ResourceResponse();
969 979
970 m_responseText.clear(); 980 m_responseText.clear();
971 981
972 m_parsedResponse = false; 982 m_parsedResponse = false;
973 m_responseDocument = nullptr; 983 m_responseDocument = nullptr;
974 m_responseDocumentParser = nullptr;
975 984
976 m_responseBlob = nullptr; 985 m_responseBlob = nullptr;
977 m_downloadedBlobLength = 0; 986 m_downloadedBlobLength = 0;
978 987
979 m_responseLegacyStream = nullptr; 988 m_responseLegacyStream = nullptr;
980 m_responseStream = nullptr; 989 m_responseStream = nullptr;
981 990
982 // These variables may referred by the response accessors. So, we can clear 991 // These variables may referred by the response accessors. So, we can clear
983 // this only when we clear the response holder variables above. 992 // this only when we clear the response holder variables above.
984 m_binaryResponseBuilder.clear(); 993 m_binaryResponseBuilder.clear();
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 visitor->trace(m_responseStream); 1517 visitor->trace(m_responseStream);
1509 visitor->trace(m_streamSource); 1518 visitor->trace(m_streamSource);
1510 visitor->trace(m_responseDocument); 1519 visitor->trace(m_responseDocument);
1511 visitor->trace(m_responseDocumentParser); 1520 visitor->trace(m_responseDocumentParser);
1512 visitor->trace(m_progressEventThrottle); 1521 visitor->trace(m_progressEventThrottle);
1513 visitor->trace(m_upload); 1522 visitor->trace(m_upload);
1514 XMLHttpRequestEventTarget::trace(visitor); 1523 XMLHttpRequestEventTarget::trace(visitor);
1515 } 1524 }
1516 1525
1517 } // namespace blink 1526 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698