#include "config.h"
#include "V8TestNode.h"
-#include "bindings/v8/ExceptionState.h"
-#include "bindings/v8/V8DOMConfiguration.h"
-#include "bindings/v8/V8HiddenValue.h"
-#include "bindings/v8/V8ObjectConstructor.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/V8DOMConfiguration.h"
+#include "bindings/core/v8/V8HiddenValue.h"
+#include "bindings/core/v8/V8ObjectConstructor.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/frame/LocalDOMWindow.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"
-namespace WebCore {
+namespace blink {
static void initializeScriptWrappableForInterface(TestNode* object)
{
ASSERT_NOT_REACHED();
}
-} // namespace WebCore
+} // namespace blink
-void webCoreInitializeScriptWrappableForInterface(WebCore::TestNode* object)
+void webCoreInitializeScriptWrappableForInterface(blink::TestNode* object)
{
- WebCore::initializeScriptWrappableForInterface(object);
+ blink::initializeScriptWrappableForInterface(object);
}
-namespace WebCore {
-const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installPerContextEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, WillBeGarbageCollectedObject };
+namespace blink {
+const WrapperTypeInfo V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestNode::domTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installConditionallyEnabledMethods, &V8Node::wrapperTypeInfo, WrapperTypeObjectPrototype, WillBeGarbageCollectedObject };
namespace TestNodeV8Internal {
static void hrefAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
TestNodeV8Internal::hrefAttributeGetter(info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hrefAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
static void hrefAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
TestNodeV8Internal::hrefAttributeSetter(v8Value, info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
static void hrefThrowsAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
TestNodeV8Internal::hrefThrowsAttributeGetter(info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hrefThrowsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
static void hrefThrowsAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
TestNodeV8Internal::hrefThrowsAttributeSetter(v8Value, info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
static void hrefCallWithAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
TestNodeV8Internal::hrefCallWithAttributeGetter(info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void hrefCallWithAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
v8::Handle<v8::Object> holder = info.Holder();
TestNode* impl = V8TestNode::toNative(holder);
TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
- impl->setHrefCallWith(callingDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue);
+ ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
+ impl->setHrefCallWith(executionContext, callingDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue);
}
static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
TestNodeV8Internal::hrefCallWithAttributeSetter(v8Value, info);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void hrefByteStringAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ v8::Handle<v8::Object> holder = info.Holder();
+ TestNode* impl = V8TestNode::toNative(holder);
+ v8SetReturnValueString(info, impl->hrefByteString(), info.GetIsolate());
+}
+
+static void hrefByteStringAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
+ TestNodeV8Internal::hrefByteStringAttributeGetter(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
+}
+
+static void hrefByteStringAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ v8::Handle<v8::Object> holder = info.Holder();
+ ExceptionState exceptionState(ExceptionState::SetterContext, "hrefByteString", "TestNode", holder, info.GetIsolate());
+ TestNode* impl = V8TestNode::toNative(holder);
+ TONATIVE_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, toByteString(v8Value, exceptionState), exceptionState);
+ impl->setHrefByteString(cppValue);
+}
+
+static void hrefByteStringAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
+ TestNodeV8Internal::hrefByteStringAttributeSetter(v8Value, info);
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- v8::Isolate* isolate = info.GetIsolate();
RefPtrWillBeRawPtr<TestNode> impl = TestNode::create();
-
v8::Handle<v8::Object> wrapper = info.Holder();
- V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8TestNode::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(info, wrapper);
}
} // namespace TestNodeV8Internal
static const V8DOMConfiguration::AttributeConfiguration V8TestNodeAttributes[] = {
- {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal::hrefAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNodeV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- {"hrefCallWith", TestNodeV8Internal::hrefCallWithAttributeGetterCallback, TestNodeV8Internal::hrefCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
+ {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal::hrefAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
+ {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNodeV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
+ {"hrefCallWith", TestNodeV8Internal::hrefCallWithAttributeGetterCallback, TestNodeV8Internal::hrefCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
+ {"hrefByteString", TestNodeV8Internal::hrefByteStringAttributeGetterCallback, TestNodeV8Internal::hrefByteStringAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
};
void V8TestNode::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
+ TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
if (!info.IsConstructCall()) {
- throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestNode"), info.GetIsolate());
+ V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestNode"), info.GetIsolate());
return;
}
TestNodeV8Internal::constructor(info);
}
-static void configureV8TestNodeTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
+static void installV8TestNodeTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Handle<v8::FunctionTemplate> V8TestNode::domTemplate(v8::Isolate* isolate)
{
- return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestNodeTemplate);
+ return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestNodeTemplate);
}
bool V8TestNode::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
TestNode* V8TestNode::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
{
- return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
+ return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
}
EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object)
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
- installPerContextEnabledProperties(wrapper, impl.get(), isolate);
+ installConditionallyEnabledProperties(wrapper, isolate);
V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
-void V8TestNode::derefObject(void* object)
+void V8TestNode::derefObject(ScriptWrappableBase* internalPointer)
{
#if !ENABLE(OILPAN)
- fromInternalPointer(object)->deref();
+ fromInternalPointer(internalPointer)->deref();
#endif // !ENABLE(OILPAN)
}
return toV8(impl, creationContext, isolate);
}
-} // namespace WebCore
+} // namespace blink