Skip to content

Commit

Permalink
Bug 726777. r=sicking
Browse files Browse the repository at this point in the history
  • Loading branch information
amccreight committed Feb 14, 2012
1 parent 4a99786 commit 2902951
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion content/base/src/nsXMLHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ using namespace mozilla;
#define XML_HTTP_REQUEST_NEED_AC_PREFLIGHT (1 << 16) // Internal
#define XML_HTTP_REQUEST_AC_WITH_CREDENTIALS (1 << 17) // Internal
#define XML_HTTP_REQUEST_TIMED_OUT (1 << 18) // Internal
#define XML_HTTP_REQUEST_DELETED (1 << 19) // Internal

#define XML_HTTP_REQUEST_LOADSTATES \
(XML_HTTP_REQUEST_UNSENT | \
Expand Down Expand Up @@ -460,6 +461,8 @@ nsXMLHttpRequest::nsXMLHttpRequest()

nsXMLHttpRequest::~nsXMLHttpRequest()
{
mState |= XML_HTTP_REQUEST_DELETED;

if (mState & (XML_HTTP_REQUEST_STOPPED |
XML_HTTP_REQUEST_SENT |
XML_HTTP_REQUEST_LOADING)) {
Expand Down Expand Up @@ -1269,7 +1272,11 @@ nsXMLHttpRequest::CloseRequestWithError(const nsAString& aType,
PRUint32 responseLength = mResponseBody.Length();
ResetResponse();
mState |= aFlag;


// If we're in the destructor, don't risk dispatching an event.
if (mState & XML_HTTP_REQUEST_DELETED)
return;

if (!(mState & (XML_HTTP_REQUEST_UNSENT |
XML_HTTP_REQUEST_OPENED |
XML_HTTP_REQUEST_DONE))) {
Expand Down

0 comments on commit 2902951

Please sign in to comment.