}
{
v8::ScriptOrigin origin(m_hiddenObject); // Hack to allow us to identify these functions
- v8::Local<v8::Script> script = v8::Script::New(v8::String::New(CREATE_FUNCTION), &origin);
+ v8::Local<v8::Script> script = v8::Script::New(v8::String::New(CREATE_FUNCTION), &origin, 0,
+ v8::Handle<v8::String>(), v8::Script::NativeMode);
v8::Local<v8::Function> fn = v8::Local<v8::Function>::Cast(script->Run());
v8::Handle<v8::Value> invokeFn = v8::FunctionTemplate::New(Invoke)->GetFunction();
v8::Handle<v8::Value> args[] = { invokeFn };
--- /dev/null
+import QtQuick 2.0
+import Qt.test 1.0
+
+MyQmlObject {
+ Component.onCompleted: v8function()
+}
void setWidth(int) { }
};
+void MyQmlObject::v8function(QDeclarativeV8Function *args)
+{
+ const char *error = "Exception thrown from within QObject slot";
+ v8::ThrowException(v8::Exception::Error(v8::String::New(error)));
+}
+
static QJSValue script_api(QDeclarativeEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
#include <private/qv8gccallback_p.h>
#include <private/qdeclarativeengine_p.h>
+#include <private/qv8engine_p.h>
class MyQmlAttachedObject : public QObject
{
void setString(const QString &s) { m_string = s; }
void myinvokable(MyQmlObject *o) { myinvokableObject = o; }
void variantMethod(const QVariant &v) { m_variant = v; }
+ void v8function(QDeclarativeV8Function*);
private:
friend class tst_qdeclarativeecmascript;
void callQtInvokables();
void invokableObjectArg();
void invokableObjectRet();
-
+ void qtbug_20344();
void revisionErrors();
void revision();
delete object;
}
+void tst_qdeclarativeecmascript::qtbug_20344()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_20344.qml"));
+
+ QString warning = component.url().toString() + ":5: Error: Exception thrown from within QObject slot";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ delete object;
+}
+
void tst_qdeclarativeecmascript::revisionErrors()
{
{