зеркало из https://github.com/mozilla/gecko-dev.git
Bug 918734 - Throw invalid state errors when XHRs fail their CheckInnerWindowCorrectness() checks, to match the XHR spec. r=khuey
--HG-- extra : rebase_source : c8f7a5b05bc318464ffb9b3cae23ae7cb8a247ea
This commit is contained in:
Родитель
340717ad42
Коммит
5b4240186c
|
@ -1426,8 +1426,7 @@ XMLHttpRequestMainThread::Open(const nsACString& inMethod, const nsACString& url
|
|||
if (!doc) {
|
||||
// This could be because we're no longer current or because we're in some
|
||||
// non-window context...
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (NS_WARN_IF(NS_FAILED(CheckInnerWindowCorrectness()))) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
}
|
||||
|
@ -1448,8 +1447,10 @@ XMLHttpRequestMainThread::Open(const nsACString& inMethod, const nsACString& url
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
rv = CheckInnerWindowCorrectness();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(CheckInnerWindowCorrectness()))) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
// XXXbz this is wrong: we should only be looking at whether
|
||||
// user/password were passed, not at the values! See bug 759624.
|
||||
|
@ -1900,8 +1901,9 @@ XMLHttpRequestMainThread::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
} else {
|
||||
// If we're no longer current, just kill the load, though it really should
|
||||
// have been killed already.
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_WARN_IF(NS_FAILED(CheckInnerWindowCorrectness()))) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
// Create an empty document from it.
|
||||
|
@ -2446,7 +2448,9 @@ XMLHttpRequestMainThread::Send(nsIVariant* aVariant, const Nullable<RequestBody>
|
|||
PopulateNetworkInterfaceId();
|
||||
|
||||
nsresult rv = CheckInnerWindowCorrectness();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (mState != State::opened || // Step 1
|
||||
mFlagSend || // Step 2
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[open-url-multi-window-3.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: open() resolving URLs (multi-Window; 3; evil)]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче