"})");
m_sort = qPersistentNew<v8::Function>(v8::FunctionTemplate::New(Sort)->GetFunction());
- m_arrayPrototype = qPersistentNew<v8::Object>(v8::Array::New(1)->GetPrototype()->ToObject()->Clone());
- m_arrayPrototype->Set(v8::String::New("sort"), m_sort);
+ m_arrayPrototype = qPersistentNew<v8::Value>(v8::Array::New(1)->GetPrototype());
v8::Local<v8::Script> defaultSortCompareScript = v8::Script::Compile(engine->toString(defaultSortString));
m_defaultSortComparer = qPersistentNew<v8::Function>(v8::Handle<v8::Function>(v8::Function::Cast(*defaultSortCompareScript->Run())));
ft->InstanceTemplate()->SetAccessor(v8::String::New("valueOf"), ValueOfGetter, 0,
m_valueOf, v8::DEFAULT,
v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete | v8::DontEnum));
+ ft->InstanceTemplate()->SetAccessor(v8::String::New("sort"), SortGetter, 0,
+ m_sort, v8::DEFAULT,
+ v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete | v8::DontEnum));
ft->InstanceTemplate()->SetHasExternalResource(true);
ft->InstanceTemplate()->MarkAsUseUserObjectComparison();
m_constructor = qPersistentNew<v8::Function>(ft->GetFunction());
return info.Data();
}
+v8::Handle<v8::Value> QV8SequenceWrapper::SortGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info)
+{
+ Q_UNUSED(property);
+ return info.Data();
+}
+
v8::Handle<v8::Value> QV8SequenceWrapper::Sort(const v8::Arguments &args)
{
int argCount = args.Length();
v8::Persistent<v8::Function> m_toString;
v8::Persistent<v8::Function> m_valueOf;
v8::Persistent<v8::Function> m_sort;
- v8::Persistent<v8::Object> m_arrayPrototype;
+ v8::Persistent<v8::Value> m_arrayPrototype;
v8::Persistent<v8::Function> m_defaultSortComparer;
static v8::Handle<v8::Value> IndexedGetter(quint32 index, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> ToStringGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> ToString(const v8::Arguments &args);
static v8::Handle<v8::Value> ValueOfGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info);
+ static v8::Handle<v8::Value> SortGetter(v8::Local<v8::String> property, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> ValueOf(const v8::Arguments &args);
static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, const v8::AccessorInfo &info);
static v8::Handle<v8::Value> Setter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo &info);