#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/V8Binding.h"
#include "core/dom/DOMException.h"
+#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
#include "core/testing/DummyPageHolder.h"
class Function : public ScriptFunction {
public:
- static PassOwnPtr<Function> create(v8::Isolate* isolate, String* value)
+ static v8::Handle<v8::Function> createFunction(ScriptState* scriptState, String* value)
+ {
+ Function* self = new Function(scriptState, value);
+ return self->bindToV8Function();
+ }
+
+private:
+ Function(ScriptState* scriptState, String* value)
+ : ScriptFunction(scriptState)
+ , m_value(value)
{
- return adoptPtr(new Function(isolate, value));
}
virtual ScriptValue call(ScriptValue value) OVERRIDE
return value;
}
-private:
- Function(v8::Isolate* isolate, String* value) : ScriptFunction(isolate), m_value(value) { }
-
String* m_value;
};
ASSERT_FALSE(promise.isEmpty());
{
ScriptState::Scope scope(scriptState());
- promise.then(Function::create(isolate(), &onFulfilled), Function::create(isolate(), &onRejected));
+ promise.then(Function::createFunction(scriptState(), &onFulfilled), Function::createFunction(scriptState(), &onRejected));
}
EXPECT_EQ(String(), onFulfilled);
ASSERT_FALSE(promise.isEmpty());
{
ScriptState::Scope scope(scriptState());
- promise.then(Function::create(isolate(), &onFulfilled), Function::create(isolate(), &onRejected));
+ promise.then(Function::createFunction(scriptState(), &onFulfilled), Function::createFunction(scriptState(), &onRejected));
}
EXPECT_EQ(String(), onFulfilled);
ASSERT_FALSE(promise.isEmpty());
{
ScriptState::Scope scope(scriptState());
- promise.then(Function::create(isolate(), &onFulfilled), Function::create(isolate(), &onRejected));
+ promise.then(Function::createFunction(scriptState(), &onFulfilled), Function::createFunction(scriptState(), &onRejected));
}
executionContext()->stopActiveDOMObjects();
ASSERT_FALSE(promise.isEmpty());
{
ScriptState::Scope scope(scriptState());
- promise.then(Function::create(isolate(), &onFulfilled), Function::create(isolate(), &onRejected));
+ promise.then(Function::createFunction(scriptState(), &onFulfilled), Function::createFunction(scriptState(), &onRejected));
}
resolver->resolve();
ASSERT_FALSE(promise.isEmpty());
{
ScriptState::Scope scope(scriptState());
- promise.then(Function::create(isolate(), &onFulfilled), Function::create(isolate(), &onRejected));
+ promise.then(Function::createFunction(scriptState(), &onFulfilled), Function::createFunction(scriptState(), &onRejected));
}
resolver->reject();