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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/xml/XMLHttpRequest.h
diff --git a/Source/core/xml/XMLHttpRequest.h b/Source/core/xml/XMLHttpRequest.h
index ad3546d55fd71439db1ed5813fe0e1e5681be0c7..67dbbd8f8ee8c7307a043d5fa13077f47a5de783 100644
--- a/Source/core/xml/XMLHttpRequest.h
+++ b/Source/core/xml/XMLHttpRequest.h
@@ -83,7 +83,6 @@ public:
};
virtual void contextDestroyed();
- virtual void didTimeout();
virtual bool canSuspend() const;
virtual void suspend(ReasonForSuspension);
virtual void resume();
@@ -173,6 +172,8 @@ private:
String getRequestHeader(const AtomicString& name) const;
void setRequestHeaderInternal(const AtomicString& name, const String& value);
+ // Changes m_state and dispatches a readyStateChange event if new m_state
+ // value is different from last one.
void changeState(State newState);
void callReadyStateChangeListener();
void dropProtectionSoon();
@@ -184,9 +185,17 @@ private:
void createRequest(ExceptionState&);
- void genericError();
- void networkError();
- void abortError();
+ // Dispatches an event of the specified type to m_upload and
+ // m_progressEventThrottle.
+ void dispatchEventAndLoadEnd(const AtomicString&);
+ // Does clean up common for all kind of didFail() call.
+ void handleDidFailGeneric();
+ // Handles didFail() call not caused by cancellation or timeout.
+ void handleNetworkError();
+ // Handles didFail() call triggered by m_loader->cancel().
+ void handleDidCancel();
+ // Handles didFail() call for timeout.
+ void handleDidTimeout();
OwnPtr<XMLHttpRequestUpload> m_upload;
@@ -229,6 +238,9 @@ private:
unsigned m_lastSendLineNumber;
String m_lastSendURL;
+ // An exception to throw in synchronous mode. It's set when failure
+ // notification is received from m_loader and thrown at the end of send() if
+ // any.
ExceptionCode m_exceptionCode;
XMLHttpRequestProgressEventThrottle m_progressEventThrottle;
« 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