0, v8::External::New(engine));
d->nodePrototype->SetAccessor(v8::String::New("attributes"), attributes,
0, v8::External::New(engine));
- engine->freezeObject(d->nodePrototype);
+ engine->freezeObject(d->nodePrototype->v4Value());
}
return d->nodePrototype;
}
d->elementPrototype->SetPrototype(Node::prototype(engine));
d->elementPrototype->SetAccessor(v8::String::New("tagName"), nodeName,
0, v8::External::New(engine));
- engine->freezeObject(d->elementPrototype);
+ engine->freezeObject(d->elementPrototype->v4Value());
}
return d->elementPrototype;
}
0, v8::External::New(engine));
d->attrPrototype->SetAccessor(v8::String::New("ownerElement"), ownerElement,
0, v8::External::New(engine));
- engine->freezeObject(d->attrPrototype);
+ engine->freezeObject(d->attrPrototype->v4Value());
}
return d->attrPrototype;
}
0, v8::External::New(engine));
d->characterDataPrototype->SetAccessor(v8::String::New("length"), length,
0, v8::External::New(engine));
- engine->freezeObject(d->characterDataPrototype);
+ engine->freezeObject(d->characterDataPrototype->v4Value());
}
return d->characterDataPrototype;
}
0, v8::External::New(engine));
d->textPrototype->SetAccessor(v8::String::New("wholeText"), wholeText,
0, v8::External::New(engine));
- engine->freezeObject(d->textPrototype);
+ engine->freezeObject(d->textPrototype->v4Value());
}
return d->textPrototype;
}
if (d->cdataPrototype.IsEmpty()) {
d->cdataPrototype = qPersistentNew<v8::Object>(v8::Object::New());
d->cdataPrototype->SetPrototype(Text::prototype(engine));
- engine->freezeObject(d->cdataPrototype);
+ engine->freezeObject(d->cdataPrototype->v4Value());
}
return d->cdataPrototype;
}
0, v8::External::New(engine));
d->documentPrototype->SetAccessor(v8::String::New("documentElement"), documentElement,
0, v8::External::New(engine));
- engine->freezeObject(d->documentPrototype);
+ engine->freezeObject(d->documentPrototype->v4Value());
}
return d->documentPrototype;
}
ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::New(engine));
ot->SetFallbackPropertyHandler(named, 0, 0, 0, 0, v8::External::New(engine));
d->namedNodeMapPrototype = qPersistentNew<v8::Object>(ot->NewInstance());
- engine->freezeObject(d->namedNodeMapPrototype);
+ engine->freezeObject(d->namedNodeMapPrototype->v4Value());
}
return d->namedNodeMapPrototype;
}
ot->SetAccessor(v8::String::New("length"), length, 0, v8::External::New(engine));
ot->SetIndexedPropertyHandler(indexed, 0, 0, 0, 0, v8::External::New(engine));
d->nodeListPrototype = qPersistentNew<v8::Object>(ot->NewInstance());
- engine->freezeObject(d->nodeListPrototype);
+ engine->freezeObject(d->nodeListPrototype->v4Value());
}
return d->nodeListPrototype;
}
delete m_listModelData;
m_listModelData = 0;
- qPersistentDispose(m_freezeObject);
-
qPersistentDispose(m_strongReferencer);
m_jsonWrapper.destroy();
" }"\
"})"
- v8::Local<v8::Script> freeze = v8::Script::New(v8::String::New(FREEZE_SOURCE));
- v8::Local<v8::Value> result = freeze->Run();
- Q_ASSERT(result->IsFunction());
- m_freezeObject = qPersistentNew(v8::Local<v8::Function>::Cast(result));
+ QV4::Value result = evaluateScript(QStringLiteral(FREEZE_SOURCE), 0);
+ Q_ASSERT(result.asFunctionObject());
+ m_freezeObject = QV4::PersistentValue(m_v4Engine, result);
#undef FREEZE_SOURCE
}
}
-void QV8Engine::freezeObject(v8::Handle<v8::Value> value)
+void QV8Engine::freezeObject(const QV4::Value &value)
{
- v8::Handle<v8::Value> args[] = { value };
- m_freezeObject->Call(global(), 1, args);
+ QV4::Value args = value;
+ m_freezeObject->asFunctionObject()->call(m_v4Engine->rootContext, QV4::Value::fromObject(m_v4Engine->globalObject), &args, 1);
}
void QV8Engine::gc()
v8::HandleScope handels;
v8::Context::Scope contextScope(m_context);
initializeGlobal(m_context->Global());
- freezeObject(m_context->Global());
+ freezeObject(QV4::Value::fromObject(m_v4Engine->globalObject));
}
void QV8Engine::setEngine(QQmlEngine *engine)
#include "qv8valuetypewrapper_p.h"
#include "qv8sequencewrapper_p.h"
#include "qv4jsonwrapper_p.h"
+#include <private/qv4value_p.h>
namespace QV4 {
struct ArrayObject;
QQmlContextData *callingContext();
QV4::Value getOwnPropertyNames(const QV4::Value &o);
- void freezeObject(v8::Handle<v8::Value>);
+ void freezeObject(const QV4::Value &value);
QString toString(v8::Handle<v8::Value> string);
QString toString(v8::Handle<v8::String> string);
QV8SequenceWrapper m_sequenceWrapper;
QV4JsonWrapper m_jsonWrapper;
- v8::Persistent<v8::Function> m_freezeObject;
+ QV4::PersistentValue m_freezeObject;
void *m_xmlHttpRequestData;