Bug 1582348 - Make WritableStream.prototype.abort return a promise rejected with a TypeError if passed an improper |this|, not throw that TypeError. r=arai

Differential Revision: https://phabricator.services.mozilla.com/D51967

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Walden 2019-11-07 00:19:28 +00:00
Родитель 531a7624de
Коммит 174b39b11f
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -180,11 +180,12 @@ static bool WritableStream_locked(JSContext* cx, unsigned argc, Value* vp) {
static bool WritableStream_abort(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
// Step 1: If ! WritableStream(this) is false, throw a TypeError exception.
// Step 1: If ! IsWritableStream(this) is false, return a promise rejected
// with a TypeError exception.
Rooted<WritableStream*> unwrappedStream(
cx, UnwrapAndTypeCheckThis<WritableStream>(cx, args, "abort"));
if (!unwrappedStream) {
return false;
return ReturnPromiseRejectedWithPendingError(cx, args);
}
// Step 2: If ! IsWritableStreamLocked(this) is true, return a promise