Skip to content

Commit

Permalink
#600: M1588248 M1614704
Browse files Browse the repository at this point in the history
  • Loading branch information
classilla committed Apr 30, 2020
1 parent 5bb1c76 commit 03e03bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 8 additions & 2 deletions dom/workers/XMLHttpRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,8 @@ XMLHttpRequest::SendInternal(SendRunnable* aRunnable,
aRunnable->SetSyncLoopTarget(syncLoopTarget);
aRunnable->SetHaveUploadListeners(hasUploadListeners);

mStateData.mFlagSend = true;

if (!aRunnable->Dispatch(cx)) {
// Dispatch() may have spun the event loop and we may have already unrooted.
// If so we don't want autoUnpin to try again.
Expand All @@ -1879,7 +1881,11 @@ XMLHttpRequest::SendInternal(SendRunnable* aRunnable,

autoUnpin.Clear();

if (!autoSyncLoop->Run()) {
bool succeeded = autoSyncLoop->Run();
mStateData.mFlagSend = false;

if (!succeeded) {
// Somehow we didn't throw. Throw now.
aRv.Throw(NS_ERROR_FAILURE);
}
}
Expand Down Expand Up @@ -2083,7 +2089,7 @@ XMLHttpRequest::Send(ErrorResult& aRv)
return;
}

if (!mProxy) {
if (!mProxy || mStateData.mFlagSend) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion dom/workers/XMLHttpRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ class XMLHttpRequest final: public nsXHREventTarget,
nsresult mResponseTextResult;
nsresult mStatusResult;
nsresult mResponseResult;
bool mFlagSend; // TenFourFox issue 600 (backbugs for M1588248)

StateData()
: mStatus(0), mReadyState(0), mResponse(JS::UndefinedValue()),
mResponseTextResult(NS_OK), mStatusResult(NS_OK),
mResponseResult(NS_OK)
mResponseResult(NS_OK), mFlagSend(false)
{ }
};

Expand Down
5 changes: 3 additions & 2 deletions js/src/jit/MIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -4737,9 +4737,10 @@ class MCreateThis
return getOperand(0);
}

// Although creation of |this| modifies global state, it is safely repeatable.
// Performs a property read from |newTarget| iff |newTarget| is a JSFunction
// with an own |.prototype| property.
AliasSet getAliasSet() const override {
return AliasSet::None();
return AliasSet::Load(AliasSet::Any);
}
bool possiblyCalls() const override {
return true;
Expand Down

0 comments on commit 03e03bd

Please sign in to comment.