Changeset 242365 in webkit
- Timestamp:
- Mar 4, 2019, 10:56:22 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js (modified) (5 diffs)
-
JavaScriptCore/builtins/AsyncGeneratorPrototype.js (modified) (1 diff)
-
JavaScriptCore/builtins/BuiltinNames.h (modified) (2 diffs)
-
JavaScriptCore/builtins/PromiseOperations.js (modified) (1 diff)
-
JavaScriptCore/runtime/JSGlobalObject.cpp (modified) (9 diffs)
-
JavaScriptCore/runtime/JSGlobalObject.h (modified) (4 diffs)
-
JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp (modified) (1 diff)
-
JavaScriptCore/runtime/JSGlobalObjectFunctions.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/Modules/mediastream/RTCPeerConnection.js (modified) (3 diffs)
-
WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (modified) (1 diff)
-
WebCore/Modules/streams/ReadableByteStreamInternals.js (modified) (2 diffs)
-
WebCore/Modules/streams/ReadableStream.js (modified) (2 diffs)
-
WebCore/Modules/streams/ReadableStreamBYOBReader.js (modified) (2 diffs)
-
WebCore/Modules/streams/ReadableStreamDefaultReader.js (modified) (2 diffs)
-
WebCore/Modules/streams/ReadableStreamInternals.js (modified) (1 diff)
-
WebCore/Modules/streams/WritableStream.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r242349 r242365 1 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Offer @makeTypeError instead of exposing @TypeError 4 https://bugs.webkit.org/show_bug.cgi?id=193858 5 6 Reviewed by Mark Lam. 7 8 Instead of exposing @TypeError, we expose @makeTypeError function. 9 And we make TypeError and Error lazily-allocated objects in non JIT environment. 10 In JIT environment, only TypeError becomes lazily-allocated since WebAssembly errors 11 touch Error prototype anyway. But we can make them lazy in a subsequent patch. 12 13 * builtins/AsyncFromSyncIteratorPrototype.js: 14 * builtins/AsyncGeneratorPrototype.js: 15 (globalPrivate.asyncGeneratorEnqueue): 16 * builtins/BuiltinNames.h: 17 * builtins/PromiseOperations.js: 18 (globalPrivate.createResolvingFunctions.resolve): 19 * runtime/JSGlobalObject.cpp: 20 (JSC::JSGlobalObject::initializeErrorConstructor): 21 (JSC::JSGlobalObject::init): 22 (JSC::JSGlobalObject::visitChildren): 23 * runtime/JSGlobalObject.h: 24 (JSC::JSGlobalObject::errorPrototype const): 25 (JSC::JSGlobalObject::errorStructure const): 26 * runtime/JSGlobalObjectFunctions.cpp: 27 (JSC::globalFuncMakeTypeError): 28 * runtime/JSGlobalObjectFunctions.h: 29 1 30 2019-03-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 31 -
trunk/Source/JavaScriptCore/builtins/AsyncFromSyncIteratorPrototype.js
r233740 r242365 31 31 32 32 if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) { 33 promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));33 promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.')); 34 34 return promiseCapability.@promise; 35 35 } … … 58 58 59 59 if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) { 60 promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));60 promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.')); 61 61 return promiseCapability.@promise; 62 62 } … … 82 82 83 83 if (!@isObject(returnResult)) { 84 promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator result interface is not an object.'));84 promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator result interface is not an object.')); 85 85 return promiseCapability.@promise; 86 86 } … … 107 107 108 108 if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) { 109 promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));109 promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.')); 110 110 return promiseCapability.@promise; 111 111 } … … 131 131 132 132 if (!@isObject(throwResult)) { 133 promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator result interface is not an object.'));133 promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator result interface is not an object.')); 134 134 return promiseCapability.@promise; 135 135 } -
trunk/Source/JavaScriptCore/builtins/AsyncGeneratorPrototype.js
r233740 r242365 266 266 const promiseCapability = @newPromiseCapability(@Promise); 267 267 if (!@isObject(generator) || typeof @getByIdDirectPrivate(generator, "asyncGeneratorSuspendReason") !== 'number') { 268 promiseCapability.@reject.@call(@undefined, new @TypeError('|this| should be an async generator'));268 promiseCapability.@reject.@call(@undefined, @makeTypeError('|this| should be an async generator')); 269 269 return promiseCapability.@promise; 270 270 } -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r242047 r242365 75 75 macro(ownKeys) \ 76 76 macro(Set) \ 77 macro(TypeError) \78 77 macro(typedArrayLength) \ 79 78 macro(typedArraySort) \ … … 144 143 macro(replaceUsingRegExp) \ 145 144 macro(replaceUsingStringSearch) \ 145 macro(makeTypeError) \ 146 146 macro(mapBucket) \ 147 147 macro(mapBucketHead) \ -
trunk/Source/JavaScriptCore/builtins/PromiseOperations.js
r233377 r242365 149 149 150 150 if (resolution === promise) 151 return @rejectPromise(promise, new @TypeError("Resolve a promise with itself"));151 return @rejectPromise(promise, @makeTypeError("Resolve a promise with itself")); 152 152 153 153 if (!@isObject(resolution)) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r242064 r242365 336 336 DataView JSGlobalObject::m_typedArrayDataView DontEnum|ClassStructure 337 337 Date JSGlobalObject::m_dateStructure DontEnum|ClassStructure 338 Error JSGlobalObject::m_errorStructure DontEnum|ClassStructure 338 339 Boolean JSGlobalObject::m_booleanObjectStructure DontEnum|ClassStructure 339 340 Number JSGlobalObject::m_numberObjectStructure DontEnum|ClassStructure … … 410 411 void JSGlobalObject::initializeErrorConstructor(LazyClassStructure::Initializer& init) 411 412 { 412 init.setPrototype(NativeErrorPrototype::create(init.vm, NativeErrorPrototype::createStructure(init.vm, this, m_error Prototype.get()), errorTypeName(errorType)));413 init.setPrototype(NativeErrorPrototype::create(init.vm, NativeErrorPrototype::createStructure(init.vm, this, m_errorStructure.prototype(this)), errorTypeName(errorType))); 413 414 init.setStructure(ErrorInstance::createStructure(init.vm, this, init.prototype)); 414 init.setConstructor(NativeErrorConstructor<errorType>::create(init.vm, NativeErrorConstructor<errorType>::createStructure(init.vm, this, m_error Constructor.get()), jsCast<NativeErrorPrototype*>(init.prototype)));415 init.setConstructor(NativeErrorConstructor<errorType>::create(init.vm, NativeErrorConstructor<errorType>::createStructure(init.vm, this, m_errorStructure.constructor(this)), jsCast<NativeErrorPrototype*>(init.prototype))); 415 416 } 416 417 … … 727 728 m_internalPromiseConstructor.set(vm, this, internalPromiseConstructor); 728 729 729 m_errorConstructor.set(vm, this, errorConstructor);730 730 m_evalErrorStructure.initLater( 731 731 [] (LazyClassStructure::Initializer& init) { … … 855 855 JSFunction* privateFuncPropertyIsEnumerable = JSFunction::create(vm, this, 0, String(), globalFuncPropertyIsEnumerable); 856 856 JSFunction* privateFuncImportModule = JSFunction::create(vm, this, 0, String(), globalFuncImportModule); 857 JSFunction* privateFuncMakeTypeError = JSFunction::create(vm, this, 0, String(), globalFuncMakeTypeError); 857 858 JSFunction* privateFuncTypedArrayLength = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncLength); 858 859 JSFunction* privateFuncTypedArrayGetOriginalConstructor = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncGetOriginalConstructor); … … 926 927 GlobalPropertyInfo(vm.propertyNames->builtinNames().importModulePrivateName(), privateFuncImportModule, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 927 928 GlobalPropertyInfo(vm.propertyNames->builtinNames().enqueueJobPrivateName(), JSFunction::create(vm, this, 0, String(), enqueueJob), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 928 // FIXME: Offer @makeTypeError function instead of exposing @TypeError here. 929 // https://bugs.webkit.org/show_bug.cgi?id=193858 930 GlobalPropertyInfo(vm.propertyNames->builtinNames().TypeErrorPrivateName(), m_typeErrorStructure.constructor(this), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 929 GlobalPropertyInfo(vm.propertyNames->builtinNames().makeTypeErrorPrivateName(), privateFuncMakeTypeError, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 931 930 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayLengthPrivateName(), privateFuncTypedArrayLength, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 932 931 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayGetOriginalConstructorPrivateName(), privateFuncTypedArrayGetOriginalConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), … … 1032 1031 typedef capitalName ## Constructor Constructor; \ 1033 1032 typedef JS ## capitalName JSObj; \ 1034 auto* base = m_ ## prototypeBase ## Prototype.get(); \1033 auto* base = prototypeBase ## Prototype(); \ 1035 1034 auto* prototype = Prototype::create(vm, this, Prototype::createStructure(vm, this, base)); \ 1036 1035 auto* structure = JSObj::createStructure(vm, this, prototype); \ … … 1588 1587 visitor.append(thisObject->m_globalCallee); 1589 1588 visitor.append(thisObject->m_stackOverflowFrameCallee); 1590 visitor.append(thisObject->m_errorConstructor);1591 1589 thisObject->m_evalErrorStructure.visit(visitor); 1592 1590 thisObject->m_rangeErrorStructure.visit(visitor); … … 1631 1629 visitor.append(thisObject->m_functionPrototype); 1632 1630 visitor.append(thisObject->m_arrayPrototype); 1633 visitor.append(thisObject->m_errorPrototype);1634 1631 visitor.append(thisObject->m_iteratorPrototype); 1635 1632 visitor.append(thisObject->m_generatorFunctionPrototype); … … 1665 1662 #endif 1666 1663 visitor.append(thisObject->m_nullPrototypeObjectStructure); 1667 visitor.append(thisObject->m_errorStructure);1668 1664 visitor.append(thisObject->m_calleeStructure); 1669 1665 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r242123 r242365 129 129 #define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \ 130 130 macro(String, string, stringObject, StringObject, String, object) \ 131 macro(Error, error, error, ErrorInstance, Error, object) \132 131 macro(Map, map, map, JSMap, Map, object) \ 133 132 macro(Set, set, set, JSSet, Set, object) \ … … 147 146 macro(Boolean, boolean, booleanObject, BooleanObject, Boolean, object) \ 148 147 macro(Date, date, date, DateInstance, Date, object) \ 148 macro(Error, error, error, ErrorInstance, Error, object) \ 149 149 macro(Number, number, numberObject, NumberObject, Number, object) \ 150 150 macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object) \ … … 632 632 JSObject* symbolPrototype() const { return m_symbolObjectStructure.prototypeInitializedOnMainThread(this); } 633 633 RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); } 634 ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); }634 JSObject* errorPrototype() const { return m_errorStructure.prototype(this); } 635 635 IteratorPrototype* iteratorPrototype() const { return m_iteratorPrototype.get(); } 636 636 AsyncIteratorPrototype* asyncIteratorPrototype() const { return m_asyncIteratorPrototype.get(); } … … 693 693 Structure* symbolObjectStructure() const { return m_symbolObjectStructure.get(this); } 694 694 Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); } 695 Structure* errorStructure() const { return m_errorStructure.get( ); }695 Structure* errorStructure() const { return m_errorStructure.get(this); } 696 696 Structure* errorStructure(ErrorType errorType) const 697 697 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r242064 r242365 699 699 } 700 700 701 EncodedJSValue JSC_HOST_CALL globalFuncMakeTypeError(ExecState* exec) 702 { 703 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); 704 Structure* errorStructure = globalObject->errorStructure(ErrorType::TypeError); 705 return JSValue::encode(ErrorInstance::create(exec, errorStructure, exec->argument(0), nullptr, TypeNothing, false)); 706 } 707 701 708 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec) 702 709 { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
r242047 r242365 49 49 EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*); 50 50 EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsCalleeAndCaller(ExecState*); 51 EncodedJSValue JSC_HOST_CALL globalFuncMakeTypeError(ExecState*); 51 52 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*); 52 53 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*); -
trunk/Source/WebCore/ChangeLog
r242359 r242365 1 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Offer @makeTypeError instead of exposing @TypeError 4 https://bugs.webkit.org/show_bug.cgi?id=193858 5 6 Reviewed by Mark Lam. 7 8 Use @makeTypeError instead. 9 10 * Modules/mediastream/RTCPeerConnection.js: 11 * Modules/mediastream/RTCPeerConnectionInternals.js: 12 * Modules/streams/ReadableByteStreamInternals.js: 13 (readableByteStreamControllerClose): 14 (readableByteStreamControllerPullInto): 15 * Modules/streams/ReadableStream.js: 16 (cancel): 17 (pipeTo): 18 * Modules/streams/ReadableStreamBYOBReader.js: 19 (cancel): 20 (read): 21 * Modules/streams/ReadableStreamDefaultReader.js: 22 (cancel): 23 (read): 24 * Modules/streams/ReadableStreamInternals.js: 25 (readableStreamReaderGenericRelease): 26 * Modules/streams/WritableStream.js: 27 (abort): 28 (close): 29 (write): 30 (getter.closed): 31 (getter.ready): 32 1 33 2019-03-04 Simon Fraser <simon.fraser@apple.com> 2 34 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js
r238230 r242365 80 80 81 81 if (arguments.length < 1) 82 return @Promise.@reject( new @TypeError("Not enough arguments"));82 return @Promise.@reject(@makeTypeError("Not enough arguments")); 83 83 84 84 // FIXME 169644: According the spec, we should throw when receiving a RTCSessionDescription. … … 104 104 105 105 if (arguments.length < 1) 106 return @Promise.@reject( new @TypeError("Not enough arguments"));106 return @Promise.@reject(@makeTypeError("Not enough arguments")); 107 107 108 108 // FIXME: According the spec, we should only expect RTCSessionDescriptionInit. … … 128 128 129 129 if (arguments.length < 1) 130 return @Promise.@reject( new @TypeError("Not enough arguments"));130 return @Promise.@reject(@makeTypeError("Not enough arguments")); 131 131 132 132 const objectInfo = { -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js
r238230 r242365 77 77 78 78 if (!objectArgOk) 79 return @Promise.@reject( new @TypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`));79 return @Promise.@reject(@makeTypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`)); 80 80 81 81 return promiseMode(objectArg); -
trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js
r241637 r242365 150 150 if (pendingPullIntos.length > 0) { 151 151 if (pendingPullIntos[0].bytesFilled > 0) { 152 const e = new @TypeError("Close requested while there remain pending bytes");152 const e = @makeTypeError("Close requested while there remain pending bytes"); 153 153 @readableByteStreamControllerError(controller, e); 154 154 throw e; … … 649 649 } 650 650 if (@getByIdDirectPrivate(controller, "closeRequested")) { 651 const e = new @TypeError("Closing stream has been requested");651 const e = @makeTypeError("Closing stream has been requested"); 652 652 @readableByteStreamControllerError(controller, e); 653 653 return @Promise.@reject(e); -
trunk/Source/WebCore/Modules/streams/ReadableStream.js
r239472 r242365 81 81 82 82 if (@isReadableStreamLocked(this)) 83 return @Promise.@reject( new @TypeError("ReadableStream is locked"));83 return @Promise.@reject(@makeTypeError("ReadableStream is locked")); 84 84 85 85 return @readableStreamCancel(this, reason); … … 199 199 function() { 200 200 if (!closedPurposefully) 201 cancelSource( new @TypeError('destination is closing or closed and cannot be piped to anymore'));201 cancelSource(@makeTypeError('destination is closing or closed and cannot be piped to anymore')); 202 202 }, 203 203 cancelSource -
trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js
r239472 r242365 50 50 51 51 if (!@getByIdDirectPrivate(this, "ownerReadableStream")) 52 return @Promise.@reject( new @TypeError("cancel() called on a reader owned by no readable stream"));52 return @Promise.@reject(@makeTypeError("cancel() called on a reader owned by no readable stream")); 53 53 54 54 return @readableStreamReaderGenericCancel(this, reason); … … 63 63 64 64 if (!@getByIdDirectPrivate(this, "ownerReadableStream")) 65 return @Promise.@reject( new @TypeError("read() called on a reader owned by no readable stream"));65 return @Promise.@reject(@makeTypeError("read() called on a reader owned by no readable stream")); 66 66 67 67 if (!@isObject(view)) 68 return @Promise.@reject( new @TypeError("Provided view is not an object"));68 return @Promise.@reject(@makeTypeError("Provided view is not an object")); 69 69 70 70 if (!@ArrayBuffer.@isView(view)) 71 return @Promise.@reject( new @TypeError("Provided view is not an ArrayBufferView"));71 return @Promise.@reject(@makeTypeError("Provided view is not an ArrayBufferView")); 72 72 73 73 if (view.byteLength === 0) 74 return @Promise.@reject( new @TypeError("Provided view cannot have a 0 byteLength"));74 return @Promise.@reject(@makeTypeError("Provided view cannot have a 0 byteLength")); 75 75 76 76 return @readableStreamBYOBReaderRead(this, view); -
trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js
r239472 r242365 49 49 50 50 if (!@getByIdDirectPrivate(this, "ownerReadableStream")) 51 return @Promise.@reject( new @TypeError("cancel() called on a reader owned by no readable stream"));51 return @Promise.@reject(@makeTypeError("cancel() called on a reader owned by no readable stream")); 52 52 53 53 return @readableStreamReaderGenericCancel(this, reason); … … 61 61 return @Promise.@reject(@makeThisTypeError("ReadableStreamDefaultReader", "read")); 62 62 if (!@getByIdDirectPrivate(this, "ownerReadableStream")) 63 return @Promise.@reject( new @TypeError("read() called on a reader owned by no readable stream"));63 return @Promise.@reject(@makeTypeError("read() called on a reader owned by no readable stream")); 64 64 65 65 return @readableStreamDefaultReaderRead(this); -
trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js
r239472 r242365 515 515 516 516 if (@getByIdDirectPrivate(@getByIdDirectPrivate(reader, "ownerReadableStream"), "state") === @streamReadable) 517 @getByIdDirectPrivate(reader, "closedPromiseCapability").@reject.@call(@undefined, new @TypeError("releasing lock of reader whose stream is still in readable state"));517 @getByIdDirectPrivate(reader, "closedPromiseCapability").@reject.@call(@undefined, @makeTypeError("releasing lock of reader whose stream is still in readable state")); 518 518 else 519 @putByIdDirectPrivate(reader, "closedPromiseCapability", { @promise: @newHandledRejectedPromise( new @TypeError("reader released lock")) });519 @putByIdDirectPrivate(reader, "closedPromiseCapability", { @promise: @newHandledRejectedPromise(@makeTypeError("reader released lock")) }); 520 520 521 521 @putByIdDirectPrivate(@getByIdDirectPrivate(reader, "closedPromiseCapability").@promise, "promiseIsHandled", true); -
trunk/Source/WebCore/Modules/streams/WritableStream.js
r230637 r242365 71 71 72 72 if (!@isWritableStream(this)) 73 return @Promise.@reject( new @TypeError("The WritableStream.abort method can only be used on instances of WritableStream"));73 return @Promise.@reject(@makeTypeError("The WritableStream.abort method can only be used on instances of WritableStream")); 74 74 75 75 const state = @getByIdDirectPrivate(this, "state"); … … 90 90 91 91 if (!@isWritableStream(this)) 92 return @Promise.@reject( new @TypeError("The WritableStream.close method can only be used on instances of WritableStream"));92 return @Promise.@reject(@makeTypeError("The WritableStream.close method can only be used on instances of WritableStream")); 93 93 94 94 const state = @getByIdDirectPrivate(this, "state"); 95 95 if (state === @streamClosed || state === @streamClosing) 96 return @Promise.@reject( new @TypeError("Cannot close a WritableString that is closed or closing"));96 return @Promise.@reject(@makeTypeError("Cannot close a WritableString that is closed or closing")); 97 97 98 98 if (state === @streamErrored) … … 114 114 115 115 if (!@isWritableStream(this)) 116 return @Promise.@reject( new @TypeError("The WritableStream.write method can only be used on instances of WritableStream"));116 return @Promise.@reject(@makeTypeError("The WritableStream.write method can only be used on instances of WritableStream")); 117 117 118 118 const state = @getByIdDirectPrivate(this, "state"); 119 119 if (state === @streamClosed || state === @streamClosing) 120 return @Promise.@reject( new @TypeError("Cannot write on a WritableString that is closed or closing"));120 return @Promise.@reject(@makeTypeError("Cannot write on a WritableString that is closed or closing")); 121 121 122 122 if (state === @streamErrored) … … 155 155 156 156 if (!@isWritableStream(this)) 157 return @Promise.@reject( new @TypeError("The WritableStream.closed getter can only be used on instances of WritableStream"));157 return @Promise.@reject(@makeTypeError("The WritableStream.closed getter can only be used on instances of WritableStream")); 158 158 159 159 return @getByIdDirectPrivate(this, "closedPromiseCapability").@promise; … … 166 166 167 167 if (!@isWritableStream(this)) 168 return @Promise.@reject( new @TypeError("The WritableStream.ready getter can only be used on instances of WritableStream"));168 return @Promise.@reject(@makeTypeError("The WritableStream.ready getter can only be used on instances of WritableStream")); 169 169 170 170 return @getByIdDirectPrivate(this, "readyPromiseCapability").@promise;
Note:
See TracChangeset
for help on using the changeset viewer.