aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 7839db8e01..abfc3e730b 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -579,7 +579,14 @@ void Runtime::method_storeProperty(ExecutionEngine *engine, const Value &object,
Scope scope(engine);
QV4::Function *v4Function = engine->currentStackFrame->v4Function;
ScopedString name(scope, v4Function->compilationUnit->runtimeStrings[nameIndex]);
- ScopedObject o(scope, object.toObject(engine));
+ ScopedObject o(scope, object);
+ if (!o) {
+ if (v4Function->isStrict()) {
+ engine->throwTypeError();
+ return;
+ }
+ o = object.toObject(engine);
+ }
if ((!o || !o->put(name, value)) && v4Function->isStrict())
engine->throwTypeError();
}
@@ -664,7 +671,15 @@ ReturnedValue Runtime::method_loadElement(ExecutionEngine *engine, const Value &
static Q_NEVER_INLINE bool setElementFallback(ExecutionEngine *engine, const Value &object, const Value &index, const Value &value)
{
Scope scope(engine);
- ScopedObject o(scope, object.toObject(engine));
+ ScopedObject o(scope, object);
+ if (!o) {
+ if (engine->currentStackFrame->v4Function->isStrict()) {
+ engine->throwTypeError();
+ return false;
+ }
+
+ o = object.toObject(engine);
+ }
if (engine->hasException)
return false;