зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160447 - xhr internal code exposure. r=jst, a=sylvestre
This commit is contained in:
Родитель
d29794e643
Коммит
01b10e053c
|
@ -303,6 +303,7 @@ nsXMLHttpRequest::nsXMLHttpRequest()
|
|||
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(true),
|
||||
mProgressSinceLastProgressEvent(false),
|
||||
mRequestSentTime(0), mTimeoutMilliseconds(0),
|
||||
mErrorStatus(NS_OK),
|
||||
mErrorLoad(false), mWaitingForOnStopRequest(false),
|
||||
mProgressTimerIsActive(false),
|
||||
mIsHtml(false),
|
||||
|
@ -1168,6 +1169,15 @@ nsXMLHttpRequest::Status()
|
|||
return status;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsXMLHttpRequest::InternalErrorCode() {
|
||||
if (IsDeniedCrossSiteRequest()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (uint32_t)mErrorStatus;
|
||||
}
|
||||
|
||||
IMPL_CSTRING_GETTER(GetStatusText)
|
||||
void
|
||||
nsXMLHttpRequest::GetStatusText(nsCString& aStatusText)
|
||||
|
@ -2219,6 +2229,8 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
mErrorStatus = status;
|
||||
|
||||
mWaitingForOnStopRequest = false;
|
||||
|
||||
if (mRequestObserver) {
|
||||
|
|
|
@ -499,6 +499,7 @@ public:
|
|||
// response
|
||||
void GetResponseURL(nsAString& aUrl);
|
||||
uint32_t Status();
|
||||
uint32_t InternalErrorCode();
|
||||
void GetStatusText(nsCString& aStatusText);
|
||||
void GetResponseHeader(const nsACString& aHeader, nsACString& aResult,
|
||||
ErrorResult& aRv);
|
||||
|
@ -751,6 +752,7 @@ protected:
|
|||
nsCOMPtr<nsITimer> mTimeoutTimer;
|
||||
void StartTimeoutTimer();
|
||||
void HandleTimeoutCallback();
|
||||
nsresult mErrorStatus;
|
||||
|
||||
bool mErrorLoad;
|
||||
bool mWaitingForOnStopRequest;
|
||||
|
|
|
@ -112,6 +112,8 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget {
|
|||
[Throws=Workers]
|
||||
readonly attribute unsigned short status;
|
||||
|
||||
readonly attribute unsigned long internalErrorCode;
|
||||
|
||||
readonly attribute ByteString statusText;
|
||||
[Throws]
|
||||
ByteString? getResponseHeader(ByteString header);
|
||||
|
|
|
@ -199,6 +199,11 @@ public:
|
|||
return mStateData.mStatus;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
InternalErrorCode() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
GetStatusText(nsACString& aStatusText) const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче