зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1502355 - Make |WritableStreamDefaultWriterWrite| return a narrower |PromiseObject*| type for more clarity. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D71115
This commit is contained in:
Родитель
90b380e4ae
Коммит
69ce41f4d6
|
@ -42,6 +42,7 @@ using JS::Value;
|
|||
|
||||
using js::ClassSpec;
|
||||
using js::GetErrorMessage;
|
||||
using js::PromiseObject;
|
||||
using js::ReturnPromiseRejectedWithPendingError;
|
||||
using js::UnwrapAndTypeCheckArgument;
|
||||
using js::UnwrapAndTypeCheckThis;
|
||||
|
@ -502,7 +503,7 @@ static MOZ_MUST_USE bool WritableStreamDefaultWriter_write(JSContext* cx,
|
|||
}
|
||||
|
||||
// Step 3: Return this.[[readyPromise]].
|
||||
JSObject* promise =
|
||||
PromiseObject* promise =
|
||||
WritableStreamDefaultWriterWrite(cx, unwrappedWriter, args.get(0));
|
||||
if (!promise) {
|
||||
return false;
|
||||
|
|
|
@ -312,7 +312,7 @@ bool js::WritableStreamDefaultWriterRelease(
|
|||
* Streams spec, 4.6.9.
|
||||
* WritableStreamDefaultWriterWrite ( writer, chunk )
|
||||
*/
|
||||
JSObject* js::WritableStreamDefaultWriterWrite(
|
||||
PromiseObject* js::WritableStreamDefaultWriterWrite(
|
||||
JSContext* cx, Handle<WritableStreamDefaultWriter*> unwrappedWriter,
|
||||
Handle<Value> chunk) {
|
||||
cx->check(chunk);
|
||||
|
@ -351,7 +351,8 @@ JSObject* js::WritableStreamDefaultWriterWrite(
|
|||
}
|
||||
|
||||
auto RejectWithStoredError =
|
||||
[](JSContext* cx, Handle<WritableStream*> unwrappedStream) -> JSObject* {
|
||||
[](JSContext* cx,
|
||||
Handle<WritableStream*> unwrappedStream) -> PromiseObject* {
|
||||
Rooted<Value> storedError(cx, unwrappedStream->storedError());
|
||||
if (!cx->compartment()->wrap(cx, &storedError)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -19,6 +19,7 @@ class JS_PUBLIC_API JSObject;
|
|||
|
||||
namespace js {
|
||||
|
||||
class PromiseObject;
|
||||
class WritableStreamDefaultWriter;
|
||||
|
||||
extern JSObject* WritableStreamDefaultWriterAbort(
|
||||
|
@ -43,7 +44,7 @@ extern MOZ_MUST_USE bool WritableStreamDefaultWriterGetDesiredSize(
|
|||
extern MOZ_MUST_USE bool WritableStreamDefaultWriterRelease(
|
||||
JSContext* cx, JS::Handle<WritableStreamDefaultWriter*> unwrappedWriter);
|
||||
|
||||
extern JSObject* WritableStreamDefaultWriterWrite(
|
||||
extern PromiseObject* WritableStreamDefaultWriterWrite(
|
||||
JSContext* cx, JS::Handle<WritableStreamDefaultWriter*> unwrappedWriter,
|
||||
JS::Handle<JS::Value> chunk);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче