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

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

Issue 24225002: Don't dispatch events when XHR is set to sync mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Revert change on network-preflight-options.html Created 7 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) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com> 3 * Copyright (C) 2005, 2006 Alexey Proskuryakov <ap@nypop.com>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Copyright (C) 2012 Intel Corporation 5 * Copyright (C) 2012 Intel Corporation
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ResponseTypeArrayBuffer, 76 ResponseTypeArrayBuffer,
77 ResponseTypeStream 77 ResponseTypeStream
78 }; 78 };
79 79
80 enum DropProtection { 80 enum DropProtection {
81 DropProtectionSync, 81 DropProtectionSync,
82 DropProtectionAsync, 82 DropProtectionAsync,
83 }; 83 };
84 84
85 virtual void contextDestroyed(); 85 virtual void contextDestroyed();
86 virtual void didTimeout();
87 virtual bool canSuspend() const; 86 virtual bool canSuspend() const;
88 virtual void suspend(ReasonForSuspension); 87 virtual void suspend(ReasonForSuspension);
89 virtual void resume(); 88 virtual void resume();
90 virtual void stop(); 89 virtual void stop();
91 90
92 virtual const AtomicString& interfaceName() const OVERRIDE; 91 virtual const AtomicString& interfaceName() const OVERRIDE;
93 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; 92 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
94 93
95 const KURL& url() const { return m_url; } 94 const KURL& url() const { return m_url; }
96 String statusText(ExceptionState&) const; 95 String statusText(ExceptionState&) const;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool responseIsXML() const; 165 bool responseIsXML() const;
167 166
168 bool areMethodAndURLValidForSend(); 167 bool areMethodAndURLValidForSend();
169 168
170 bool initSend(ExceptionState&); 169 bool initSend(ExceptionState&);
171 void sendBytesData(const void*, size_t, ExceptionState&); 170 void sendBytesData(const void*, size_t, ExceptionState&);
172 171
173 String getRequestHeader(const AtomicString& name) const; 172 String getRequestHeader(const AtomicString& name) const;
174 void setRequestHeaderInternal(const AtomicString& name, const String& value) ; 173 void setRequestHeaderInternal(const AtomicString& name, const String& value) ;
175 174
175 // Changes m_state and dispatches a readyStateChange event if new m_state
176 // value is different from last one.
176 void changeState(State newState); 177 void changeState(State newState);
177 void callReadyStateChangeListener(); 178 void callReadyStateChangeListener();
178 void dropProtectionSoon(); 179 void dropProtectionSoon();
179 void dropProtection(Timer<XMLHttpRequest>* = 0); 180 void dropProtection(Timer<XMLHttpRequest>* = 0);
180 void internalAbort(DropProtection = DropProtectionSync); 181 void internalAbort(DropProtection = DropProtectionSync);
181 void clearResponse(); 182 void clearResponse();
182 void clearResponseBuffers(); 183 void clearResponseBuffers();
183 void clearRequest(); 184 void clearRequest();
184 185
185 void createRequest(ExceptionState&); 186 void createRequest(ExceptionState&);
186 187
187 void genericError(); 188 // Dispatches an event of the specified type to m_upload and
188 void networkError(); 189 // m_progressEventThrottle.
189 void abortError(); 190 void dispatchEventAndLoadEnd(const AtomicString&);
191 // Does clean up common for all kind of didFail() call.
192 void handleDidFailGeneric();
193 // Handles didFail() call not caused by cancellation or timeout.
194 void handleNetworkError();
195 // Handles didFail() call triggered by m_loader->cancel().
196 void handleDidCancel();
197 // Handles didFail() call for timeout.
198 void handleDidTimeout();
190 199
191 OwnPtr<XMLHttpRequestUpload> m_upload; 200 OwnPtr<XMLHttpRequestUpload> m_upload;
192 201
193 KURL m_url; 202 KURL m_url;
194 String m_method; 203 String m_method;
195 HTTPHeaderMap m_requestHeaders; 204 HTTPHeaderMap m_requestHeaders;
196 RefPtr<FormData> m_requestEntityBody; 205 RefPtr<FormData> m_requestEntityBody;
197 String m_mimeTypeOverride; 206 String m_mimeTypeOverride;
198 bool m_async; 207 bool m_async;
199 bool m_includeCredentials; 208 bool m_includeCredentials;
(...skipping 22 matching lines...) Expand all
222 bool m_uploadComplete; 231 bool m_uploadComplete;
223 232
224 bool m_sameOriginRequest; 233 bool m_sameOriginRequest;
225 bool m_allowCrossOriginRequests; 234 bool m_allowCrossOriginRequests;
226 235
227 // Used for onprogress tracking 236 // Used for onprogress tracking
228 long long m_receivedLength; 237 long long m_receivedLength;
229 238
230 unsigned m_lastSendLineNumber; 239 unsigned m_lastSendLineNumber;
231 String m_lastSendURL; 240 String m_lastSendURL;
241 // An exception to throw in synchronous mode. It's set when failure
242 // notification is received from m_loader and thrown at the end of send() if
243 // any.
232 ExceptionCode m_exceptionCode; 244 ExceptionCode m_exceptionCode;
233 245
234 XMLHttpRequestProgressEventThrottle m_progressEventThrottle; 246 XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
235 247
236 // An enum corresponding to the allowed string values for the responseType a ttribute. 248 // An enum corresponding to the allowed string values for the responseType a ttribute.
237 ResponseTypeCode m_responseTypeCode; 249 ResponseTypeCode m_responseTypeCode;
238 Timer<XMLHttpRequest> m_protectionTimer; 250 Timer<XMLHttpRequest> m_protectionTimer;
239 RefPtr<SecurityOrigin> m_securityOrigin; 251 RefPtr<SecurityOrigin> m_securityOrigin;
240 }; 252 };
241 253
242 } // namespace WebCore 254 } // namespace WebCore
243 255
244 #endif // XMLHttpRequest_h 256 #endif // XMLHttpRequest_h
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect-expected.txt ('k') | Source/core/xml/XMLHttpRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698