OLD | NEW |
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 Loading... |
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): When BYOB readers are supported: |
176 throw new TypeError(errGetReaderNotByteStream); | 176 // |
177 } | 177 // a. If |
178 | 178 // ! IsReadableByteStreamController(this.[[readableStreamController]]) |
179 return AcquireReadableStreamBYOBReader(this); | 179 // is false, throw a TypeError exception. |
| 180 // b. Return ? AcquireReadableStreamBYOBReader(this). |
| 181 throw new TypeError(errGetReaderNotByteStream); |
180 } | 182 } |
181 | 183 |
182 if (mode === undefined) { | 184 if (mode === undefined) { |
183 return AcquireReadableStreamDefaultReader(this); | 185 return AcquireReadableStreamDefaultReader(this); |
184 } | 186 } |
185 | 187 |
186 throw new RangeError(errGetReaderBadMode); | 188 throw new RangeError(errGetReaderBadMode); |
187 } | 189 } |
188 | 190 |
189 tee() { | 191 tee() { |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC
ontrollerGetDesiredSize; | 922 binding.ReadableStreamDefaultControllerGetDesiredSize = ReadableStreamDefaultC
ontrollerGetDesiredSize; |
921 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll
erEnqueue; | 923 binding.ReadableStreamDefaultControllerEnqueue = ReadableStreamDefaultControll
erEnqueue; |
922 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController
Error; | 924 binding.ReadableStreamDefaultControllerError = ReadableStreamDefaultController
Error; |
923 | 925 |
924 binding.createReadableStreamWithExternalController = | 926 binding.createReadableStreamWithExternalController = |
925 (underlyingSource, strategy) => { | 927 (underlyingSource, strategy) => { |
926 return new ReadableStream( | 928 return new ReadableStream( |
927 underlyingSource, strategy, createWithExternalControllerSentinel); | 929 underlyingSource, strategy, createWithExternalControllerSentinel); |
928 }; | 930 }; |
929 }); | 931 }); |
OLD | NEW |