diff options
Diffstat (limited to 'src/qml/jsruntime/qv4objectproto.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 806da833ea..410f243a3c 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -501,14 +501,14 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx) return ctx->throwTypeError(); Scope scope(ctx); - Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert); - if (scope.engine->hasException) - return Encode::undefined(); - Scoped<FunctionObject> f(scope, ctx->argument(1)); if (!f) return ctx->throwTypeError(); + Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert); + if (scope.engine->hasException) + return Encode::undefined(); + Scoped<Object> o(scope, ctx->callData->thisObject); if (!o) { if (!ctx->callData->thisObject.isUndefined()) @@ -516,7 +516,9 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx) o = ctx->engine->globalObject; } - Property pd = Property::fromAccessor(f.getPointer(), 0); + Property pd; + pd.value = f; + pd.set = Primitive::emptyValue(); o->__defineOwnProperty__(ctx, prop, pd, Attr_Accessor); return Encode::undefined(); } @@ -527,14 +529,14 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx) return ctx->throwTypeError(); Scope scope(ctx); - Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert); - if (scope.engine->hasException) - return Encode::undefined(); - Scoped<FunctionObject> f(scope, ctx->argument(1)); if (!f) return ctx->throwTypeError(); + Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert); + if (scope.engine->hasException) + return Encode::undefined(); + Scoped<Object> o(scope, ctx->callData->thisObject); if (!o) { if (!ctx->callData->thisObject.isUndefined()) @@ -542,7 +544,9 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx) o = ctx->engine->globalObject; } - Property pd = Property::fromAccessor(0, f.getPointer()); + Property pd; + pd.value = Primitive::emptyValue(); + pd.set = f; o->__defineOwnProperty__(ctx, prop, pd, Attr_Accessor); return Encode::undefined(); } |