diff options
author | Lars Knoll <[email protected]> | 2014-07-28 10:07:57 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2014-11-04 20:17:54 +0100 |
commit | 486948817b26da2c62802bb93a0f671715c609d4 (patch) | |
tree | 45cd51615a6d187ac504c18c4dee4aa31cf9a771 /src/qml/jsruntime/qv4arraybuffer.cpp | |
parent | 6f6b350976ccfe959223b1fbe8c21fe71efc45bd (diff) |
Move the throw methods from ExecutionContext to ExecutionEngine
The methods don't require a context, and thus shouldn't be
implemented there.
Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4arraybuffer.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4arraybuffer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index c97b16a255..82ab2a2a87 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -56,7 +56,7 @@ ReturnedValue ArrayBufferCtor::construct(Managed *m, CallData *callData) return Encode::undefined(); uint len = (uint)qBound(0., dl, (double)UINT_MAX); if (len != dl) - return v4->currentContext()->throwRangeError(QLatin1String("ArrayBuffer constructor: invalid length")); + return v4->throwRangeError(QLatin1String("ArrayBuffer constructor: invalid length")); Scoped<ArrayBuffer> a(scope, v4->memoryManager->alloc<ArrayBuffer>(v4, len)); if (scope.engine->hasException) @@ -89,7 +89,7 @@ ArrayBuffer::Data::Data(ExecutionEngine *e, int length) data = QTypedArrayData<char>::allocate(length + 1); if (!data) { data = 0; - e->currentContext()->throwRangeError(QStringLiteral("ArrayBuffer: out of memory")); + e->throwRangeError(QStringLiteral("ArrayBuffer: out of memory")); return; } data->size = length; @@ -128,7 +128,7 @@ ReturnedValue ArrayBufferPrototype::method_get_byteLength(CallContext *ctx) Scope scope(ctx); Scoped<ArrayBuffer> v(scope, ctx->d()->callData->thisObject); if (!v) - return ctx->throwTypeError(); + return scope.engine->throwTypeError(); return Encode(v->d()->data->size); } @@ -138,7 +138,7 @@ ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx) Scope scope(ctx); Scoped<ArrayBuffer> a(scope, ctx->d()->callData->thisObject); if (!a) - return ctx->throwTypeError(); + return scope.engine->throwTypeError(); double start = ctx->d()->callData->argc > 0 ? ctx->d()->callData->args[0].toInteger() : 0; double end = (ctx->d()->callData->argc < 2 || ctx->d()->callData->args[1].isUndefined()) ? @@ -151,14 +151,14 @@ ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx) Scoped<FunctionObject> constructor(scope, a->get(scope.engine->id_constructor)); if (!constructor) - return ctx->throwTypeError(); + return scope.engine->throwTypeError(); ScopedCallData callData(scope, 1); double newLen = qMax(final - first, 0.); callData->args[0] = QV4::Encode(newLen); QV4::Scoped<ArrayBuffer> newBuffer(scope, constructor->construct(callData)); if (!newBuffer || newBuffer->d()->data->size < (int)newLen) - return scope.engine->currentContext()->throwTypeError(); + return scope.engine->throwTypeError(); memcpy(newBuffer->d()->data->data(), a->d()->data->data() + (uint)first, newLen); |