mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Backed out changeset 64d0dbf9706b (bug 1378342)
This commit is contained in:
parent
db728bce54
commit
03d1665672
@ -119,11 +119,5 @@ AbortSignal::Follower::Unfollow()
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AbortSignal::Follower::IsFollowing() const
|
||||
{
|
||||
return !!mFollowingSignal;
|
||||
}
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
|
@ -33,9 +33,6 @@ public:
|
||||
void
|
||||
Unfollow();
|
||||
|
||||
bool
|
||||
IsFollowing() const;
|
||||
|
||||
RefPtr<AbortSignal> mFollowingSignal;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/BodyUtil.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/FetchDriver.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FormData.h"
|
||||
@ -56,27 +56,6 @@ namespace dom {
|
||||
|
||||
using namespace workers;
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
AbortStream(JSContext* aCx, JS::Handle<JSObject*> aStream)
|
||||
{
|
||||
if (!JS::ReadableStreamIsReadable(aStream)) {
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<DOMException> e = DOMException::Create(NS_ERROR_DOM_ABORT_ERR);
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!GetOrCreateDOMReflector(aCx, e, &value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::ReadableStreamError(aCx, aStream, value);
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
||||
// This class helps the proxying of AbortSignal changes cross threads.
|
||||
class AbortSignalProxy final : public AbortSignal::Follower
|
||||
{
|
||||
@ -964,7 +943,6 @@ FetchBody<Response>::FetchBody(nsIGlobalObject* aOwner);
|
||||
template <class Derived>
|
||||
FetchBody<Derived>::~FetchBody()
|
||||
{
|
||||
Unfollow();
|
||||
}
|
||||
|
||||
template
|
||||
@ -1128,33 +1106,20 @@ FetchBody<Response>::SetMimeType();
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
FetchBody<Derived>::SetReadableStreamBody(JSContext* aCx, JSObject* aBody)
|
||||
FetchBody<Derived>::SetReadableStreamBody(JSObject* aBody)
|
||||
{
|
||||
MOZ_ASSERT(!mReadableStreamBody);
|
||||
MOZ_ASSERT(aBody);
|
||||
mReadableStreamBody = aBody;
|
||||
|
||||
RefPtr<AbortSignal> signal = DerivedClass()->GetSignal();
|
||||
if (!signal) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool aborted = signal->Aborted();
|
||||
if (aborted) {
|
||||
JS::Rooted<JSObject*> body(aCx, mReadableStreamBody);
|
||||
AbortStream(aCx, body);
|
||||
} else if (!IsFollowing()) {
|
||||
Follow(signal);
|
||||
}
|
||||
}
|
||||
|
||||
template
|
||||
void
|
||||
FetchBody<Request>::SetReadableStreamBody(JSContext* aCx, JSObject* aBody);
|
||||
FetchBody<Request>::SetReadableStreamBody(JSObject* aBody);
|
||||
|
||||
template
|
||||
void
|
||||
FetchBody<Response>::SetReadableStreamBody(JSContext* aCx, JSObject* aBody);
|
||||
FetchBody<Response>::SetReadableStreamBody(JSObject* aBody);
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
@ -1192,15 +1157,6 @@ FetchBody<Derived>::GetBody(JSContext* aCx,
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<AbortSignal> signal = DerivedClass()->GetSignal();
|
||||
if (signal) {
|
||||
if (signal->Aborted()) {
|
||||
AbortStream(aCx, body);
|
||||
} else if (!IsFollowing()) {
|
||||
Follow(signal);
|
||||
}
|
||||
}
|
||||
|
||||
mReadableStreamBody = body;
|
||||
aBodyOut.set(mReadableStreamBody);
|
||||
}
|
||||
@ -1313,30 +1269,5 @@ FetchBody<Response>::MaybeTeeReadableStreamBody(JSContext* aCx,
|
||||
nsIInputStream** aInputStream,
|
||||
ErrorResult& aRv);
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
FetchBody<Derived>::Aborted()
|
||||
{
|
||||
MOZ_ASSERT(mReadableStreamBody);
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(mOwner)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
JS::Rooted<JSObject*> body(cx, mReadableStreamBody);
|
||||
AbortStream(cx, body);
|
||||
}
|
||||
|
||||
template
|
||||
void
|
||||
FetchBody<Request>::Aborted();
|
||||
|
||||
template
|
||||
void
|
||||
FetchBody<Response>::Aborted();
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/AbortSignal.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/FetchStreamReader.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
@ -140,7 +139,6 @@ public:
|
||||
*/
|
||||
template <class Derived>
|
||||
class FetchBody : public FetchStreamHolder
|
||||
, public AbortSignal::Follower
|
||||
{
|
||||
public:
|
||||
friend class FetchBodyConsumer<Derived>;
|
||||
@ -235,10 +233,6 @@ public:
|
||||
virtual AbortSignal*
|
||||
GetSignal() const = 0;
|
||||
|
||||
// AbortSignal::Follower
|
||||
void
|
||||
Aborted() override;
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
|
||||
@ -261,7 +255,7 @@ protected:
|
||||
SetMimeType();
|
||||
|
||||
void
|
||||
SetReadableStreamBody(JSContext* aCx, JSObject* aBody);
|
||||
SetReadableStreamBody(JSObject* aBody);
|
||||
|
||||
private:
|
||||
Derived*
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FetchStream.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIStreamTransportService.h"
|
||||
#include "nsProxyRelease.h"
|
||||
@ -340,18 +339,6 @@ FetchStream::ErroredCallback(JSContext* aCx, JS::HandleObject aStream,
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(aUnderlyingSource);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFlags == FETCH_STREAM_FLAG);
|
||||
|
||||
// This is safe because we created an extra reference in FetchStream::Create()
|
||||
// that won't be released until FetchStream::FinalizeCallback() is called.
|
||||
// We are guaranteed that won't happen until the js ReadableStream object
|
||||
// is finalized.
|
||||
FetchStream* stream = static_cast<FetchStream*>(aUnderlyingSource);
|
||||
|
||||
if (stream->mInputStream) {
|
||||
stream->mInputStream->CloseWithStatus(NS_BASE_STREAM_CLOSED);
|
||||
}
|
||||
|
||||
stream->ReleaseObjects();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -251,7 +251,7 @@ Response::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
r->SetReadableStreamBody(aGlobal.Context(), readableStreamObj);
|
||||
r->SetReadableStreamBody(readableStreamObj);
|
||||
|
||||
if (JS::ReadableStreamGetMode(readableStreamObj) ==
|
||||
JS::ReadableStreamMode::ExternalSource) {
|
||||
@ -354,7 +354,7 @@ Response::Clone(JSContext* aCx, ErrorResult& aRv)
|
||||
// if this body is a native stream. In this case the InternalResponse will
|
||||
// have a clone of the native body and the ReadableStream will be created
|
||||
// lazily if needed.
|
||||
response->SetReadableStreamBody(aCx, body);
|
||||
response->SetReadableStreamBody(body);
|
||||
response->mFetchStreamReader = streamReader;
|
||||
ir->SetBody(inputStream, InternalResponse::UNKNOWN_BODY_SIZE);
|
||||
}
|
||||
@ -397,7 +397,7 @@ Response::CloneUnfiltered(JSContext* aCx, ErrorResult& aRv)
|
||||
// if this body is a native stream. In this case the InternalResponse will
|
||||
// have a clone of the native body and the ReadableStream will be created
|
||||
// lazily if needed.
|
||||
ref->SetReadableStreamBody(aCx, body);
|
||||
ref->SetReadableStreamBody(body);
|
||||
ref->mFetchStreamReader = streamReader;
|
||||
ir->SetBody(inputStream, InternalResponse::UNKNOWN_BODY_SIZE);
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
prefs: [javascript.options.streams:true,
|
||||
dom.streams.enabled:true]
|
@ -7,6 +7,12 @@
|
||||
[Window: Signal removed by setting to null]
|
||||
expected: FAIL
|
||||
|
||||
[Window: Stream errors once aborted. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[Window: Stream errors once aborted, after reading. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[Window: Stream will not error if body is empty. It's closed with an empty queue before it errors.]
|
||||
expected: FAIL
|
||||
|
||||
@ -22,6 +28,12 @@
|
||||
[DedicatedWorkerGlobalScope: Already aborted signal rejects immediately]
|
||||
expected: FAIL
|
||||
|
||||
[DedicatedWorkerGlobalScope: Stream errors once aborted. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[DedicatedWorkerGlobalScope: Stream errors once aborted, after reading. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[DedicatedWorkerGlobalScope: Stream will not error if body is empty. It's closed with an empty queue before it errors.]
|
||||
expected: FAIL
|
||||
|
||||
@ -37,6 +49,12 @@
|
||||
[SharedWorkerGlobalScope: Already aborted signal rejects immediately]
|
||||
expected: FAIL
|
||||
|
||||
[SharedWorkerGlobalScope: Stream errors once aborted. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[SharedWorkerGlobalScope: Stream errors once aborted, after reading. Underlying connection closed.]
|
||||
expected: FAIL
|
||||
|
||||
[SharedWorkerGlobalScope: Stream will not error if body is empty. It's closed with an empty queue before it errors.]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user