aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-03-13 17:39:21 -0400
committerSimon Hausmann <simon.hausmann@digia.com>2013-03-13 22:49:56 +0100
commit63a7441d26a923b7601393247bcea3038435daf7 (patch)
treec5cbfddf58f868803b0912f352335904e7949f2b /src
parent9a728baa88c6b8b6230caea6aefc4383d470bcc1 (diff)
Catch some more exceptions in the v8 API
Change-Id: I23428f7dce0771576ae1243812eeed7a534dc833 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/v4/qv4v8.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/v4/qv4v8.cpp b/src/v4/qv4v8.cpp
index f806bfe760..fa98efe20f 100644
--- a/src/v4/qv4v8.cpp
+++ b/src/v4/qv4v8.cpp
@@ -1069,18 +1069,30 @@ Local<Object> Function::NewInstance() const
{
VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
assert(f);
- VM::Value retval = f->construct(currentEngine()->current, 0, 0);
- return Local<Object>::New(Value::fromVmValue(retval));
+ VM::ExecutionContext *context = currentEngine()->current;
+ QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ try {
+ result = f->construct(context, 0, 0);
+ } catch (VM::Exception &e) {
+ Isolate::GetCurrent()->setException(e.value());
+ e.accept(context);
+ }
+ return Local<Object>::New(Value::fromVmValue(result));
}
Local<Object> Function::NewInstance(int argc, Handle<Value> argv[]) const
{
VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
assert(f);
- VM::Value retval = f->construct(currentEngine()->current,
- reinterpret_cast<QQmlJS::VM::Value*>(argv),
- argc);
- return Local<Object>::New(Value::fromVmValue(retval));
+ VM::ExecutionContext *context = currentEngine()->current;
+ QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ try {
+ result = f->construct(context, reinterpret_cast<QQmlJS::VM::Value*>(argv), argc);
+ } catch (VM::Exception &e) {
+ Isolate::GetCurrent()->setException(e.value());
+ e.accept(context);
+ }
+ return Local<Object>::New(Value::fromVmValue(result));
}
Local<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv[])
@@ -1088,10 +1100,15 @@ Local<Value> Function::Call(Handle<Object> thisObj, int argc, Handle<Value> argv
QQmlJS::VM::FunctionObject *f = ConstValuePtr(this)->asFunctionObject();
if (!f)
return Local<Value>();
- QQmlJS::VM::Value result = f->call(currentEngine()->current,
- *ConstValuePtr(&thisObj),
- reinterpret_cast<QQmlJS::VM::Value*>(argv),
- argc);
+ VM::ExecutionContext *context = currentEngine()->current;
+ QQmlJS::VM::Value result = VM::Value::undefinedValue();
+ try {
+ result = f->call(context, *ConstValuePtr(&thisObj),
+ reinterpret_cast<QQmlJS::VM::Value*>(argv), argc);
+ } catch (VM::Exception &e) {
+ Isolate::GetCurrent()->setException(e.value());
+ e.accept(context);
+ }
return Local<Value>::New(Value::fromVmValue(result));
}