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

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

Issue 1060113004: [XMLHttpRequest] Stop throwing for network error in async mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 if (m_async) { 1060 if (m_async) {
1061 UseCounter::count(&executionContext, UseCounter::XMLHttpRequestAsynchron ous); 1061 UseCounter::count(&executionContext, UseCounter::XMLHttpRequestAsynchron ous);
1062 if (m_upload) 1062 if (m_upload)
1063 request.setReportUploadProgress(true); 1063 request.setReportUploadProgress(true);
1064 1064
1065 // ThreadableLoader::create can return null here, for example if we're n o longer attached to a page. 1065 // ThreadableLoader::create can return null here, for example if we're n o longer attached to a page.
1066 // This is true while running onunload handlers. 1066 // This is true while running onunload handlers.
1067 // FIXME: Maybe we need to be able to send XMLHttpRequests from onunload , <http://bugs.webkit.org/show_bug.cgi?id=10904>. 1067 // FIXME: Maybe we need to be able to send XMLHttpRequests from onunload , <http://bugs.webkit.org/show_bug.cgi?id=10904>.
1068 // FIXME: Maybe create() can return null for other reasons too? 1068 // FIXME: Maybe create() can return null for other reasons too?
1069 ASSERT(!m_loader); 1069 ASSERT(!m_loader);
1070 m_loader = ThreadableLoader::create(executionContext, this, request, opt ions, resourceLoaderOptions); 1070 m_loader = ThreadableLoader::create(executionContext, this, request, opt ions, resourceLoaderOptions);
sof 2015/07/12 13:34:48 Given that async will now no longer throw, I think
tyoshino (SeeGerritForStatus) 2015/07/14 07:00:05 Done.
1071 } else { 1071 } else {
1072 // Use count for XHR synchronous requests. 1072 // Use count for XHR synchronous requests.
1073 UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchrono us); 1073 UseCounter::count(&executionContext, UseCounter::XMLHttpRequestSynchrono us);
1074 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions); 1074 ThreadableLoader::loadResourceSynchronously(executionContext, request, * this, options, resourceLoaderOptions);
1075
1076 if (!m_exceptionCode && m_error)
1077 m_exceptionCode = NetworkError;
1078 if (m_exceptionCode)
1079 exceptionState.throwDOMException(m_exceptionCode, "Failed to load '" + m_url.elidedString() + "'.");
1075 } 1080 }
1076
1077 if (!m_exceptionCode && m_error)
1078 m_exceptionCode = NetworkError;
1079 if (m_exceptionCode)
1080 exceptionState.throwDOMException(m_exceptionCode, "Failed to load '" + m _url.elidedString() + "'.");
1081 } 1081 }
1082 1082
1083 void XMLHttpRequest::abort() 1083 void XMLHttpRequest::abort()
1084 { 1084 {
1085 WTF_LOG(Network, "XMLHttpRequest %p abort()", this); 1085 WTF_LOG(Network, "XMLHttpRequest %p abort()", this);
1086 1086
1087 // internalAbort() clears |m_loader|. Compute |sendFlag| now. 1087 // internalAbort() clears |m_loader|. Compute |sendFlag| now.
1088 // 1088 //
1089 // |sendFlag| corresponds to "the send() flag" defined in the XHR spec. 1089 // |sendFlag| corresponds to "the send() flag" defined in the XHR spec.
1090 // 1090 //
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 visitor->trace(m_responseDocumentParser); 1862 visitor->trace(m_responseDocumentParser);
1863 visitor->trace(m_progressEventThrottle); 1863 visitor->trace(m_progressEventThrottle);
1864 visitor->trace(m_upload); 1864 visitor->trace(m_upload);
1865 visitor->trace(m_blobLoader); 1865 visitor->trace(m_blobLoader);
1866 XMLHttpRequestEventTarget::trace(visitor); 1866 XMLHttpRequestEventTarget::trace(visitor);
1867 DocumentParserClient::trace(visitor); 1867 DocumentParserClient::trace(visitor);
1868 ActiveDOMObject::trace(visitor); 1868 ActiveDOMObject::trace(visitor);
1869 } 1869 }
1870 1870
1871 } // namespace blink 1871 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/resources/cross-origin-unsupported-url.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698