Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: third_party/WebKit/Source/core/streams/ReadableStream.js

Issue 2432863004: Fix ReadableStream getReader({mode: 'byob'}) (Closed)
Patch Set: Fix test description Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/streams/chromium/get-reader-byob.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, binding, v8) { 5 (function(global, binding, v8) {
6 'use strict'; 6 'use strict';
7 7
8 const readableStreamReader = v8.createPrivateSymbol('[[reader]]'); 8 const readableStreamReader = v8.createPrivateSymbol('[[reader]]');
9 const readableStreamStoredError = v8.createPrivateSymbol('[[storedError]]'); 9 const readableStreamStoredError = v8.createPrivateSymbol('[[storedError]]');
10 const readableStreamController = v8.createPrivateSymbol('[[controller]]'); 10 const readableStreamController = v8.createPrivateSymbol('[[controller]]');
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 return ReadableStreamCancel(this, reason); 166 return ReadableStreamCancel(this, reason);
167 } 167 }
168 168
169 getReader({ mode } = {}) { 169 getReader({ mode } = {}) {
170 if (IsReadableStream(this) === false) { 170 if (IsReadableStream(this) === false) {
171 throw new TypeError(errIllegalInvocation); 171 throw new TypeError(errIllegalInvocation);
172 } 172 }
173 173
174 if (mode === 'byob') { 174 if (mode === 'byob') {
175 if (IsReadableByteStreamDefaultController(this[readableStreamController] ) === false) { 175 // TODO(ricea): This should be "If
176 // ! IsReadableByteStreamController(this.[[readableStreamController]])
177 // is false".
178 if (IsReadableStreamDefaultController(this[readableStreamController])) {
tyoshino (SeeGerritForStatus) 2016/10/20 10:26:01 i think it's ok not to have this if and just throw
Adam Rice 2016/10/20 10:35:34 Done.
176 throw new TypeError(errGetReaderNotByteStream); 179 throw new TypeError(errGetReaderNotByteStream);
177 } 180 }
178 181
179 return AcquireReadableStreamBYOBReader(this); 182 // TODO(ricea): "Return ? AcquireReadableStreamBYOBReader(this)."
180 } 183 }
181 184
182 if (mode === undefined) { 185 if (mode === undefined) {
183 return AcquireReadableStreamDefaultReader(this); 186 return AcquireReadableStreamDefaultReader(this);
184 } 187 }
185 188
186 throw new RangeError(errGetReaderBadMode); 189 throw new RangeError(errGetReaderBadMode);
187 } 190 }
188 191
189 tee() { 192 tee() {
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC ontrollerGetDesiredSize; 923 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC ontrollerGetDesiredSize;
921 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll erEnqueue; 924 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll erEnqueue;
922 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController Error; 925 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController Error;
923 926
924 binding.createReadableStreamWithExternalController = 927 binding.createReadableStreamWithExternalController =
925 (underlyingSource, strategy) => { 928 (underlyingSource, strategy) => {
926 return new ReadableStream( 929 return new ReadableStream(
927 underlyingSource, strategy, createWithExternalControllerSentinel); 930 underlyingSource, strategy, createWithExternalControllerSentinel);
928 }; 931 };
929 }); 932 });
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/streams/chromium/get-reader-byob.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698