Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 0027809

Browse files
committed
Backed out 6 changesets (bug 1582348) for build bustage in streams/WritableStreamOperations.cpp
Backed out changeset bb2e05de0638 (bug 1582348) Backed out changeset c5b476005983 (bug 1582348) Backed out changeset 0d8e86bb06d0 (bug 1582348) Backed out changeset 7628d3f14514 (bug 1582348) Backed out changeset 728075c80f4d (bug 1582348) Backed out changeset 4ceb625e5eb0 (bug 1582348)
1 parent 03ac18e commit 0027809

17 files changed

Lines changed: 28 additions & 829 deletions

js/public/Stream.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -485,21 +485,6 @@ extern JS_PUBLIC_API bool ReadableStreamReaderReleaseLock(JSContext* cx,
485485
extern JS_PUBLIC_API JSObject* ReadableStreamDefaultReaderRead(
486486
JSContext* cx, HandleObject reader);
487487

488-
class JS_PUBLIC_API WritableStreamUnderlyingSink {
489-
public:
490-
virtual ~WritableStreamUnderlyingSink() {}
491-
492-
/**
493-
* Invoked when the associated WritableStream object is finalized. The
494-
* stream object is not passed as an argument, as it might not be in a
495-
* valid state anymore.
496-
*
497-
* Note: Finalization can happen on a background thread, so the embedding
498-
* must be prepared for `finalize()` to be invoked from any thread.
499-
*/
500-
virtual void finalize() = 0;
501-
};
502-
503488
} // namespace JS
504489

505490
#endif // js_Stream_h

js/src/builtin/streams/MiscellaneousOperations.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ MOZ_MUST_USE bool js::ValidateAndNormalizeHighWaterMark(
187187
* The standard makes a big deal of turning JavaScript functions (grubby,
188188
* touched by users, covered with germs) into algorithms (pristine,
189189
* respectable, purposeful). We don't bother. Here we only check for errors and
190-
* leave `size` unchanged. Then, in ReadableStreamDefaultControllerEnqueue and
191-
* WritableStreamDefaultControllerGetChunkSize where this value is used, we
192-
* check for undefined and behave as if we had "made" an "algorithm" for it.
190+
* leave `size` unchanged. Then, in ReadableStreamDefaultControllerEnqueue,
191+
* where this value is used, we have to check for undefined and behave as if we
192+
* had "made" an "algorithm" as described below.
193193
*/
194194
MOZ_MUST_USE bool js::MakeSizeAlgorithmFromSizeFunction(JSContext* cx,
195195
Handle<Value> size) {

js/src/builtin/streams/MiscellaneousOperations.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ extern MOZ_MUST_USE bool ValidateAndNormalizeHighWaterMark(
7878

7979
/**
8080
* Streams spec, 6.3.8. MakeSizeAlgorithmFromSizeFunction ( size )
81+
*
82+
* The standard makes a big deal of turning JavaScript functions (grubby,
83+
* touched by users, covered with germs) into algorithms (pristine,
84+
* respectable, purposeful). We don't bother. Here we only check for errors and
85+
* leave `size` unchanged. Then, in ReadableStreamDefaultControllerEnqueue,
86+
* where this value is used, we have to check for undefined and behave as if we
87+
* had "made" an "algorithm" as described below.
8188
*/
8289
extern MOZ_MUST_USE bool MakeSizeAlgorithmFromSizeFunction(
8390
JSContext* cx, JS::Handle<JS::Value> size);

js/src/builtin/streams/ReadableStreamDefaultControllerOperations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "builtin/streams/HandlerFunction-inl.h" // js::NewHandler
3838
#include "vm/Compartment-inl.h" // JS::Compartment::wrap, js::UnwrapCalleeSlot
3939
#include "vm/JSContext-inl.h" // JSContext::check
40-
#include "vm/JSObject-inl.h" // js::IsCallable, js::NewBuiltinClassInstance
40+
#include "vm/JSObject-inl.h" // js::IsCallable
4141
#include "vm/Realm-inl.h" // js::AutoRealm
4242

4343
using js::ReadableByteStreamController;

js/src/builtin/streams/StreamController-inl.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
#include "builtin/streams/StreamController.h" // js::StreamController
1313
#include "builtin/streams/ReadableStreamController.h" // js::Readable{ByteStream,StreamDefault}Controller
14-
#include "builtin/streams/WritableStreamDefaultController.h" // js::WritableStreamDefaultController
1514
#include "vm/JSObject.h" // JSObject
1615

1716
template <>
1817
inline bool JSObject::is<js::StreamController>() const {
1918
return is<js::ReadableStreamDefaultController>() ||
20-
is<js::ReadableByteStreamController>() ||
21-
is<js::WritableStreamDefaultController>();
19+
is<js::ReadableByteStreamController>();
2220
}
2321

2422
#endif // builtin_streams_ReadableStreamController_inl_h

js/src/builtin/streams/WritableStream-inl.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

js/src/builtin/streams/WritableStream.cpp

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "builtin/streams/ClassSpecMacro.h" // JS_STREAMS_CLASS_SPEC
1818
#include "builtin/streams/MiscellaneousOperations.h" // js::MakeSizeAlgorithmFromSizeFunction, js::ValidateAndNormalizeHighWaterMark
1919
#include "builtin/streams/WritableStreamDefaultControllerOperations.h" // js::SetUpWritableStreamDefaultControllerFromUnderlyingSink
20-
#include "builtin/streams/WritableStreamDefaultWriter.h" // js::CreateWritableStreamDefaultWriter
2120
#include "js/CallArgs.h" // JS::CallArgs{,FromVp}
2221
#include "js/Class.h" // JS{Function,Property}Spec, JS_{FS,PS}_END, JSCLASS_PRIVATE_IS_NSISUPPORTS, JSCLASS_HAS_PRIVATE, JS_NULL_CLASS_OPS
2322
#include "js/RealmOptions.h" // JS::RealmCreationOptions
@@ -29,12 +28,9 @@
2928
#include "vm/ObjectOperations.h" // js::GetProperty
3029
#include "vm/Realm.h" // JS::Realm
3130

32-
#include "vm/Compartment-inl.h" // js::UnwrapAndTypeCheckThis
3331
#include "vm/JSObject-inl.h" // js::NewBuiltinClassInstance
3432
#include "vm/NativeObject-inl.h" // js::ThrowIfNotConstructing
3533

36-
using js::CreateWritableStreamDefaultWriter;
37-
using js::UnwrapAndTypeCheckThis;
3834
using js::WritableStream;
3935

4036
using JS::CallArgs;
@@ -148,30 +144,7 @@ bool WritableStream::constructor(JSContext* cx, unsigned argc, Value* vp) {
148144
return true;
149145
}
150146

151-
/**
152-
* Streams spec, 4.2.5.3. getWriter()
153-
*/
154-
static bool WritableStream_getWriter(JSContext* cx, unsigned argc, Value* vp) {
155-
CallArgs args = CallArgsFromVp(argc, vp);
156-
157-
// Step 1: If ! WritableStream(this) is false, throw a TypeError exception.
158-
Rooted<WritableStream*> unwrappedStream(
159-
cx, UnwrapAndTypeCheckThis<WritableStream>(cx, args, "getWriter"));
160-
if (!unwrappedStream) {
161-
return false;
162-
}
163-
164-
auto* writer = CreateWritableStreamDefaultWriter(cx, unwrappedStream);
165-
if (!writer) {
166-
return false;
167-
}
168-
169-
args.rval().setObject(*writer);
170-
return true;
171-
}
172-
173-
static const JSFunctionSpec WritableStream_methods[] = {
174-
JS_FN("getWriter", WritableStream_getWriter, 0, 0), JS_FS_END};
147+
static const JSFunctionSpec WritableStream_methods[] = {JS_FS_END};
175148

176149
static const JSPropertySpec WritableStream_properties[] = {JS_PS_END};
177150

js/src/builtin/streams/WritableStream.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ struct JSContext;
2727
namespace js {
2828

2929
class WritableStreamDefaultController;
30-
class WritableStreamDefaultWriter;
3130

3231
class WritableStream : public NativeObject {
3332
public:
@@ -183,14 +182,9 @@ class WritableStream : public NativeObject {
183182

184183
public:
185184
bool writable() const { return state() == Writable; }
186-
187185
bool closed() const { return state() == Closed; }
188-
189186
bool erroring() const { return state() == Erroring; }
190-
void setErroring() { setState(Erroring); }
191-
192187
bool errored() const { return state() == Errored; }
193-
void setErrored() { setState(Errored); }
194188

195189
bool backpressure() const { return flags() & Backpressure; }
196190

@@ -211,8 +205,9 @@ class WritableStream : public NativeObject {
211205
}
212206

213207
bool hasWriter() const { return !getFixedSlot(Slot_Writer).isUndefined(); }
214-
inline WritableStreamDefaultWriter* writer() const;
215-
inline void setWriter(WritableStreamDefaultWriter* writer);
208+
void setWriter(JSObject* writer) {
209+
setFixedSlot(Slot_Writer, JS::ObjectValue(*writer));
210+
}
216211
void clearWriter() { setFixedSlot(Slot_Writer, JS::UndefinedValue()); }
217212

218213
JS::Value storedError() const { return getFixedSlot(Slot_StoredError); }

js/src/builtin/streams/WritableStreamDefaultController.cpp

Lines changed: 0 additions & 41 deletions
This file was deleted.

js/src/builtin/streams/WritableStreamDefaultController.h

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)