OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 (function(global, binding, v8) { |
| 6 'use strict'; |
| 7 |
| 8 // This file exists to help in the transition between IDL-implemented Readable
Stream and V8 extras-implemented |
| 9 // ReadableStream. Before it was introduced, there was an IDL-implemented prop
erty of the global object named |
| 10 // "ReadableStream" that had no useful behavior, but might have been depended
on by web code for some reason. |
| 11 |
| 12 // This file thus emulates that old IDL-implemented property, _when experiment
al web platform features are disabled_. |
| 13 // When experimental web platform features are _enabled_, the definition of gl
obal.ReadableStream in |
| 14 // ReadableStream.js takes priority. |
| 15 |
| 16 // Eventually, when the ReadableStream.js implementation is ready to be enable
d by default, we can remove this file. |
| 17 |
| 18 const TypeError = global.TypeError; |
| 19 const defineProperty = global.Object.defineProperty; |
| 20 |
| 21 class ReadableStream { |
| 22 constructor() { |
| 23 throw new TypeError('Illegal constructor'); |
| 24 } |
| 25 |
| 26 getReader() { |
| 27 throw new TypeError('Illegal invocation'); |
| 28 } |
| 29 |
| 30 cancel() { |
| 31 throw new TypeError('Illegal invocation'); |
| 32 } |
| 33 } |
| 34 |
| 35 defineProperty(global, 'ReadableStream', { |
| 36 value: ReadableStream, |
| 37 enumerable: false, |
| 38 configurable: true, |
| 39 writable: true |
| 40 }); |
| 41 }); |
OLD | NEW |