summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-05 14:15:18 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-05 14:15:18 (GMT)
commitccbf97ef1959d42764954c261f6f464515c19180 (patch)
tree023f970e620e498314213440f2a0d1f150c7d802 /src
parent1d7d5436eea09a232187836e59d2a937a752dee4 (diff)
downloadQt-ccbf97ef1959d42764954c261f6f464515c19180.zip
Qt-ccbf97ef1959d42764954c261f6f464515c19180.tar.gz
Qt-ccbf97ef1959d42764954c261f6f464515c19180.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/ConstructData.cpp5
1 files changed, 4 insertions, 1 deletions
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