From ccbf97ef1959d42764954c261f6f464515c19180 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 5 Aug 2009 16:15:18 +0200 Subject: construct a QScriptObject instead of a JSObject We need it to be a QScriptObject so that it's possible to call e.g. setScriptClass() on the result. Also, return the default-constructed object if the result of calling the constructor function is not an object. --- src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp index 051f310..2d98013 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp @@ -29,6 +29,7 @@ #include "ExceptionHelpers.h" #include "Interpreter.h" #include "JSGlobalObject.h" +#include "bridge/qscriptobject_p.h" #endif #include "JSFunction.h" @@ -45,7 +46,7 @@ JSObject* construct(ExecState* exec, JSValue callee, ConstructType constructType structure = asObject(prototype)->inheritorID(); else structure = exec->lexicalGlobalObject()->emptyObjectStructure(); - JSObject* thisObj = new (exec) JSObject(structure); + JSObject* thisObj = new (exec) QScriptObject(structure); ScopeChainNode* scopeChain = exec->scopeChain(); Interpreter *interp = exec->interpreter(); @@ -62,6 +63,8 @@ JSObject* construct(ExecState* exec, JSValue callee, ConstructType constructType newCallFrame += argc + RegisterFile::CallFrameHeaderSize; newCallFrame->init(0, /*vPC=*/0, scopeChain, exec, 0, argc, asObject(callee)); JSObject *result = constructData.native.function(newCallFrame, asObject(callee), args); + if (!result) + result = thisObj; interp->registerFile().shrink(oldEnd); return result; #else -- cgit v0.12