Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (242364 => 242365)
--- trunk/Source/_javascript_Core/ChangeLog 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-03-04 18:56:22 UTC (rev 242365)
@@ -1,3 +1,32 @@
+2019-03-04 Yusuke Suzuki <[email protected]>
+
+ [JSC] Offer @makeTypeError instead of exposing @TypeError
+ https://bugs.webkit.org/show_bug.cgi?id=193858
+
+ Reviewed by Mark Lam.
+
+ Instead of exposing @TypeError, we expose @makeTypeError function.
+ And we make TypeError and Error lazily-allocated objects in non JIT environment.
+ In JIT environment, only TypeError becomes lazily-allocated since WebAssembly errors
+ touch Error prototype anyway. But we can make them lazy in a subsequent patch.
+
+ * builtins/AsyncFromSyncIteratorPrototype.js:
+ * builtins/AsyncGeneratorPrototype.js:
+ (globalPrivate.asyncGeneratorEnqueue):
+ * builtins/BuiltinNames.h:
+ * builtins/PromiseOperations.js:
+ (globalPrivate.createResolvingFunctions.resolve):
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::initializeErrorConstructor):
+ (JSC::JSGlobalObject::init):
+ (JSC::JSGlobalObject::visitChildren):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::errorPrototype const):
+ (JSC::JSGlobalObject::errorStructure const):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::globalFuncMakeTypeError):
+ * runtime/JSGlobalObjectFunctions.h:
+
2019-03-04 Carlos Garcia Campos <[email protected]>
[GLib] Returning G_TYPE_OBJECT from a constructor does not work
Modified: trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js (242364 => 242365)
--- trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/builtins/AsyncFromSyncIteratorPrototype.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -30,7 +30,7 @@
const promiseCapability = @newPromiseCapability(@Promise);
if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) {
- promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.'));
return promiseCapability.@promise;
}
@@ -57,7 +57,7 @@
const promiseCapability = @newPromiseCapability(@Promise);
if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) {
- promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.'));
return promiseCapability.@promise;
}
@@ -81,7 +81,7 @@
const returnResult = returnMethod.@call(syncIterator, value);
if (!@isObject(returnResult)) {
- promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator result interface is not an object.'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator result interface is not an object.'));
return promiseCapability.@promise;
}
@@ -106,7 +106,7 @@
const promiseCapability = @newPromiseCapability(@Promise);
if (!@isObject(this) || !@isObject(@getByIdDirectPrivate(this, "syncIterator"))) {
- promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator is not an object.'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator is not an object.'));
return promiseCapability.@promise;
}
@@ -130,7 +130,7 @@
const throwResult = throwMethod.@call(syncIterator, exception);
if (!@isObject(throwResult)) {
- promiseCapability.@reject.@call(@undefined, new @TypeError('Iterator result interface is not an object.'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('Iterator result interface is not an object.'));
return promiseCapability.@promise;
}
Modified: trunk/Source/_javascript_Core/builtins/AsyncGeneratorPrototype.js (242364 => 242365)
--- trunk/Source/_javascript_Core/builtins/AsyncGeneratorPrototype.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/builtins/AsyncGeneratorPrototype.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -265,7 +265,7 @@
const promiseCapability = @newPromiseCapability(@Promise);
if (!@isObject(generator) || typeof @getByIdDirectPrivate(generator, "asyncGeneratorSuspendReason") !== 'number') {
- promiseCapability.@reject.@call(@undefined, new @TypeError('|this| should be an async generator'));
+ promiseCapability.@reject.@call(@undefined, @makeTypeError('|this| should be an async generator'));
return promiseCapability.@promise;
}
Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (242364 => 242365)
--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h 2019-03-04 18:56:22 UTC (rev 242365)
@@ -74,7 +74,6 @@
macro(getOwnPropertyNames) \
macro(ownKeys) \
macro(Set) \
- macro(TypeError) \
macro(typedArrayLength) \
macro(typedArraySort) \
macro(typedArrayGetOriginalConstructor) \
@@ -143,6 +142,7 @@
macro(regExpCreate) \
macro(replaceUsingRegExp) \
macro(replaceUsingStringSearch) \
+ macro(makeTypeError) \
macro(mapBucket) \
macro(mapBucketHead) \
macro(mapBucketNext) \
Modified: trunk/Source/_javascript_Core/builtins/PromiseOperations.js (242364 => 242365)
--- trunk/Source/_javascript_Core/builtins/PromiseOperations.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/builtins/PromiseOperations.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -148,7 +148,7 @@
alreadyResolved = true;
if (resolution === promise)
- return @rejectPromise(promise, new @TypeError("Resolve a promise with itself"));
+ return @rejectPromise(promise, @makeTypeError("Resolve a promise with itself"));
if (!@isObject(resolution))
return @fulfillPromise(promise, resolution);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (242364 => 242365)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2019-03-04 18:56:22 UTC (rev 242365)
@@ -335,6 +335,7 @@
Float64Array JSGlobalObject::m_typedArrayFloat64 DontEnum|ClassStructure
DataView JSGlobalObject::m_typedArrayDataView DontEnum|ClassStructure
Date JSGlobalObject::m_dateStructure DontEnum|ClassStructure
+ Error JSGlobalObject::m_errorStructure DontEnum|ClassStructure
Boolean JSGlobalObject::m_booleanObjectStructure DontEnum|ClassStructure
Number JSGlobalObject::m_numberObjectStructure DontEnum|ClassStructure
Symbol JSGlobalObject::m_symbolObjectStructure DontEnum|ClassStructure
@@ -409,9 +410,9 @@
template<ErrorType errorType>
void JSGlobalObject::initializeErrorConstructor(LazyClassStructure::Initializer& init)
{
- init.setPrototype(NativeErrorPrototype::create(init.vm, NativeErrorPrototype::createStructure(init.vm, this, m_errorPrototype.get()), errorTypeName(errorType)));
+ init.setPrototype(NativeErrorPrototype::create(init.vm, NativeErrorPrototype::createStructure(init.vm, this, m_errorStructure.prototype(this)), errorTypeName(errorType)));
init.setStructure(ErrorInstance::createStructure(init.vm, this, init.prototype));
- init.setConstructor(NativeErrorConstructor<errorType>::create(init.vm, NativeErrorConstructor<errorType>::createStructure(init.vm, this, m_errorConstructor.get()), jsCast<NativeErrorPrototype*>(init.prototype)));
+ init.setConstructor(NativeErrorConstructor<errorType>::create(init.vm, NativeErrorConstructor<errorType>::createStructure(init.vm, this, m_errorStructure.constructor(this)), jsCast<NativeErrorPrototype*>(init.prototype)));
}
void JSGlobalObject::init(VM& vm)
@@ -726,7 +727,6 @@
m_promiseConstructor.set(vm, this, promiseConstructor);
m_internalPromiseConstructor.set(vm, this, internalPromiseConstructor);
- m_errorConstructor.set(vm, this, errorConstructor);
m_evalErrorStructure.initLater(
[] (LazyClassStructure::Initializer& init) {
init.global->initializeErrorConstructor<ErrorType::EvalError>(init);
@@ -854,6 +854,7 @@
JSFunction* privateFuncPropertyIsEnumerable = JSFunction::create(vm, this, 0, String(), globalFuncPropertyIsEnumerable);
JSFunction* privateFuncImportModule = JSFunction::create(vm, this, 0, String(), globalFuncImportModule);
+ JSFunction* privateFuncMakeTypeError = JSFunction::create(vm, this, 0, String(), globalFuncMakeTypeError);
JSFunction* privateFuncTypedArrayLength = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncLength);
JSFunction* privateFuncTypedArrayGetOriginalConstructor = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncGetOriginalConstructor);
JSFunction* privateFuncTypedArraySort = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncSort);
@@ -925,9 +926,7 @@
GlobalPropertyInfo(vm.propertyNames->builtinNames().propertyIsEnumerablePrivateName(), privateFuncPropertyIsEnumerable, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().importModulePrivateName(), privateFuncImportModule, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().enqueueJobPrivateName(), JSFunction::create(vm, this, 0, String(), enqueueJob), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
- // FIXME: Offer @makeTypeError function instead of exposing @TypeError here.
- // https://bugs.webkit.org/show_bug.cgi?id=193858
- GlobalPropertyInfo(vm.propertyNames->builtinNames().TypeErrorPrivateName(), m_typeErrorStructure.constructor(this), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
+ GlobalPropertyInfo(vm.propertyNames->builtinNames().makeTypeErrorPrivateName(), privateFuncMakeTypeError, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayLengthPrivateName(), privateFuncTypedArrayLength, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayGetOriginalConstructorPrivateName(), privateFuncTypedArrayGetOriginalConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArraySortPrivateName(), privateFuncTypedArraySort, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),
@@ -1031,7 +1030,7 @@
typedef capitalName ## Prototype Prototype; \
typedef capitalName ## Constructor Constructor; \
typedef JS ## capitalName JSObj; \
- auto* base = m_ ## prototypeBase ## Prototype.get(); \
+ auto* base = prototypeBase ## Prototype(); \
auto* prototype = Prototype::create(vm, this, Prototype::createStructure(vm, this, base)); \
auto* structure = JSObj::createStructure(vm, this, prototype); \
auto* constructor = Constructor::create(vm, Constructor::createStructure(vm, this, this->functionPrototype()), prototype); \
@@ -1587,7 +1586,6 @@
visitor.append(thisObject->m_globalScopeExtension);
visitor.append(thisObject->m_globalCallee);
visitor.append(thisObject->m_stackOverflowFrameCallee);
- visitor.append(thisObject->m_errorConstructor);
thisObject->m_evalErrorStructure.visit(visitor);
thisObject->m_rangeErrorStructure.visit(visitor);
thisObject->m_referenceErrorStructure.visit(visitor);
@@ -1630,7 +1628,6 @@
visitor.append(thisObject->m_objectPrototype);
visitor.append(thisObject->m_functionPrototype);
visitor.append(thisObject->m_arrayPrototype);
- visitor.append(thisObject->m_errorPrototype);
visitor.append(thisObject->m_iteratorPrototype);
visitor.append(thisObject->m_generatorFunctionPrototype);
visitor.append(thisObject->m_generatorPrototype);
@@ -1664,7 +1661,6 @@
thisObject->m_glibWrapperObjectStructure.visit(visitor);
#endif
visitor.append(thisObject->m_nullPrototypeObjectStructure);
- visitor.append(thisObject->m_errorStructure);
visitor.append(thisObject->m_calleeStructure);
visitor.append(thisObject->m_hostFunctionStructure);
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (242364 => 242365)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2019-03-04 18:56:22 UTC (rev 242365)
@@ -128,7 +128,6 @@
#define FOR_EACH_SIMPLE_BUILTIN_TYPE_WITH_CONSTRUCTOR(macro) \
macro(String, string, stringObject, StringObject, String, object) \
- macro(Error, error, error, ErrorInstance, Error, object) \
macro(Map, map, map, JSMap, Map, object) \
macro(Set, set, set, JSSet, Set, object) \
macro(JSPromise, promise, promise, JSPromise, Promise, object)
@@ -146,6 +145,7 @@
#define FOR_EACH_LAZY_BUILTIN_TYPE(macro) \
macro(Boolean, boolean, booleanObject, BooleanObject, Boolean, object) \
macro(Date, date, date, DateInstance, Date, object) \
+ macro(Error, error, error, ErrorInstance, Error, object) \
macro(Number, number, numberObject, NumberObject, Number, object) \
macro(Symbol, symbol, symbolObject, SymbolObject, Symbol, object) \
DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \
@@ -631,7 +631,7 @@
JSObject* datePrototype() const { return m_dateStructure.prototype(this); }
JSObject* symbolPrototype() const { return m_symbolObjectStructure.prototypeInitializedOnMainThread(this); }
RegExpPrototype* regExpPrototype() const { return m_regExpPrototype.get(); }
- ErrorPrototype* errorPrototype() const { return m_errorPrototype.get(); }
+ JSObject* errorPrototype() const { return m_errorStructure.prototype(this); }
IteratorPrototype* iteratorPrototype() const { return m_iteratorPrototype.get(); }
AsyncIteratorPrototype* asyncIteratorPrototype() const { return m_asyncIteratorPrototype.get(); }
GeneratorFunctionPrototype* generatorFunctionPrototype() const { return m_generatorFunctionPrototype.get(); }
@@ -692,7 +692,7 @@
Structure* dateStructure() const { return m_dateStructure.get(this); }
Structure* symbolObjectStructure() const { return m_symbolObjectStructure.get(this); }
Structure* nullPrototypeObjectStructure() const { return m_nullPrototypeObjectStructure.get(); }
- Structure* errorStructure() const { return m_errorStructure.get(); }
+ Structure* errorStructure() const { return m_errorStructure.get(this); }
Structure* errorStructure(ErrorType errorType) const
{
switch (errorType) {
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (242364 => 242365)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp 2019-03-04 18:56:22 UTC (rev 242365)
@@ -698,6 +698,13 @@
return throwVMTypeError(exec, scope, "'arguments', 'callee', and 'caller' cannot be accessed in this context.");
}
+EncodedJSValue JSC_HOST_CALL globalFuncMakeTypeError(ExecState* exec)
+{
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ Structure* errorStructure = globalObject->errorStructure(ErrorType::TypeError);
+ return JSValue::encode(ErrorInstance::create(exec, errorStructure, exec->argument(0), nullptr, TypeNothing, false));
+}
+
EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec)
{
VM& vm = exec->vm();
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h (242364 => 242365)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h 2019-03-04 18:56:22 UTC (rev 242365)
@@ -48,6 +48,7 @@
EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsCalleeAndCaller(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncMakeTypeError(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
EncodedJSValue JSC_HOST_CALL globalFuncHostPromiseRejectionTracker(ExecState*);
Modified: trunk/Source/WebCore/ChangeLog (242364 => 242365)
--- trunk/Source/WebCore/ChangeLog 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/ChangeLog 2019-03-04 18:56:22 UTC (rev 242365)
@@ -1,3 +1,35 @@
+2019-03-04 Yusuke Suzuki <[email protected]>
+
+ [JSC] Offer @makeTypeError instead of exposing @TypeError
+ https://bugs.webkit.org/show_bug.cgi?id=193858
+
+ Reviewed by Mark Lam.
+
+ Use @makeTypeError instead.
+
+ * Modules/mediastream/RTCPeerConnection.js:
+ * Modules/mediastream/RTCPeerConnectionInternals.js:
+ * Modules/streams/ReadableByteStreamInternals.js:
+ (readableByteStreamControllerClose):
+ (readableByteStreamControllerPullInto):
+ * Modules/streams/ReadableStream.js:
+ (cancel):
+ (pipeTo):
+ * Modules/streams/ReadableStreamBYOBReader.js:
+ (cancel):
+ (read):
+ * Modules/streams/ReadableStreamDefaultReader.js:
+ (cancel):
+ (read):
+ * Modules/streams/ReadableStreamInternals.js:
+ (readableStreamReaderGenericRelease):
+ * Modules/streams/WritableStream.js:
+ (abort):
+ (close):
+ (write):
+ (getter.closed):
+ (getter.ready):
+
2019-03-04 Simon Fraser <[email protected]>
Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -79,7 +79,7 @@
return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setLocalDescription"));
if (arguments.length < 1)
- return @Promise.@reject(new @TypeError("Not enough arguments"));
+ return @Promise.@reject(@makeTypeError("Not enough arguments"));
// FIXME 169644: According the spec, we should throw when receiving a RTCSessionDescription.
const objectInfo = {
@@ -103,7 +103,7 @@
return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "setRemoteDescription"));
if (arguments.length < 1)
- return @Promise.@reject(new @TypeError("Not enough arguments"));
+ return @Promise.@reject(@makeTypeError("Not enough arguments"));
// FIXME: According the spec, we should only expect RTCSessionDescriptionInit.
const objectInfo = {
@@ -127,7 +127,7 @@
return @Promise.@reject(@makeThisTypeError("RTCPeerConnection", "addIceCandidate"));
if (arguments.length < 1)
- return @Promise.@reject(new @TypeError("Not enough arguments"));
+ return @Promise.@reject(@makeTypeError("Not enough arguments"));
const objectInfo = {
"constructor": @RTCIceCandidate,
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionInternals.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -76,7 +76,7 @@
}
if (!objectArgOk)
- return @Promise.@reject(new @TypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`));
+ return @Promise.@reject(@makeTypeError(`Argument 1 ('${objectInfo.argName}') to RTCPeerConnection.${functionName} must be an instance of ${objectInfo.argType}`));
return promiseMode(objectArg);
}
Modified: trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/ReadableByteStreamInternals.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -149,7 +149,7 @@
var pendingPullIntos = @getByIdDirectPrivate(controller, "pendingPullIntos");
if (pendingPullIntos.length > 0) {
if (pendingPullIntos[0].bytesFilled > 0) {
- const e = new @TypeError("Close requested while there remain pending bytes");
+ const e = @makeTypeError("Close requested while there remain pending bytes");
@readableByteStreamControllerError(controller, e);
throw e;
}
@@ -648,7 +648,7 @@
return @Promise.@resolve({ value: filledView, done: false });
}
if (@getByIdDirectPrivate(controller, "closeRequested")) {
- const e = new @TypeError("Closing stream has been requested");
+ const e = @makeTypeError("Closing stream has been requested");
@readableByteStreamControllerError(controller, e);
return @Promise.@reject(e);
}
Modified: trunk/Source/WebCore/Modules/streams/ReadableStream.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/ReadableStream.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/ReadableStream.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -80,7 +80,7 @@
return @Promise.@reject(@makeThisTypeError("ReadableStream", "cancel"));
if (@isReadableStreamLocked(this))
- return @Promise.@reject(new @TypeError("ReadableStream is locked"));
+ return @Promise.@reject(@makeTypeError("ReadableStream is locked"));
return @readableStreamCancel(this, reason);
}
@@ -198,7 +198,7 @@
@Promise.prototype.@then.@call(destination.closed,
function() {
if (!closedPurposefully)
- cancelSource(new @TypeError('destination is closing or closed and cannot be piped to anymore'));
+ cancelSource(@makeTypeError('destination is closing or closed and cannot be piped to anymore'));
},
cancelSource
);
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamBYOBReader.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -49,7 +49,7 @@
return @Promise.@reject(@makeThisTypeError("ReadableStreamBYOBReader", "cancel"));
if (!@getByIdDirectPrivate(this, "ownerReadableStream"))
- return @Promise.@reject(new @TypeError("cancel() called on a reader owned by no readable stream"));
+ return @Promise.@reject(@makeTypeError("cancel() called on a reader owned by no readable stream"));
return @readableStreamReaderGenericCancel(this, reason);
}
@@ -62,16 +62,16 @@
return @Promise.@reject(@makeThisTypeError("ReadableStreamBYOBReader", "read"));
if (!@getByIdDirectPrivate(this, "ownerReadableStream"))
- return @Promise.@reject(new @TypeError("read() called on a reader owned by no readable stream"));
+ return @Promise.@reject(@makeTypeError("read() called on a reader owned by no readable stream"));
if (!@isObject(view))
- return @Promise.@reject(new @TypeError("Provided view is not an object"));
+ return @Promise.@reject(@makeTypeError("Provided view is not an object"));
if (!@ArrayBuffer.@isView(view))
- return @Promise.@reject(new @TypeError("Provided view is not an ArrayBufferView"));
+ return @Promise.@reject(@makeTypeError("Provided view is not an ArrayBufferView"));
if (view.byteLength === 0)
- return @Promise.@reject(new @TypeError("Provided view cannot have a 0 byteLength"));
+ return @Promise.@reject(@makeTypeError("Provided view cannot have a 0 byteLength"));
return @readableStreamBYOBReaderRead(this, view);
}
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamDefaultReader.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -48,7 +48,7 @@
return @Promise.@reject(@makeThisTypeError("ReadableStreamDefaultReader", "cancel"));
if (!@getByIdDirectPrivate(this, "ownerReadableStream"))
- return @Promise.@reject(new @TypeError("cancel() called on a reader owned by no readable stream"));
+ return @Promise.@reject(@makeTypeError("cancel() called on a reader owned by no readable stream"));
return @readableStreamReaderGenericCancel(this, reason);
}
@@ -60,7 +60,7 @@
if (!@isReadableStreamDefaultReader(this))
return @Promise.@reject(@makeThisTypeError("ReadableStreamDefaultReader", "read"));
if (!@getByIdDirectPrivate(this, "ownerReadableStream"))
- return @Promise.@reject(new @TypeError("read() called on a reader owned by no readable stream"));
+ return @Promise.@reject(@makeTypeError("read() called on a reader owned by no readable stream"));
return @readableStreamDefaultReaderRead(this);
}
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamInternals.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -514,9 +514,9 @@
@assert(@getByIdDirectPrivate(@getByIdDirectPrivate(reader, "ownerReadableStream"), "reader") === reader);
if (@getByIdDirectPrivate(@getByIdDirectPrivate(reader, "ownerReadableStream"), "state") === @streamReadable)
- @getByIdDirectPrivate(reader, "closedPromiseCapability").@reject.@call(@undefined, new @TypeError("releasing lock of reader whose stream is still in readable state"));
+ @getByIdDirectPrivate(reader, "closedPromiseCapability").@reject.@call(@undefined, @makeTypeError("releasing lock of reader whose stream is still in readable state"));
else
- @putByIdDirectPrivate(reader, "closedPromiseCapability", { @promise: @newHandledRejectedPromise(new @TypeError("reader released lock")) });
+ @putByIdDirectPrivate(reader, "closedPromiseCapability", { @promise: @newHandledRejectedPromise(@makeTypeError("reader released lock")) });
@putByIdDirectPrivate(@getByIdDirectPrivate(reader, "closedPromiseCapability").@promise, "promiseIsHandled", true);
@putByIdDirectPrivate(@getByIdDirectPrivate(reader, "ownerReadableStream"), "reader", @undefined);
Modified: trunk/Source/WebCore/Modules/streams/WritableStream.js (242364 => 242365)
--- trunk/Source/WebCore/Modules/streams/WritableStream.js 2019-03-04 18:06:18 UTC (rev 242364)
+++ trunk/Source/WebCore/Modules/streams/WritableStream.js 2019-03-04 18:56:22 UTC (rev 242365)
@@ -70,7 +70,7 @@
"use strict";
if (!@isWritableStream(this))
- return @Promise.@reject(new @TypeError("The WritableStream.abort method can only be used on instances of WritableStream"));
+ return @Promise.@reject(@makeTypeError("The WritableStream.abort method can only be used on instances of WritableStream"));
const state = @getByIdDirectPrivate(this, "state");
if (state === @streamClosed)
@@ -89,11 +89,11 @@
"use strict";
if (!@isWritableStream(this))
- return @Promise.@reject(new @TypeError("The WritableStream.close method can only be used on instances of WritableStream"));
+ return @Promise.@reject(@makeTypeError("The WritableStream.close method can only be used on instances of WritableStream"));
const state = @getByIdDirectPrivate(this, "state");
if (state === @streamClosed || state === @streamClosing)
- return @Promise.@reject(new @TypeError("Cannot close a WritableString that is closed or closing"));
+ return @Promise.@reject(@makeTypeError("Cannot close a WritableString that is closed or closing"));
if (state === @streamErrored)
return @Promise.@reject(@getByIdDirectPrivate(this, "storedError"));
@@ -113,11 +113,11 @@
"use strict";
if (!@isWritableStream(this))
- return @Promise.@reject(new @TypeError("The WritableStream.write method can only be used on instances of WritableStream"));
+ return @Promise.@reject(@makeTypeError("The WritableStream.write method can only be used on instances of WritableStream"));
const state = @getByIdDirectPrivate(this, "state");
if (state === @streamClosed || state === @streamClosing)
- return @Promise.@reject(new @TypeError("Cannot write on a WritableString that is closed or closing"));
+ return @Promise.@reject(@makeTypeError("Cannot write on a WritableString that is closed or closing"));
if (state === @streamErrored)
return @Promise.@reject(this.@storedError);
@@ -154,7 +154,7 @@
"use strict";
if (!@isWritableStream(this))
- return @Promise.@reject(new @TypeError("The WritableStream.closed getter can only be used on instances of WritableStream"));
+ return @Promise.@reject(@makeTypeError("The WritableStream.closed getter can only be used on instances of WritableStream"));
return @getByIdDirectPrivate(this, "closedPromiseCapability").@promise;
}
@@ -165,7 +165,7 @@
"use strict";
if (!@isWritableStream(this))
- return @Promise.@reject(new @TypeError("The WritableStream.ready getter can only be used on instances of WritableStream"));
+ return @Promise.@reject(@makeTypeError("The WritableStream.ready getter can only be used on instances of WritableStream"));
return @getByIdDirectPrivate(this, "readyPromiseCapability").@promise;
}