}
}
+ if (object.isNull() || object.isUndefined()) {
+ QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index.toQString()).arg(object.toQString());
+ ctx->throwTypeError(message);
+ }
+
o = __qmljs_convert_to_object(ctx, object);
}
if (m) {
res = m->get(ctx, name);
} else {
+ if (object.isNull() || object.isUndefined()) {
+ QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString()).arg(object.toQString());
+ ctx->throwTypeError(message);
+ }
+
m = __qmljs_convert_to_object(ctx, object);
res = m->get(ctx, name);
}
#include <QtCore/qnumeric.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlvmemetaobject_p.h>
+#include <private/qqmlcontextwrapper_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
#include "../../shared/util.h"
void singletonTypeCaching();
void singletonTypeImportOrder();
void singletonTypeResolution();
-#if 0
void importScripts_data();
void importScripts();
-#endif
void scarceResources();
void scarceResources_data();
void scarceResources_other();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
-// static void verifyContextLifetime(QQmlContextData *ctxt);
+ static void verifyContextLifetime(QQmlContextData *ctxt);
QQmlEngine engine;
};
delete object;
}
-#if 0
void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
QQmlContextData *childCtxt = ctxt->childContexts;
if (!ctxt->importedScripts.isEmpty()) {
QV8Engine *engine = QV8Engine::get(ctxt->engine);
- foreach (v8::Persistent<v8::Object> qmlglobal, ctxt->importedScripts) {
+ foreach (const QV4::PersistentValue& qmlglobal, ctxt->importedScripts) {
QQmlContextData *scriptContext, *newContext;
- if (qmlglobal.IsEmpty())
+ if (qmlglobal.isEmpty())
continue;
- scriptContext = engine->contextWrapper()->context(qmlglobal);
+ scriptContext = QV4::QmlContextWrapper::getContext(qmlglobal);
{
- v8::Handle<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
+ QV4::Value temporaryScope = QV4::QmlContextWrapper::qmlScope(engine, scriptContext, 0);
Q_UNUSED(temporaryScope)
}
engine->gc();
- newContext = engine->contextWrapper()->context(qmlglobal);
+ newContext = QV4::QmlContextWrapper::getContext(qmlglobal);
QVERIFY(scriptContext == newContext);
}
}
childCtxt = childCtxt->nextChild;
}
}
-#endif
-#if 0
void tst_qqmlecmascript::importScripts_data()
{
QTest::addColumn<QUrl>("testfile");
engine.setImportPathList(importPathList);
}
-#endif
void tst_qqmlecmascript::scarceResources_other()
{