Inherit EventTarget interface instead of duplicating its code
Update most interfaces to stop using [EventTarget] IDL extended attribute
and inherit EventTarget instead. This avoids duplicating the EventTarget
API in each IDL and makes our IDL more standard.
Also remove [NoInterfaceObject] extended attribute from EventTarget to
facilitate testing and match the specification:
http://dom.spec.whatwg.org/#interface-eventtarget
Only 3 interfaces were not updated yet (Node, Window, Performance) because
they require special treatment at the moment.
BUG=257583
Review URL: https://chromiumcodereview.appspot.com/18778002
git-svn-id: svn://svn.chromium.org/blink/trunk@153867 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/LayoutTests/fast/dom/dom-constructors-expected.txt b/LayoutTests/fast/dom/dom-constructors-expected.txt
index e4ae727..778759a 100644
--- a/LayoutTests/fast/dom/dom-constructors-expected.txt
+++ b/LayoutTests/fast/dom/dom-constructors-expected.txt
@@ -10,6 +10,7 @@
PASS TryAllocate('DocumentType') is 'exception'
PASS TryAllocate('Element') is 'exception'
PASS TryAllocate('Entity') is 'exception'
+PASS TryAllocate('EventTarget') is 'exception'
PASS TryAllocate('HTMLDocument') is 'exception'
PASS TryAllocate('Node') is 'exception'
PASS TryAllocate('Notation') is 'exception'
@@ -120,7 +121,6 @@
PASS TryAllocate('EventTargetNode') is 'no constructor'
PASS TryAllocate('UndetectableHTMLCollection') is 'no constructor'
PASS TryAllocate('XPathNSResolver') is 'no constructor'
-PASS TryAllocate('EventTarget') is 'no constructor'
PASS TryAllocate('EventListener') is 'no constructor'
PASS TryAllocate('NPObject') is 'no constructor'
PASS TryAllocate('Comment') is '[object Comment]'
diff --git a/LayoutTests/fast/dom/dom-constructors.html b/LayoutTests/fast/dom/dom-constructors.html
index b001c6e..6073030 100644
--- a/LayoutTests/fast/dom/dom-constructors.html
+++ b/LayoutTests/fast/dom/dom-constructors.html
@@ -20,6 +20,7 @@
'DocumentType',
'Element',
'Entity',
+ 'EventTarget',
'HTMLDocument',
'Node',
'Notation',
@@ -147,7 +148,6 @@
'EventTargetNode',
'UndetectableHTMLCollection',
'XPathNSResolver',
- 'EventTarget',
'EventListener',
'NPObject'
];
diff --git a/LayoutTests/webexposed/event-target-in-prototype-expected.txt b/LayoutTests/webexposed/event-target-in-prototype-expected.txt
new file mode 100644
index 0000000..de47cc8
--- /dev/null
+++ b/LayoutTests/webexposed/event-target-in-prototype-expected.txt
@@ -0,0 +1,17 @@
+Check that interfaces inherit from EventTarget
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS EventSource.prototype.__proto__ is EventTarget.prototype
+PASS MessagePort.prototype.__proto__ is EventTarget.prototype
+FAIL Node.prototype.__proto__ should be [object Object]. Was [object Object].
+PASS WebSocket.prototype.__proto__ is EventTarget.prototype
+FAIL Window.prototype.__proto__ should be [object Object]. Was [object Object].
+PASS XMLHttpRequest.prototype.__proto__ is EventTarget.prototype
+PASS XMLHttpRequestUpload.prototype.__proto__ is EventTarget.prototype
+PASS webkitAudioContext.prototype.__proto__ is EventTarget.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/webexposed/event-target-in-prototype.html b/LayoutTests/webexposed/event-target-in-prototype.html
new file mode 100644
index 0000000..52e4483
--- /dev/null
+++ b/LayoutTests/webexposed/event-target-in-prototype.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description("Check that interfaces inherit from EventTarget");
+
+eventTargets = ['EventSource', 'MessagePort', 'Node', 'WebSocket', 'Window', 'XMLHttpRequest', 'XMLHttpRequestUpload', 'webkitAudioContext'];
+
+for (var i = 0; i < eventTargets.length; i++) {
+ shouldBe(eventTargets[i] + ".prototype.__proto__", "EventTarget.prototype");
+}
+
+</script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/webexposed/global-constructors-listing-expected.txt b/LayoutTests/webexposed/global-constructors-listing-expected.txt
index eb43079..897183e 100644
--- a/LayoutTests/webexposed/global-constructors-listing-expected.txt
+++ b/LayoutTests/webexposed/global-constructors-listing-expected.txt
@@ -75,6 +75,7 @@
EvalError
Event
EventSource
+EventTarget
File
FileError
FileList
diff --git a/Source/bindings/scripts/CodeGeneratorV8.pm b/Source/bindings/scripts/CodeGeneratorV8.pm
index a10985f..8f51cff 100644
--- a/Source/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/bindings/scripts/CodeGeneratorV8.pm
@@ -491,7 +491,7 @@
my $code = <<END;
void* ${v8ClassName}::opaqueRootForGC(void* object, v8::Isolate* isolate)
{
- ${implClassName}* impl = static_cast<${implClassName}*>(object);
+ ${implClassName}* impl = fromInternalPointer(object);
END
my $isReachableMethod = $interface->extendedAttributes->{"GenerateIsReachable"};
if ($isReachableMethod) {
@@ -669,7 +669,7 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static ${nativeType}* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<${nativeType}*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -748,6 +748,29 @@
GenerateHeaderLegacyCall($interface);
GenerateHeaderCustomInternalFieldIndices($interface);
+ my $toWrappedType;
+ my $fromWrappedType;
+ if ($interface->parent) {
+ my $v8ParentClassName = "V8" . $interface->parent;
+ $toWrappedType = "${v8ParentClassName}::toInternalPointer(impl)";
+ $fromWrappedType = "static_cast<${nativeType}*>(${v8ParentClassName}::fromInternalPointer(object))";
+ } else {
+ $toWrappedType = "impl";
+ $fromWrappedType = "static_cast<${nativeType}*>(object)";
+ }
+
+ $header{classPublic}->add(<<END);
+ static inline void* toInternalPointer(${nativeType}* impl)
+ {
+ return $toWrappedType;
+ }
+
+ static inline ${nativeType}* fromInternalPointer(void* object)
+ {
+ return $fromWrappedType;
+ }
+END
+
if ($interface->name eq "Window") {
$header{classPublic}->add(<<END);
static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
@@ -854,7 +877,7 @@
inline v8::Handle<v8::Object> wrap(${nativeType}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -872,7 +895,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -883,7 +906,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<${v8ClassName}>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -894,7 +917,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<${v8ClassName}>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -906,7 +929,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<${v8ClassName}>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -1518,11 +1541,12 @@
# Check for a wrapper in the wrapper cache. If there is one, we know that a hidden reference has already
# been created. If we don't find a wrapper, we create both a wrapper and a hidden reference.
my $nativeReturnType = GetNativeType($returnType);
+ my $v8ReturnType = "V8" . $returnType;
$code .= " $nativeReturnType result = ${getterString};\n";
if ($forMainWorldSuffix) {
- $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}(result.get())) : v8Undefined();\n";
+ $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper${forMainWorldSuffix}<${v8ReturnType}>(result.get())) : v8Undefined();\n";
} else {
- $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();\n";
+ $code .= " v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper<${v8ReturnType}>(result.get(), info.GetIsolate())) : v8Undefined();\n";
}
$code .= " if (wrapper.IsEmpty()) {\n";
$code .= " wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());\n"; # FIXME: Could use wrap here since the wrapper is empty.
@@ -2565,7 +2589,7 @@
$code .= <<END;
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -2673,7 +2697,7 @@
RefPtr<${implClassName}> event = ${implClassName}::create(type, eventInit);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(event.release(), &${v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(event.release(), &${v8ClassName}::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(args, wrapper);
}
END
@@ -2831,7 +2855,7 @@
$code .= <<END;
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8ClassName}Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<${v8ClassName}>(impl.release(), &${v8ClassName}Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -4494,7 +4518,7 @@
$implementation{nameSpaceWebCore}->add(<<END);
void ${v8ClassName}::derefObject(void* object)
{
- static_cast<${nativeType}*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
END
@@ -4740,11 +4764,10 @@
v8::Handle<v8::Object> ${v8ClassName}::createWrapper(${createWrapperArgumentType} impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<${v8ClassName}>(impl.get(), isolate).IsEmpty());
END
$code .= <<END if ($baseType ne $interfaceName);
- ASSERT(static_cast<void*>(static_cast<${baseType}*>(impl.get())) == static_cast<void*>(impl.get()));
END
if (InheritsInterface($interface, "Document")) {
@@ -4752,7 +4775,7 @@
if (Frame* frame = impl->frame()) {
if (frame->script()->initializeMainWorld()) {
// initializeMainWorld may have created a wrapper for the object, retry from the start.
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper(impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<${v8ClassName}>(impl.get(), isolate);
if (!wrapper.IsEmpty())
return wrapper;
}
@@ -4762,7 +4785,7 @@
$code .= <<END;
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
END
@@ -4778,7 +4801,7 @@
$code .= <<END;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, $wrapperConfiguration);
+ V8DOMWrapper::associateObjectWithWrapper<$v8ClassName>(impl, &info, wrapper, isolate, $wrapperConfiguration);
return wrapper;
}
END
diff --git a/Source/bindings/tests/idls/TestEventTarget.idl b/Source/bindings/tests/idls/TestEventTarget.idl
index 9744be5..76aed9d 100644
--- a/Source/bindings/tests/idls/TestEventTarget.idl
+++ b/Source/bindings/tests/idls/TestEventTarget.idl
@@ -27,9 +27,8 @@
*/
[
- EventTarget,
MasqueradesAsUndefined
-] interface TestEventTarget {
+] interface TestEventTarget : EventTarget {
getter Node item([IsIndex] unsigned long index);
[ImplementedAs=anonymousIndexedSetter] setter Node (unsigned long index, Node node);
@@ -37,13 +36,5 @@
[ImplementedAs=anonymousNamedSetter] setter Node(DOMString name, [TreatUndefinedAs=anonymousNamedSetterUndefined] DOMString value);
[ImplementedAs=anonymousIndexedDeleter, RaisesException] deleter boolean(unsigned long index);
[ImplementedAs=anonymousNamedDeleter] deleter boolean(DOMString name);
-
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/bindings/tests/results/V8Float64Array.cpp b/Source/bindings/tests/results/V8Float64Array.cpp
index db8d9c2..0612caf 100644
--- a/Source/bindings/tests/results/V8Float64Array.cpp
+++ b/Source/bindings/tests/results/V8Float64Array.cpp
@@ -210,10 +210,9 @@
v8::Handle<v8::Object> V8Float64Array::createWrapper(PassRefPtr<Float64Array> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
- ASSERT(static_cast<void*>(static_cast<ArrayBufferView*>(impl.get())) == static_cast<void*>(impl.get()));
+ ASSERT(DOMDataStore::getWrapper<V8Float64Array>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
if (!impl->buffer()->hasDeallocationObserver()) {
@@ -221,12 +220,12 @@
impl->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
}
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8Float64Array>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8Float64Array::derefObject(void* object)
{
- static_cast<Float64Array*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8Float64Array.h b/Source/bindings/tests/results/V8Float64Array.h
index 6f690c8..fc6b514 100644
--- a/Source/bindings/tests/results/V8Float64Array.h
+++ b/Source/bindings/tests/results/V8Float64Array.h
@@ -36,7 +36,7 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static Float64Array* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<Float64Array*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -44,6 +44,15 @@
static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&);
static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(Float64Array* impl)
+ {
+ return V8ArrayBufferView::toInternalPointer(impl);
+ }
+
+ static inline Float64Array* fromInternalPointer(void* object)
+ {
+ return static_cast<Float64Array*>(V8ArrayBufferView::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, Float64Array*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -64,7 +73,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8Float64Array>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -75,7 +84,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8Float64Array>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -86,7 +95,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8Float64Array>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -98,7 +107,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8Float64Array>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestActiveDOMObject.cpp b/Source/bindings/tests/results/V8TestActiveDOMObject.cpp
index 2e1efcc..0921d7a 100644
--- a/Source/bindings/tests/results/V8TestActiveDOMObject.cpp
+++ b/Source/bindings/tests/results/V8TestActiveDOMObject.cpp
@@ -249,18 +249,18 @@
v8::Handle<v8::Object> V8TestActiveDOMObject::createWrapper(PassRefPtr<TestActiveDOMObject> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestActiveDOMObject>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObject>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestActiveDOMObject::derefObject(void* object)
{
- static_cast<TestActiveDOMObject*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestActiveDOMObject.h b/Source/bindings/tests/results/V8TestActiveDOMObject.h
index 13e1222..11915d7 100644
--- a/Source/bindings/tests/results/V8TestActiveDOMObject.h
+++ b/Source/bindings/tests/results/V8TestActiveDOMObject.h
@@ -35,11 +35,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestActiveDOMObject* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestActiveDOMObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestActiveDOMObject* impl)
+ {
+ return impl;
+ }
+
+ static inline TestActiveDOMObject* fromInternalPointer(void* object)
+ {
+ return static_cast<TestActiveDOMObject*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestActiveDOMObject*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -57,7 +66,7 @@
inline v8::Handle<v8::Object> wrap(TestActiveDOMObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestActiveDOMObject>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -71,7 +80,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestActiveDOMObject>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -82,7 +91,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestActiveDOMObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -93,7 +102,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestActiveDOMObject>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -105,7 +114,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestActiveDOMObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestCustomAccessors.cpp b/Source/bindings/tests/results/V8TestCustomAccessors.cpp
index ff55783..237ce51 100644
--- a/Source/bindings/tests/results/V8TestCustomAccessors.cpp
+++ b/Source/bindings/tests/results/V8TestCustomAccessors.cpp
@@ -195,18 +195,18 @@
v8::Handle<v8::Object> V8TestCustomAccessors::createWrapper(PassRefPtr<TestCustomAccessors> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestCustomAccessors>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestCustomAccessors>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestCustomAccessors::derefObject(void* object)
{
- static_cast<TestCustomAccessors*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestCustomAccessors.h b/Source/bindings/tests/results/V8TestCustomAccessors.h
index 25b9db6..b5d1f8d 100644
--- a/Source/bindings/tests/results/V8TestCustomAccessors.h
+++ b/Source/bindings/tests/results/V8TestCustomAccessors.h
@@ -35,7 +35,7 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestCustomAccessors* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestCustomAccessors*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -48,6 +48,15 @@
static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8::Array>&);
static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestCustomAccessors* impl)
+ {
+ return impl;
+ }
+
+ static inline TestCustomAccessors* fromInternalPointer(void* object)
+ {
+ return static_cast<TestCustomAccessors*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestCustomAccessors*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -65,7 +74,7 @@
inline v8::Handle<v8::Object> wrap(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -79,7 +88,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -90,7 +99,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -101,7 +110,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestCustomAccessors>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -113,7 +122,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestEvent.cpp b/Source/bindings/tests/results/V8TestEvent.cpp
index 3f0026f..a1b9b30 100644
--- a/Source/bindings/tests/results/V8TestEvent.cpp
+++ b/Source/bindings/tests/results/V8TestEvent.cpp
@@ -109,19 +109,18 @@
v8::Handle<v8::Object> V8TestEvent::createWrapper(PassRefPtr<TestEvent> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
- ASSERT(static_cast<void*>(static_cast<Event*>(impl.get())) == static_cast<void*>(impl.get()));
+ ASSERT(DOMDataStore::getWrapper<V8TestEvent>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestEvent>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestEvent::derefObject(void* object)
{
- static_cast<TestEvent*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestEvent.h b/Source/bindings/tests/results/V8TestEvent.h
index 467ef74..b1ba4ee 100644
--- a/Source/bindings/tests/results/V8TestEvent.h
+++ b/Source/bindings/tests/results/V8TestEvent.h
@@ -36,11 +36,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestEvent* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestEvent*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestEvent* impl)
+ {
+ return V8Event::toInternalPointer(impl);
+ }
+
+ static inline TestEvent* fromInternalPointer(void* object)
+ {
+ return static_cast<TestEvent*>(V8Event::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestEvent*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -58,7 +67,7 @@
inline v8::Handle<v8::Object> wrap(TestEvent* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEvent>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -72,7 +81,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEvent>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -83,7 +92,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEvent>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -94,7 +103,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestEvent>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -106,7 +115,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEvent>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestEventConstructor.cpp b/Source/bindings/tests/results/V8TestEventConstructor.cpp
index cfa4a14..0fbf161 100644
--- a/Source/bindings/tests/results/V8TestEventConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestEventConstructor.cpp
@@ -108,7 +108,7 @@
RefPtr<TestEventConstructor> event = TestEventConstructor::create(type, eventInit);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(event.release(), &V8TestEventConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestEventConstructor>(event.release(), &V8TestEventConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(args, wrapper);
}
} // namespace TestEventConstructorV8Internal
@@ -190,18 +190,18 @@
v8::Handle<v8::Object> V8TestEventConstructor::createWrapper(PassRefPtr<TestEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEventConstructor>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestEventConstructor>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestEventConstructor::derefObject(void* object)
{
- static_cast<TestEventConstructor*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestEventConstructor.h b/Source/bindings/tests/results/V8TestEventConstructor.h
index 517ebdc9..114cf5b 100644
--- a/Source/bindings/tests/results/V8TestEventConstructor.h
+++ b/Source/bindings/tests/results/V8TestEventConstructor.h
@@ -36,12 +36,21 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestEventConstructor* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestEventConstructor*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestEventConstructor* impl)
+ {
+ return impl;
+ }
+
+ static inline TestEventConstructor* fromInternalPointer(void* object)
+ {
+ return static_cast<TestEventConstructor*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestEventConstructor*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -59,7 +68,7 @@
inline v8::Handle<v8::Object> wrap(TestEventConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEventConstructor>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -73,7 +82,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEventConstructor>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -84,7 +93,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventConstructor>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -95,7 +104,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestEventConstructor>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -107,7 +116,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventConstructor>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestEventTarget.cpp b/Source/bindings/tests/results/V8TestEventTarget.cpp
index 8cc16e3..d3371f3 100644
--- a/Source/bindings/tests/results/V8TestEventTarget.cpp
+++ b/Source/bindings/tests/results/V8TestEventTarget.cpp
@@ -22,13 +22,12 @@
#include "V8TestEventTarget.h"
#include "RuntimeEnabledFeatures.h"
-#include "V8Event.h"
+#include "V8EventTarget.h"
#include "V8Node.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMConfiguration.h"
#include "bindings/v8/V8DOMWrapper.h"
-#include "bindings/v8/V8EventListenerList.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
@@ -58,7 +57,7 @@
}
namespace WebCore {
-WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEventTarget::toEventTarget, 0, V8TestEventTarget::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
+WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEventTarget::toEventTarget, 0, V8TestEventTarget::installPerContextPrototypeProperties, &V8EventTarget::info, WrapperTypeObjectPrototype };
namespace TestEventTargetV8Internal {
@@ -107,65 +106,6 @@
TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
}
-static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[1], false, ListenerFindOrCreate);
- if (listener) {
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, args[0]);
- V8TestEventTarget::toNative(args.Holder())->addEventListener(stringResource, listener, args[2]->BooleanValue());
- createHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex, args.GetIsolate());
- }
-}
-
-static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
- TestEventTargetV8Internal::addEventListenerMethod(args);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
-}
-
-static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- RefPtr<EventListener> listener = V8EventListenerList::getEventListener(args[1], false, ListenerFindOnly);
- if (listener) {
- V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, stringResource, args[0]);
- V8TestEventTarget::toNative(args.Holder())->removeEventListener(stringResource, listener.get(), args[2]->BooleanValue());
- removeHiddenDependency(args.Holder(), args[1], V8TestEventTarget::eventListenerCacheIndex, args.GetIsolate());
- }
-}
-
-static void removeEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
- TestEventTargetV8Internal::removeEventListenerMethod(args);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
-}
-
-static void dispatchEventMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- if (args.Length() < 1) {
- throwNotEnoughArgumentsError(args.GetIsolate());
- return;
- }
- TestEventTarget* imp = V8TestEventTarget::toNative(args.Holder());
- ExceptionCode ec = 0;
- V8TRYCATCH_VOID(Event*, evt, V8Event::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
- bool result = imp->dispatchEvent(evt, ec);
- if (UNLIKELY(ec)) {
- setDOMException(ec, args.GetIsolate());
- return;
- }
- v8SetReturnValueBool(args, result);
- return;
-}
-
-static void dispatchEventMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
-{
- TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
- TestEventTargetV8Internal::dispatchEventMethod(args);
- TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
-}
-
static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
{
ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
@@ -337,8 +277,6 @@
static const V8DOMConfiguration::BatchedMethod V8TestEventTargetMethods[] = {
{"item", TestEventTargetV8Internal::itemMethodCallback, 0, 1},
{"namedItem", TestEventTargetV8Internal::namedItemMethodCallback, 0, 1},
- {"addEventListener", TestEventTargetV8Internal::addEventListenerMethodCallback, 0, 2},
- {"removeEventListener", TestEventTargetV8Internal::removeEventListenerMethodCallback, 0, 2},
};
static v8::Handle<v8::FunctionTemplate> ConfigureV8TestEventTargetTemplate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
@@ -346,7 +284,7 @@
desc->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
- defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestEventTarget", v8::Local<v8::FunctionTemplate>(), V8TestEventTarget::internalFieldCount,
+ defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestEventTarget", V8EventTarget::GetTemplate(isolate, currentWorldType), V8TestEventTarget::internalFieldCount,
0, 0,
V8TestEventTargetMethods, WTF_ARRAY_LENGTH(V8TestEventTargetMethods), isolate, currentWorldType);
UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
@@ -358,12 +296,6 @@
desc->InstanceTemplate()->SetNamedPropertyHandler(TestEventTargetV8Internal::namedPropertyGetterCallback, TestEventTargetV8Internal::namedPropertySetterCallback, TestEventTargetV8Internal::namedPropertyQueryCallback, TestEventTargetV8Internal::namedPropertyDeleterCallback, TestEventTargetV8Internal::namedPropertyEnumeratorCallback);
desc->InstanceTemplate()->MarkAsUndetectable();
- // Custom Signature 'dispatchEvent'
- const int dispatchEventArgc = 1;
- v8::Handle<v8::FunctionTemplate> dispatchEventArgv[dispatchEventArgc] = { V8PerIsolateData::from(isolate)->rawTemplate(&V8Event::info, currentWorldType) };
- v8::Handle<v8::Signature> dispatchEventSignature = v8::Signature::New(desc, dispatchEventArgc, dispatchEventArgv);
- proto->Set(v8::String::NewSymbol("dispatchEvent"), v8::FunctionTemplate::New(TestEventTargetV8Internal::dispatchEventMethodCallback, v8Undefined(), dispatchEventSignature, 1));
-
// Custom toString template
desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
return desc;
@@ -405,18 +337,18 @@
v8::Handle<v8::Object> V8TestEventTarget::createWrapper(PassRefPtr<TestEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEventTarget>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestEventTarget>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestEventTarget::derefObject(void* object)
{
- static_cast<TestEventTarget*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestEventTarget.h b/Source/bindings/tests/results/V8TestEventTarget.h
index 67f6894..b3bbbae 100644
--- a/Source/bindings/tests/results/V8TestEventTarget.h
+++ b/Source/bindings/tests/results/V8TestEventTarget.h
@@ -21,6 +21,7 @@
#ifndef V8TestEventTarget_h
#define V8TestEventTarget_h
+#include "V8EventTarget.h"
#include "bindings/bindings/tests/idls/TestEventTarget.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8DOMWrapper.h"
@@ -35,13 +36,22 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestEventTarget* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestEventTarget*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static EventTarget* toEventTarget(v8::Handle<v8::Object>);
static const int eventListenerCacheIndex = v8DefaultWrapperInternalFieldCount + 0;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 1;
+ static inline void* toInternalPointer(TestEventTarget* impl)
+ {
+ return V8EventTarget::toInternalPointer(impl);
+ }
+
+ static inline TestEventTarget* fromInternalPointer(void* object)
+ {
+ return static_cast<TestEventTarget*>(V8EventTarget::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestEventTarget*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -59,7 +69,7 @@
inline v8::Handle<v8::Object> wrap(TestEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -73,7 +83,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestEventTarget>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -84,7 +94,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventTarget>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -95,7 +105,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestEventTarget>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -107,7 +117,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestEventTarget>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestException.cpp b/Source/bindings/tests/results/V8TestException.cpp
index f0fd19b..51d1173 100644
--- a/Source/bindings/tests/results/V8TestException.cpp
+++ b/Source/bindings/tests/results/V8TestException.cpp
@@ -127,18 +127,18 @@
v8::Handle<v8::Object> V8TestException::createWrapper(PassRefPtr<TestException> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestException>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestException>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestException::derefObject(void* object)
{
- static_cast<TestException*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestException.h b/Source/bindings/tests/results/V8TestException.h
index d2b54e5..5e91355 100644
--- a/Source/bindings/tests/results/V8TestException.h
+++ b/Source/bindings/tests/results/V8TestException.h
@@ -35,11 +35,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestException* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestException*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestException* impl)
+ {
+ return impl;
+ }
+
+ static inline TestException* fromInternalPointer(void* object)
+ {
+ return static_cast<TestException*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestException*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -57,7 +66,7 @@
inline v8::Handle<v8::Object> wrap(TestException* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestException>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -71,7 +80,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestException>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -82,7 +91,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestException>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -93,7 +102,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestException>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -105,7 +114,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestException>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestExtendedEvent.cpp b/Source/bindings/tests/results/V8TestExtendedEvent.cpp
index 453f33c..9cc2c4d 100644
--- a/Source/bindings/tests/results/V8TestExtendedEvent.cpp
+++ b/Source/bindings/tests/results/V8TestExtendedEvent.cpp
@@ -113,19 +113,18 @@
v8::Handle<v8::Object> V8TestExtendedEvent::createWrapper(PassRefPtr<Event> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
- ASSERT(static_cast<void*>(static_cast<Event*>(impl.get())) == static_cast<void*>(impl.get()));
+ ASSERT(DOMDataStore::getWrapper<V8TestExtendedEvent>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestExtendedEvent::derefObject(void* object)
{
- static_cast<Event*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestExtendedEvent.h b/Source/bindings/tests/results/V8TestExtendedEvent.h
index 0982d9e..92cc7a1 100644
--- a/Source/bindings/tests/results/V8TestExtendedEvent.h
+++ b/Source/bindings/tests/results/V8TestExtendedEvent.h
@@ -37,11 +37,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static Event* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<Event*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(Event* impl)
+ {
+ return V8TestEvent::toInternalPointer(impl);
+ }
+
+ static inline Event* fromInternalPointer(void* object)
+ {
+ return static_cast<Event*>(V8TestEvent::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, Event*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -59,7 +68,7 @@
inline v8::Handle<v8::Object> wrap(Event* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestExtendedEvent>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -73,7 +82,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestExtendedEvent>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -84,7 +93,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestExtendedEvent>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -95,7 +104,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestExtendedEvent>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -107,7 +116,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestExtendedEvent>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp
index 961296b..8c8e145 100644
--- a/Source/bindings/tests/results/V8TestInterface.cpp
+++ b/Source/bindings/tests/results/V8TestInterface.cpp
@@ -937,7 +937,7 @@
return;
}
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestInterface::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl.release(), &V8TestInterface::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -1285,18 +1285,18 @@
v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestInterface>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterface>(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
void V8TestInterface::derefObject(void* object)
{
- static_cast<TestInterface*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestInterface.h b/Source/bindings/tests/results/V8TestInterface.h
index 2e64794..cbb960f 100644
--- a/Source/bindings/tests/results/V8TestInterface.h
+++ b/Source/bindings/tests/results/V8TestInterface.h
@@ -36,7 +36,7 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestInterface* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestInterface*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -56,6 +56,15 @@
#endif // ENABLE(Condition22) || ENABLE(Condition23)
static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestInterface* impl)
+ {
+ return impl;
+ }
+
+ static inline TestInterface* fromInternalPointer(void* object)
+ {
+ return static_cast<TestInterface*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestInterface*, v8::Isolate*);
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -73,7 +82,7 @@
inline v8::Handle<v8::Object> wrap(TestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestInterface>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -87,7 +96,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterface>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -98,7 +107,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestInterface>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -109,7 +118,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestInterface>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -121,7 +130,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestInterface>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestInterfaceImplementedAs.cpp b/Source/bindings/tests/results/V8TestInterfaceImplementedAs.cpp
index 55772bf..b7619d3 100644
--- a/Source/bindings/tests/results/V8TestInterfaceImplementedAs.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceImplementedAs.cpp
@@ -229,18 +229,18 @@
v8::Handle<v8::Object> V8TestInterfaceImplementedAs::createWrapper(PassRefPtr<RealClass> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestInterfaceImplementedAs>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceImplementedAs>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestInterfaceImplementedAs::derefObject(void* object)
{
- static_cast<RealClass*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestInterfaceImplementedAs.h b/Source/bindings/tests/results/V8TestInterfaceImplementedAs.h
index 483fa12..c415c18 100644
--- a/Source/bindings/tests/results/V8TestInterfaceImplementedAs.h
+++ b/Source/bindings/tests/results/V8TestInterfaceImplementedAs.h
@@ -35,11 +35,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static RealClass* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<RealClass*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(RealClass* impl)
+ {
+ return impl;
+ }
+
+ static inline RealClass* fromInternalPointer(void* object)
+ {
+ return static_cast<RealClass*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, RealClass*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -57,7 +66,7 @@
inline v8::Handle<v8::Object> wrap(RealClass* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestInterfaceImplementedAs>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -71,7 +80,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterfaceImplementedAs>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -82,7 +91,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestInterfaceImplementedAs>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -93,7 +102,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestInterfaceImplementedAs>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -105,7 +114,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestInterfaceImplementedAs>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestMediaQueryListListener.cpp b/Source/bindings/tests/results/V8TestMediaQueryListListener.cpp
index 1738400..ebcdeb7 100644
--- a/Source/bindings/tests/results/V8TestMediaQueryListListener.cpp
+++ b/Source/bindings/tests/results/V8TestMediaQueryListListener.cpp
@@ -138,18 +138,18 @@
v8::Handle<v8::Object> V8TestMediaQueryListListener::createWrapper(PassRefPtr<TestMediaQueryListListener> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestMediaQueryListListener>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestMediaQueryListListener>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestMediaQueryListListener::derefObject(void* object)
{
- static_cast<TestMediaQueryListListener*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestMediaQueryListListener.h b/Source/bindings/tests/results/V8TestMediaQueryListListener.h
index d6a5002..9abb0a3 100644
--- a/Source/bindings/tests/results/V8TestMediaQueryListListener.h
+++ b/Source/bindings/tests/results/V8TestMediaQueryListListener.h
@@ -35,11 +35,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestMediaQueryListListener* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestMediaQueryListListener*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestMediaQueryListListener* impl)
+ {
+ return impl;
+ }
+
+ static inline TestMediaQueryListListener* fromInternalPointer(void* object)
+ {
+ return static_cast<TestMediaQueryListListener*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestMediaQueryListListener*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -57,7 +66,7 @@
inline v8::Handle<v8::Object> wrap(TestMediaQueryListListener* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestMediaQueryListListener>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -71,7 +80,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestMediaQueryListListener>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -82,7 +91,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestMediaQueryListListener>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -93,7 +102,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestMediaQueryListListener>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -105,7 +114,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestMediaQueryListListener>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestNamedConstructor.cpp b/Source/bindings/tests/results/V8TestNamedConstructor.cpp
index 1478c58..a492a01 100644
--- a/Source/bindings/tests/results/V8TestNamedConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestNamedConstructor.cpp
@@ -101,7 +101,7 @@
return;
}
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNamedConstructorConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl.release(), &V8TestNamedConstructorConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -175,18 +175,18 @@
v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestNamedConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestNamedConstructor>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
void V8TestNamedConstructor::derefObject(void* object)
{
- static_cast<TestNamedConstructor*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestNamedConstructor.h b/Source/bindings/tests/results/V8TestNamedConstructor.h
index 9322f01..cdfbe71 100644
--- a/Source/bindings/tests/results/V8TestNamedConstructor.h
+++ b/Source/bindings/tests/results/V8TestNamedConstructor.h
@@ -41,12 +41,21 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestNamedConstructor* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestNamedConstructor*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestNamedConstructor* impl)
+ {
+ return impl;
+ }
+
+ static inline TestNamedConstructor* fromInternalPointer(void* object)
+ {
+ return static_cast<TestNamedConstructor*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestNamedConstructor*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -64,7 +73,7 @@
inline v8::Handle<v8::Object> wrap(TestNamedConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestNamedConstructor>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -78,7 +87,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestNamedConstructor>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -89,7 +98,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestNamedConstructor>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -100,7 +109,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestNamedConstructor>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -112,7 +121,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestNamedConstructor>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestNode.cpp b/Source/bindings/tests/results/V8TestNode.cpp
index f89f53f..3fc0303 100644
--- a/Source/bindings/tests/results/V8TestNode.cpp
+++ b/Source/bindings/tests/results/V8TestNode.cpp
@@ -68,7 +68,7 @@
RefPtr<TestNode> impl = TestNode::create();
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNode::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl.release(), &V8TestNode::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -143,19 +143,18 @@
v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
- ASSERT(static_cast<void*>(static_cast<Node*>(impl.get())) == static_cast<void*>(impl.get()));
+ ASSERT(DOMDataStore::getWrapper<V8TestNode>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestNode>(impl, &info, wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
void V8TestNode::derefObject(void* object)
{
- static_cast<TestNode*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestNode.h b/Source/bindings/tests/results/V8TestNode.h
index 1cb5a0f..5c14cfa 100644
--- a/Source/bindings/tests/results/V8TestNode.h
+++ b/Source/bindings/tests/results/V8TestNode.h
@@ -36,13 +36,22 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestNode* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestNode*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static EventTarget* toEventTarget(v8::Handle<v8::Object>);
static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestNode* impl)
+ {
+ return V8Node::toInternalPointer(impl);
+ }
+
+ static inline TestNode* fromInternalPointer(void* object)
+ {
+ return static_cast<TestNode*>(V8Node::fromInternalPointer(object));
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestNode*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -60,7 +69,7 @@
inline v8::Handle<v8::Object> wrap(TestNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestNode>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -74,7 +83,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestNode>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -85,7 +94,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestNode>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -96,7 +105,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestNode>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -108,7 +117,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestNode>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index 52c00b4..641c26f1 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -125,7 +125,7 @@
{
TestObj* imp = V8TestObject::toNative(info.Holder());
RefPtr<TestObj> result = imp->readOnlyTestObjectAttr();
- v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
+ v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper<V8TestObject>(result.get(), info.GetIsolate())) : v8Undefined();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
if (!wrapper.IsEmpty())
@@ -2285,7 +2285,7 @@
{
TestObj* imp = V8TestObject::toNative(info.Holder());
RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute();
- v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
+ v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper<V8TestObject>(result.get(), info.GetIsolate())) : v8Undefined();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
if (!wrapper.IsEmpty())
@@ -2306,7 +2306,7 @@
{
TestObj* imp = V8TestObject::toNative(info.Holder());
RefPtr<TestObj> result = imp->perWorldReadOnlyAttribute();
- v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapperForMainWorld(result.get())) : v8Undefined();
+ v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapperForMainWorld<V8TestObject>(result.get())) : v8Undefined();
if (wrapper.IsEmpty()) {
wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
if (!wrapper.IsEmpty())
@@ -5150,7 +5150,7 @@
RefPtr<TestObj> impl = TestObj::create(testCallback);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestObject::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl.release(), &V8TestObject::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -5732,18 +5732,18 @@
v8::Handle<v8::Object> V8TestObject::createWrapper(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestObject>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestObject::derefObject(void* object)
{
- static_cast<TestObj*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestObject.h b/Source/bindings/tests/results/V8TestObject.h
index 3318c34..492cb12 100644
--- a/Source/bindings/tests/results/V8TestObject.h
+++ b/Source/bindings/tests/results/V8TestObject.h
@@ -35,7 +35,7 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestObj* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestObj*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
@@ -46,6 +46,15 @@
static void customAttrAttrGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>&);
static void customAttrAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestObj* impl)
+ {
+ return impl;
+ }
+
+ static inline TestObj* fromInternalPointer(void* object)
+ {
+ return static_cast<TestObj*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestObj*, v8::Isolate*);
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*);
private:
@@ -63,7 +72,7 @@
inline v8::Handle<v8::Object> wrap(TestObj* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestObject>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -77,7 +86,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestObject>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -88,7 +97,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -99,7 +108,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestObject>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -111,7 +120,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestObject>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp b/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp
index dc5802a..c76b5c5 100644
--- a/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp
+++ b/Source/bindings/tests/results/V8TestOverloadedConstructors.cpp
@@ -72,7 +72,7 @@
RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create(arrayBuffer);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -83,7 +83,7 @@
RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create(arrayBufferView);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -94,7 +94,7 @@
RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create(blob);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -105,7 +105,7 @@
RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create(string);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -201,18 +201,18 @@
v8::Handle<v8::Object> V8TestOverloadedConstructors::createWrapper(PassRefPtr<TestOverloadedConstructors> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestOverloadedConstructors>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestOverloadedConstructors::derefObject(void* object)
{
- static_cast<TestOverloadedConstructors*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestOverloadedConstructors.h b/Source/bindings/tests/results/V8TestOverloadedConstructors.h
index 8e0e261..10eacc3 100644
--- a/Source/bindings/tests/results/V8TestOverloadedConstructors.h
+++ b/Source/bindings/tests/results/V8TestOverloadedConstructors.h
@@ -35,12 +35,21 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestOverloadedConstructors* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestOverloadedConstructors*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestOverloadedConstructors* impl)
+ {
+ return impl;
+ }
+
+ static inline TestOverloadedConstructors* fromInternalPointer(void* object)
+ {
+ return static_cast<TestOverloadedConstructors*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestOverloadedConstructors*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -58,7 +67,7 @@
inline v8::Handle<v8::Object> wrap(TestOverloadedConstructors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestOverloadedConstructors>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -72,7 +81,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestOverloadedConstructors>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -83,7 +92,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestOverloadedConstructors>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -94,7 +103,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestOverloadedConstructors>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -106,7 +115,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestOverloadedConstructors>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.cpp b/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.cpp
index 5baf885..acf2e70 100644
--- a/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.cpp
+++ b/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.cpp
@@ -227,18 +227,18 @@
v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::createWrapper(PassRefPtr<TestSerializedScriptValueInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestSerializedScriptValueInterface>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestSerializedScriptValueInterface>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestSerializedScriptValueInterface::derefObject(void* object)
{
- static_cast<TestSerializedScriptValueInterface*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.h b/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.h
index fabbad3..c29486b 100644
--- a/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.h
+++ b/Source/bindings/tests/results/V8TestSerializedScriptValueInterface.h
@@ -36,11 +36,20 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestSerializedScriptValueInterface* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestSerializedScriptValueInterface*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestSerializedScriptValueInterface* impl)
+ {
+ return impl;
+ }
+
+ static inline TestSerializedScriptValueInterface* fromInternalPointer(void* object)
+ {
+ return static_cast<TestSerializedScriptValueInterface*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestSerializedScriptValueInterface*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -58,7 +67,7 @@
inline v8::Handle<v8::Object> wrap(TestSerializedScriptValueInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestSerializedScriptValueInterface>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -72,7 +81,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestSerializedScriptValueInterface>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -83,7 +92,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestSerializedScriptValueInterface>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -94,7 +103,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestSerializedScriptValueInterface>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -106,7 +115,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestSerializedScriptValueInterface>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/tests/results/V8TestTypedefs.cpp b/Source/bindings/tests/results/V8TestTypedefs.cpp
index 7767b9a..e846c18 100644
--- a/Source/bindings/tests/results/V8TestTypedefs.cpp
+++ b/Source/bindings/tests/results/V8TestTypedefs.cpp
@@ -506,7 +506,7 @@
RefPtr<TestTypedefs> impl = TestTypedefs::create(hello, testCallback);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestTypedefs::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8TestTypedefs::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
@@ -609,18 +609,18 @@
v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestTypedefs>(impl.get(), isolate).IsEmpty());
- v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, impl.get(), isolate);
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
installPerContextProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
void V8TestTypedefs::derefObject(void* object)
{
- static_cast<TestTypedefs*>(object)->deref();
+ fromInternalPointer(object)->deref();
}
} // namespace WebCore
diff --git a/Source/bindings/tests/results/V8TestTypedefs.h b/Source/bindings/tests/results/V8TestTypedefs.h
index fa32bbe..8df6445 100644
--- a/Source/bindings/tests/results/V8TestTypedefs.h
+++ b/Source/bindings/tests/results/V8TestTypedefs.h
@@ -35,12 +35,21 @@
static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
static TestTypedefs* toNative(v8::Handle<v8::Object> object)
{
- return reinterpret_cast<TestTypedefs*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
static void derefObject(void*);
static WrapperTypeInfo info;
static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
+ static inline void* toInternalPointer(TestTypedefs* impl)
+ {
+ return impl;
+ }
+
+ static inline TestTypedefs* fromInternalPointer(void* object)
+ {
+ return static_cast<TestTypedefs*>(object);
+ }
static void installPerContextProperties(v8::Handle<v8::Object>, TestTypedefs*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
private:
@@ -58,7 +67,7 @@
inline v8::Handle<v8::Object> wrap(TestTypedefs* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8TestTypedefs>(impl, isolate).IsEmpty());
if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
// Might be a XXXConstructor::info instead of an XXX::info. These will both have
@@ -72,7 +81,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestTypedefs>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -83,7 +92,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestTypedefs>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -94,7 +103,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestTypedefs>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -106,7 +115,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestTypedefs>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/v8/CustomElementWrapper.cpp b/Source/bindings/v8/CustomElementWrapper.cpp
index c57fe42..b1303bc 100644
--- a/Source/bindings/v8/CustomElementWrapper.cpp
+++ b/Source/bindings/v8/CustomElementWrapper.cpp
@@ -85,7 +85,7 @@
template<typename ElementType>
v8::Handle<v8::Object> CustomElementWrapper<ElementType>::wrap(PassRefPtr<ElementType> element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate, v8::Handle<v8::Object> (*createSpecificWrapper)(ElementType* element, v8::Handle<v8::Object> creationContext, v8::Isolate*))
{
- ASSERT(DOMDataStore::getWrapper(element.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8Element>(element.get(), isolate).IsEmpty());
// FIXME: creationContext.IsEmpty() should never happen. Remove
// this when callers (like InspectorController::inspect) are fixed
@@ -109,7 +109,7 @@
wrapper->SetPrototype(customElementBinding->prototype());
- V8DOMWrapper::associateObjectWithWrapper(element, customElementBinding->wrapperType(), wrapper, isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8Element>(element, customElementBinding->wrapperType(), wrapper, isolate, WrapperConfiguration::Dependent);
return wrapper;
}
diff --git a/Source/bindings/v8/DOMDataStore.h b/Source/bindings/v8/DOMDataStore.h
index d5f458d..df77068 100644
--- a/Source/bindings/v8/DOMDataStore.h
+++ b/Source/bindings/v8/DOMDataStore.h
@@ -51,7 +51,7 @@
static DOMDataStore* current(v8::Isolate*);
- template<typename T, typename HolderContainer, typename Wrappable>
+ template<typename V8T, typename T, typename HolderContainer, typename Wrappable>
static v8::Handle<v8::Object> getWrapperFast(T* object, const HolderContainer& container, Wrappable* holder)
{
// What we'd really like to check here is whether we're in the
@@ -64,37 +64,37 @@
if (ScriptWrappable::wrapperCanBeStoredInObject(object)) {
v8::Handle<v8::Object> result = ScriptWrappable::getUnsafeWrapperFromObject(object).handle();
// Security: always guard against malicious tampering.
- RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(result.IsEmpty() || result->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == static_cast<void*>(object));
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(result.IsEmpty() || result->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == V8T::toInternalPointer(object));
return result;
}
- return mainWorldStore()->m_wrapperMap.get(object);
+ return mainWorldStore()->m_wrapperMap.get(V8T::toInternalPointer(object));
}
- return current(container.GetIsolate())->get(object);
+ return current(container.GetIsolate())->template get<V8T>(object);
}
- template<typename T>
+ template<typename V8T, typename T>
static v8::Handle<v8::Object> getWrapper(T* object, v8::Isolate* isolate)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) {
if (LIKELY(!DOMWrapperWorld::isolatedWorldsExist())) {
v8::Handle<v8::Object> result = ScriptWrappable::getUnsafeWrapperFromObject(object).handle();
// Security: always guard against malicious tampering.
- RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(result.IsEmpty() || result->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == static_cast<void*>(object));
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(result.IsEmpty() || result->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == V8T::toInternalPointer(object));
return result;
}
}
- return current(isolate)->get(object);
+ return current(isolate)->template get<V8T>(object);
}
- template<typename T>
+ template<typename V8T, typename T>
static v8::Handle<v8::Object> getWrapperForMainWorld(T* object)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object))
return ScriptWrappable::getUnsafeWrapperFromObject(object).handle();
- return mainWorldStore()->get(object);
+ return mainWorldStore()->template get<V8T>(object);
}
- template<typename T>
+ template<typename V8T, typename T>
static void setWrapper(T* object, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperConfiguration& configuration)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) {
@@ -103,21 +103,21 @@
return;
}
}
- return current(isolate)->set(object, wrapper, isolate, configuration);
+ return current(isolate)->template set<V8T>(object, wrapper, isolate, configuration);
}
- template<typename T>
+ template<typename V8T, typename T>
inline v8::Handle<v8::Object> get(T* object)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld)
return ScriptWrappable::getUnsafeWrapperFromObject(object).handle();
- return m_wrapperMap.get(object);
+ return m_wrapperMap.get(V8T::toInternalPointer(object));
}
void reportMemoryUsage(MemoryObjectInfo*) const;
private:
- template<typename T>
+ template<typename V8T, typename T>
inline void set(T* object, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperConfiguration& configuration)
{
ASSERT(!!object);
@@ -126,7 +126,7 @@
ScriptWrappable::setWrapperInObject(object, wrapper, isolate, configuration);
return;
}
- m_wrapperMap.set(object, wrapper, configuration);
+ m_wrapperMap.set(V8T::toInternalPointer(object), wrapper, configuration);
}
static DOMDataStore* mainWorldStore();
diff --git a/Source/bindings/v8/SerializedScriptValue.cpp b/Source/bindings/v8/SerializedScriptValue.cpp
index 7addfa0..47b951f 100644
--- a/Source/bindings/v8/SerializedScriptValue.cpp
+++ b/Source/bindings/v8/SerializedScriptValue.cpp
@@ -2371,7 +2371,7 @@
{
Vector<DOMDataStore*>& allStores = V8PerIsolateData::current()->allStores();
for (size_t i = 0; i < allStores.size(); i++) {
- v8::Handle<v8::Object> wrapper = allStores[i]->get(object);
+ v8::Handle<v8::Object> wrapper = allStores[i]->get<V8ArrayBuffer>(object);
if (!wrapper.IsEmpty()) {
ASSERT(wrapper->IsArrayBuffer());
v8::Handle<v8::ArrayBuffer>::Cast(wrapper)->Neuter();
@@ -2383,7 +2383,7 @@
{
Vector<DOMDataStore*>& allStores = V8PerIsolateData::current()->allStores();
for (size_t i = 0; i < allStores.size(); i++) {
- v8::Handle<v8::Object> wrapper = allStores[i]->get(object);
+ v8::Handle<v8::Object> wrapper = allStores[i]->get<V8ArrayBufferView>(object);
if (!wrapper.IsEmpty())
wrapper->SetIndexedPropertiesToExternalArrayData(0, v8::kExternalByteArray, 0);
}
diff --git a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
index 10ca93f..8a34276 100644
--- a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
+++ b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
@@ -120,7 +120,7 @@
v8::Context::Scope scope(context);
v8::Isolate* isolate = context->GetIsolate();
- v8::Handle<v8::Object> receiver = DOMDataStore::current(isolate)->get(element);
+ v8::Handle<v8::Object> receiver = DOMDataStore::current(isolate)->get<V8Element>(element);
if (!receiver.IsEmpty()) {
// Swizzle the prototype of the existing wrapper. We don't need to
// worry about non-existent wrappers; they will get the right
diff --git a/Source/bindings/v8/V8DOMWrapper.h b/Source/bindings/v8/V8DOMWrapper.h
index 9e274d7..8fbfe9c 100644
--- a/Source/bindings/v8/V8DOMWrapper.h
+++ b/Source/bindings/v8/V8DOMWrapper.h
@@ -49,7 +49,7 @@
static v8::Local<v8::Object> createWrapper(v8::Handle<v8::Object> creationContext, WrapperTypeInfo*, void*, v8::Isolate*);
- template<typename T>
+ template<typename V8T, typename T>
static inline v8::Handle<v8::Object> associateObjectWithWrapper(PassRefPtr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate*, WrapperConfiguration::Lifetime);
static inline void setNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo*, void*);
static inline void clearNativeInfo(v8::Handle<v8::Object>, WrapperTypeInfo*);
@@ -75,13 +75,13 @@
wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0);
}
- template<typename T>
+ template<typename V8T, typename T>
inline v8::Handle<v8::Object> V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<T> object, WrapperTypeInfo* type, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, WrapperConfiguration::Lifetime lifetime)
{
- setNativeInfo(wrapper, type, object.get());
+ setNativeInfo(wrapper, type, V8T::toInternalPointer(object.get()));
ASSERT(maybeDOMWrapper(wrapper));
WrapperConfiguration configuration = buildWrapperConfiguration(object.get(), lifetime);
- DOMDataStore::setWrapper(object.leakRef(), wrapper, isolate, configuration);
+ DOMDataStore::setWrapper<V8T>(object.leakRef(), wrapper, isolate, configuration);
return wrapper;
}
diff --git a/Source/bindings/v8/V8WindowShell.cpp b/Source/bindings/v8/V8WindowShell.cpp
index f46e3df..998effb 100644
--- a/Source/bindings/v8/V8WindowShell.cpp
+++ b/Source/bindings/v8/V8WindowShell.cpp
@@ -329,7 +329,7 @@
v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_context.newLocal(m_isolate));
V8DOMWrapper::setNativeInfo(innerGlobalObject, &V8Window::info, window);
innerGlobalObject->SetPrototype(windowWrapper);
- V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<DOMWindow>(window), &V8Window::info, windowWrapper, m_isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8Window>(PassRefPtr<DOMWindow>(window), &V8Window::info, windowWrapper, m_isolate, WrapperConfiguration::Dependent);
DOMWrapperWorld::setInitializingWindow(false);
return true;
}
diff --git a/Source/bindings/v8/WorkerScriptController.cpp b/Source/bindings/v8/WorkerScriptController.cpp
index 05ea847..b48d044 100644
--- a/Source/bindings/v8/WorkerScriptController.cpp
+++ b/Source/bindings/v8/WorkerScriptController.cpp
@@ -124,7 +124,7 @@
return false;
}
- V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolate, WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<WorkerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolate, WrapperConfiguration::Dependent);
// Insert the object instance as the prototype of the shadow object.
v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context.newLocal(m_isolate)->Global()->GetPrototype());
diff --git a/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp b/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp
index 1542628..e5f9707 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp
+++ b/Source/bindings/v8/custom/V8ArrayBufferCustom.cpp
@@ -71,13 +71,13 @@
v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl.get());
- ASSERT(DOMDataStore::getWrapper(impl.get(), isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8ArrayBuffer>(impl.get(), isolate).IsEmpty());
v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(impl->data(), impl->byteLength());
v8::V8::AdjustAmountOfExternalAllocatedMemory(impl->byteLength());
impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
- V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
@@ -96,7 +96,7 @@
RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents);
// V8 accounts for external memory even after externalizing the buffer.
buffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance());
- V8DOMWrapper::associateObjectWithWrapper(buffer.release(), &info, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &info, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Dependent);
arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex);
ASSERT(arraybufferPtr);
diff --git a/Source/bindings/v8/custom/V8ArrayBufferCustom.h b/Source/bindings/v8/custom/V8ArrayBufferCustom.h
index 819f21e..ecdd3ef 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferCustom.h
+++ b/Source/bindings/v8/custom/V8ArrayBufferCustom.h
@@ -55,6 +55,17 @@
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount;
static void installPerContextProperties(v8::Handle<v8::Object>, ArrayBuffer*, v8::Isolate*) { }
static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
+
+ static inline void* toInternalPointer(ArrayBuffer* impl)
+ {
+ return impl;
+ }
+
+ static inline ArrayBuffer* fromInternalPointer(void* impl)
+ {
+ return static_cast<ArrayBuffer*>(impl);
+ }
+
private:
friend v8::Handle<v8::Object> wrap(ArrayBuffer*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
static v8::Handle<v8::Object> createWrapper(PassRefPtr<ArrayBuffer>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
@@ -70,7 +81,7 @@
inline v8::Handle<v8::Object> wrap(ArrayBuffer* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ ASSERT(DOMDataStore::getWrapper<V8ArrayBuffer>(impl, isolate).IsEmpty());
return V8ArrayBuffer::createWrapper(impl, creationContext, isolate);
}
@@ -78,7 +89,7 @@
{
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBuffer>(impl, isolate);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -89,7 +100,7 @@
ASSERT(worldType(isolate) == MainWorld);
if (UNLIKELY(!impl))
return v8NullWithCheck(isolate);
- v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8ArrayBuffer>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, creationContext, isolate);
@@ -100,7 +111,7 @@
{
if (UNLIKELY(!impl))
return v8::Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8ArrayBuffer>(impl, container, wrappable);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
@@ -112,7 +123,7 @@
ASSERT(worldType(container.GetIsolate()) == MainWorld);
if (UNLIKELY(!impl))
return v8Null(container.GetIsolate());
- v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8ArrayBuffer>(impl);
if (!wrapper.IsEmpty())
return wrapper;
return wrap(impl, container.Holder(), container.GetIsolate());
diff --git a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
index de14e74..8d13795 100644
--- a/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/Source/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -47,7 +47,7 @@
// Returns true if it succeeded, otherwise returns false.
bool copyElements(v8::Handle<v8::Object> destArray, v8::Handle<v8::Object> srcArray, uint32_t length, uint32_t offset, v8::Isolate*);
-template<class ArrayClass>
+template<class JavaScriptWrapperArrayType, class ArrayClass>
void wrapArrayBufferView(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, ArrayClass array, v8::ExternalArrayType arrayType, bool hasIndexer)
{
// Transform the holder into a wrapper object for the array.
@@ -55,12 +55,12 @@
if (hasIndexer)
args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent);
args.GetReturnValue().Set(wrapper);
}
// Template function used by the ArrayBufferView*Constructor callbacks.
-template<class ArrayClass, class ElementType>
+template<class ArrayClass, class ElementType, class JavaScriptWrapperArrayType>
void constructWebGLArrayWithArrayBufferArgument(const v8::FunctionCallbackInfo<v8::Value>& args, WrapperTypeInfo* type, v8::ExternalArrayType arrayType, bool hasIndexer)
{
ArrayBuffer* buf = V8ArrayBuffer::toNative(args[0]->ToObject());
@@ -104,7 +104,7 @@
return;
}
- wrapArrayBufferView(args, type, array, arrayType, hasIndexer);
+ wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, hasIndexer);
}
// Template function used by the ArrayBufferView*Constructor callbacks.
@@ -135,7 +135,7 @@
// Do not call SetIndexedPropertiesToExternalArrayData on this
// object. Not only is there no point from a performance
// perspective, but doing so causes errors in the subset() case.
- wrapArrayBufferView(args, type, array, arrayType, false);
+ wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, false);
return;
}
@@ -157,7 +157,7 @@
// See whether the first argument is a ArrayBuffer.
if (V8ArrayBuffer::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))) {
- constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType>(args, type, arrayType, true);
+ constructWebGLArrayWithArrayBufferArgument<ArrayClass, ElementType, JavaScriptWrapperArrayType>(args, type, arrayType, true);
return;
}
@@ -183,7 +183,7 @@
memcpy(array->baseAddress(), source->baseAddress(), length * sizeof(ElementType));
- wrapArrayBufferView(args, type, array, arrayType, true);
+ wrapArrayBufferView<JavaScriptWrapperArrayType>(args, type, array, arrayType, true);
return;
}
@@ -255,7 +255,7 @@
}
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<JavaScriptWrapperArrayType>(array.release(), type, wrapper, args.GetIsolate(), WrapperConfiguration::Independent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8AudioContextCustom.cpp b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
index 37accea..b9c84ff 100644
--- a/Source/bindings/v8/custom/V8AudioContextCustom.cpp
+++ b/Source/bindings/v8/custom/V8AudioContextCustom.cpp
@@ -71,7 +71,7 @@
// Transform the holder into a wrapper object for the audio context.
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(audioContext.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8AudioContext>(audioContext.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8DataViewCustom.cpp b/Source/bindings/v8/custom/V8DataViewCustom.cpp
index b8120e9..4988fdb 100644
--- a/Source/bindings/v8/custom/V8DataViewCustom.cpp
+++ b/Source/bindings/v8/custom/V8DataViewCustom.cpp
@@ -39,7 +39,7 @@
// 'new DataView()' and the call used to construct the cached DataView object.
RefPtr<DataView> dataView = DataView::create(0);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(dataView.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8DataView>(dataView.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
return;
}
@@ -47,7 +47,7 @@
throwTypeError(0, args.GetIsolate());
return;
}
- constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::kExternalByteArray, false);
+ constructWebGLArrayWithArrayBufferArgument<DataView, char, V8DataView>(args, &info, v8::kExternalByteArray, false);
}
// FIXME: Don't need this override.
diff --git a/Source/bindings/v8/custom/V8FormDataCustom.cpp b/Source/bindings/v8/custom/V8FormDataCustom.cpp
index e5bf129..81b9388 100644
--- a/Source/bindings/v8/custom/V8FormDataCustom.cpp
+++ b/Source/bindings/v8/custom/V8FormDataCustom.cpp
@@ -47,7 +47,7 @@
RefPtr<DOMFormData> domFormData = DOMFormData::create(form);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(domFormData.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8FormData>(domFormData.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index e501753..4704dea 100644
--- a/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/Source/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -82,7 +82,7 @@
RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(image.release(), &V8HTMLImageElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8HTMLImageElement>(image.release(), &V8HTMLImageElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
v8SetReturnValue(args, wrapper);
}
diff --git a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
index 475da14..e865215 100644
--- a/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
+++ b/Source/bindings/v8/custom/V8MessageChannelCustom.cpp
@@ -58,7 +58,7 @@
V8HiddenPropertyName::setNamedHiddenReference(wrapper, "port1", toV8(obj->port1(), args.Holder(), args.GetIsolate()));
V8HiddenPropertyName::setNamedHiddenReference(wrapper, "port2", toV8(obj->port2(), args.Holder(), args.GetIsolate()));
- V8DOMWrapper::associateObjectWithWrapper(obj.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8MessageChannel>(obj.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8MutationObserverCustom.cpp b/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
index 24cc5a20..7547dac 100644
--- a/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
+++ b/Source/bindings/v8/custom/V8MutationObserverCustom.cpp
@@ -60,7 +60,7 @@
RefPtr<MutationCallback> callback = V8MutationCallback::create(v8::Handle<v8::Function>::Cast(arg), context, wrapper, args.GetIsolate());
RefPtr<MutationObserver> observer = MutationObserver::create(callback.release());
- V8DOMWrapper::associateObjectWithWrapper(observer.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8MutationObserver>(observer.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8WebKitPointCustom.cpp b/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
index 98329cc..00d640f 100644
--- a/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
+++ b/Source/bindings/v8/custom/V8WebKitPointCustom.cpp
@@ -57,7 +57,7 @@
}
RefPtr<DOMPoint> point = DOMPoint::create(x, y);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(point.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8WebKitPoint>(point.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index e5071f7..5f2526d 100644
--- a/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -61,7 +61,7 @@
RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context, securityOrigin);
v8::Handle<v8::Object> wrapper = args.Holder();
- V8DOMWrapper::associateObjectWithWrapper(xmlHttpRequest.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
+ V8DOMWrapper::associateObjectWithWrapper<V8XMLHttpRequest>(xmlHttpRequest.release(), &info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
args.GetReturnValue().Set(wrapper);
}
diff --git a/Source/core/css/FontLoader.idl b/Source/core/css/FontLoader.idl
index 7e7842a..4e922c1 100644
--- a/Source/core/css/FontLoader.idl
+++ b/Source/core/css/FontLoader.idl
@@ -32,9 +32,8 @@
NoInterfaceObject,
EnabledAtRuntime=fontLoadEvents,
ActiveDOMObject,
- EventTarget,
GenerateIsReachable=document
-] interface FontLoader {
+] interface FontLoader : EventTarget {
attribute EventListener onloading;
attribute EventListener onloadingdone;
@@ -46,12 +45,4 @@
void loadFont(Dictionary params);
void notifyWhenFontsReady(VoidCallback callback);
readonly attribute boolean loading;
-
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/dom/EventTarget.idl b/Source/core/dom/EventTarget.idl
index 32af401..8647c27 100644
--- a/Source/core/dom/EventTarget.idl
+++ b/Source/core/dom/EventTarget.idl
@@ -19,7 +19,6 @@
*/
[
- NoInterfaceObject,
CustomToV8,
DoNotGenerateWrap,
EventTarget
diff --git a/Source/core/dom/MessagePort.idl b/Source/core/dom/MessagePort.idl
index 85514c2..18e7284 100644
--- a/Source/core/dom/MessagePort.idl
+++ b/Source/core/dom/MessagePort.idl
@@ -26,9 +26,8 @@
*/
[
- ActiveDOMObject,
- EventTarget
-] interface MessagePort {
+ ActiveDOMObject
+] interface MessagePort : EventTarget {
// We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one,
// but we don't want to actually expose the API while it is in flux.
[Custom, RaisesException] void postMessage(any message, optional Array messagePorts);
@@ -38,14 +37,5 @@
// event handler attributes
attribute EventListener onmessage;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/dom/WebKitNamedFlow.idl b/Source/core/dom/WebKitNamedFlow.idl
index 5a008bd..68f2858 100644
--- a/Source/core/dom/WebKitNamedFlow.idl
+++ b/Source/core/dom/WebKitNamedFlow.idl
@@ -30,23 +30,13 @@
[
NoInterfaceObject,
EnabledAtRuntime=cssRegions,
- EventTarget,
ImplementedAs=NamedFlow,
GenerateIsReachable=ownerNode
-] interface WebKitNamedFlow {
+] interface WebKitNamedFlow : EventTarget {
readonly attribute DOMString name;
readonly attribute boolean overset;
readonly attribute long firstEmptyRegionIndex;
NodeList getRegionsByContent(Node contentNode);
NodeList getRegions();
NodeList getContent();
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/core/fileapi/FileReader.idl b/Source/core/fileapi/FileReader.idl
index d551b0f..2727d12 100644
--- a/Source/core/fileapi/FileReader.idl
+++ b/Source/core/fileapi/FileReader.idl
@@ -33,9 +33,8 @@
GlobalContext=Window&WorkerGlobalScope,
ActiveDOMObject,
Constructor,
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface FileReader {
+ ConstructorCallWith=ScriptExecutionContext
+] interface FileReader : EventTarget {
// ready states
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
@@ -55,15 +54,6 @@
readonly attribute FileError error;
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
-
attribute EventListener onloadstart;
attribute EventListener onprogress;
attribute EventListener onload;
diff --git a/Source/core/html/MediaController.idl b/Source/core/html/MediaController.idl
index 54c4153..8516705 100644
--- a/Source/core/html/MediaController.idl
+++ b/Source/core/html/MediaController.idl
@@ -26,9 +26,8 @@
[
EnabledAtRuntime=media,
Constructor,
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface MediaController {
+ ConstructorCallWith=ScriptExecutionContext
+] interface MediaController : EventTarget {
readonly attribute TimeRanges buffered;
readonly attribute TimeRanges seekable;
@@ -47,13 +46,4 @@
[SetterRaisesException] attribute double volume;
attribute boolean muted;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/html/track/TextTrack.idl b/Source/core/html/track/TextTrack.idl
index c1b39ff..8b2e8aa 100644
--- a/Source/core/html/track/TextTrack.idl
+++ b/Source/core/html/track/TextTrack.idl
@@ -24,9 +24,8 @@
*/
[
- EnabledAtRuntime=videoTrack,
- EventTarget
-] interface TextTrack {
+ EnabledAtRuntime=videoTrack
+] interface TextTrack : EventTarget {
readonly attribute DOMString kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
@@ -43,13 +42,4 @@
[Conditional=WEBVTT_REGIONS] readonly attribute TextTrackRegionList regions;
[Conditional=WEBVTT_REGIONS] void addRegion(TextTrackRegion region);
[RaisesException, Conditional=WEBVTT_REGIONS] void removeRegion(TextTrackRegion region);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/html/track/TextTrackCue.idl b/Source/core/html/track/TextTrackCue.idl
index 962f695..f398a9a 100644
--- a/Source/core/html/track/TextTrackCue.idl
+++ b/Source/core/html/track/TextTrackCue.idl
@@ -26,9 +26,8 @@
[
EnabledAtRuntime=videoTrack,
Constructor(double startTime, double endTime, DOMString text),
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface TextTrackCue {
+ ConstructorCallWith=ScriptExecutionContext
+] interface TextTrackCue : EventTarget {
readonly attribute TextTrack track;
attribute DOMString id;
@@ -49,15 +48,6 @@
attribute EventListener onenter;
attribute EventListener onexit;
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
-
[Conditional=WEBVTT_REGIONS] attribute DOMString regionId;
};
diff --git a/Source/core/html/track/TextTrackList.idl b/Source/core/html/track/TextTrackList.idl
index 905efc3..a6e51b3 100644
--- a/Source/core/html/track/TextTrackList.idl
+++ b/Source/core/html/track/TextTrackList.idl
@@ -25,20 +25,11 @@
[
EnabledAtRuntime=videoTrack,
- EventTarget,
GenerateIsReachable=owner
-] interface TextTrackList {
+] interface TextTrackList : EventTarget {
readonly attribute unsigned long length;
getter TextTrack item(unsigned long index);
attribute EventListener onaddtrack;
-
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/loader/appcache/DOMApplicationCache.idl b/Source/core/loader/appcache/DOMApplicationCache.idl
index c58f5e3..057f7b5 100644
--- a/Source/core/loader/appcache/DOMApplicationCache.idl
+++ b/Source/core/loader/appcache/DOMApplicationCache.idl
@@ -25,9 +25,8 @@
[
NoInterfaceObject,
- EventTarget,
DoNotCheckConstants
-] interface DOMApplicationCache {
+] interface DOMApplicationCache : EventTarget {
// update status
const unsigned short UNCACHED = 0;
const unsigned short IDLE = 1;
@@ -50,14 +49,5 @@
attribute EventListener onupdateready;
attribute EventListener oncached;
attribute EventListener onobsolete;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/page/EventSource.idl b/Source/core/page/EventSource.idl
index 490161e..d92caa9 100644
--- a/Source/core/page/EventSource.idl
+++ b/Source/core/page/EventSource.idl
@@ -34,9 +34,8 @@
ActiveDOMObject,
Constructor(DOMString url, optional Dictionary eventSourceInit),
ConstructorCallWith=ScriptExecutionContext,
- ConstructorRaisesException,
- EventTarget
-] interface EventSource {
+ ConstructorRaisesException
+] interface EventSource : EventTarget {
readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
readonly attribute DOMString url;
@@ -53,14 +52,4 @@
attribute EventListener onmessage;
attribute EventListener onerror;
void close();
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
-
};
diff --git a/Source/core/svg/SVGElementInstance.idl b/Source/core/svg/SVGElementInstance.idl
index 083e3ed..b959465 100644
--- a/Source/core/svg/SVGElementInstance.idl
+++ b/Source/core/svg/SVGElementInstance.idl
@@ -24,9 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-[
- EventTarget
-] interface SVGElementInstance : EventTarget
+interface SVGElementInstance : EventTarget
{
readonly attribute SVGElement correspondingElement;
readonly attribute SVGUseElement correspondingUseElement;
diff --git a/Source/core/workers/WorkerGlobalScope.idl b/Source/core/workers/WorkerGlobalScope.idl
index f00ed3f..e709f70 100644
--- a/Source/core/workers/WorkerGlobalScope.idl
+++ b/Source/core/workers/WorkerGlobalScope.idl
@@ -26,10 +26,9 @@
[
GlobalContext=WorkerGlobalScope,
- EventTarget,
CustomToV8,
DoNotGenerateWrap
-] interface WorkerGlobalScope {
+] interface WorkerGlobalScope : EventTarget {
// WorkerGlobalScope
[Replaceable] readonly attribute WorkerGlobalScope self;
@@ -41,15 +40,6 @@
[Custom] void importScripts(/*[Variadic] in DOMString urls */);
[Replaceable] readonly attribute WorkerNavigator navigator;
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
-
// Additional constructors
attribute URLConstructor webkitURL; // FIXME: deprecate this.
};
diff --git a/Source/core/xml/XMLHttpRequest.idl b/Source/core/xml/XMLHttpRequest.idl
index fbe7217..bad83ca 100644
--- a/Source/core/xml/XMLHttpRequest.idl
+++ b/Source/core/xml/XMLHttpRequest.idl
@@ -41,9 +41,8 @@
ActiveDOMObject,
Constructor,
ConstructorCallWith=ScriptExecutionContext,
- CustomConstructor(optional XMLHttpRequestOptions options),
- EventTarget
-] interface XMLHttpRequest {
+ CustomConstructor(optional XMLHttpRequestOptions options)
+] interface XMLHttpRequest : EventTarget {
// From XMLHttpRequestEventTarget
// event handler attributes
attribute EventListener onabort;
@@ -93,13 +92,4 @@
// Extension
void overrideMimeType(DOMString override);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/core/xml/XMLHttpRequestUpload.idl b/Source/core/xml/XMLHttpRequestUpload.idl
index 2262201..d2170ed 100644
--- a/Source/core/xml/XMLHttpRequestUpload.idl
+++ b/Source/core/xml/XMLHttpRequestUpload.idl
@@ -26,9 +26,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-[
- EventTarget
-] interface XMLHttpRequestUpload {
+interface XMLHttpRequestUpload : EventTarget {
// From XMLHttpRequestEventTarget
// event handler attributes
attribute EventListener onabort;
@@ -37,14 +35,5 @@
attribute EventListener onloadend;
attribute EventListener onloadstart;
attribute EventListener onprogress;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/encryptedmedia/MediaKeySession.idl b/Source/modules/encryptedmedia/MediaKeySession.idl
index 57b809e..3afc689 100644
--- a/Source/modules/encryptedmedia/MediaKeySession.idl
+++ b/Source/modules/encryptedmedia/MediaKeySession.idl
@@ -25,9 +25,8 @@
[
Conditional=ENCRYPTED_MEDIA_V2,
- EnabledAtRuntime=encryptedMedia,
- EventTarget
-] interface MediaKeySession {
+ EnabledAtRuntime=encryptedMedia
+] interface MediaKeySession : EventTarget {
// error state
readonly attribute MediaKeyError error;
@@ -43,13 +42,4 @@
[EnabledAtRuntime=encryptedMedia] attribute EventListener onwebkitkeyadded;
[EnabledAtRuntime=encryptedMedia] attribute EventListener onwebkitkeyerror;
[EnabledAtRuntime=encryptedMedia] attribute EventListener onwebkitkeymessage;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/filesystem/FileWriter.idl b/Source/modules/filesystem/FileWriter.idl
index ebf71e8..9216204 100644
--- a/Source/modules/filesystem/FileWriter.idl
+++ b/Source/modules/filesystem/FileWriter.idl
@@ -31,9 +31,8 @@
[
NoInterfaceObject,
- ActiveDOMObject,
- EventTarget
-] interface FileWriter {
+ ActiveDOMObject
+] interface FileWriter : EventTarget {
// ready states
const unsigned short INIT = 0;
const unsigned short WRITING = 1;
@@ -57,13 +56,4 @@
attribute EventListener onabort;
attribute EventListener onerror;
attribute EventListener onwriteend;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/indexeddb/IDBDatabase.idl b/Source/modules/indexeddb/IDBDatabase.idl
index c6a8e28..8e87f80 100644
--- a/Source/modules/indexeddb/IDBDatabase.idl
+++ b/Source/modules/indexeddb/IDBDatabase.idl
@@ -25,9 +25,8 @@
*/
[
- ActiveDOMObject,
- EventTarget
-] interface IDBDatabase {
+ ActiveDOMObject
+] interface IDBDatabase : EventTarget {
readonly attribute DOMString name;
readonly attribute IDBAny version;
readonly attribute DOMStringList objectStoreNames;
@@ -43,13 +42,4 @@
[CallWith=ScriptExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, [Default=NullString] optional DOMString mode);
void close();
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/indexeddb/IDBOpenDBRequest.idl b/Source/modules/indexeddb/IDBOpenDBRequest.idl
index 8a8b6ab..7dbe0d1 100644
--- a/Source/modules/indexeddb/IDBOpenDBRequest.idl
+++ b/Source/modules/indexeddb/IDBOpenDBRequest.idl
@@ -23,9 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-[
- EventTarget
-] interface IDBOpenDBRequest : IDBRequest {
+interface IDBOpenDBRequest : IDBRequest {
attribute EventListener onblocked;
attribute EventListener onupgradeneeded;
};
diff --git a/Source/modules/indexeddb/IDBRequest.idl b/Source/modules/indexeddb/IDBRequest.idl
index b0b0bdb..e8f87b8 100644
--- a/Source/modules/indexeddb/IDBRequest.idl
+++ b/Source/modules/indexeddb/IDBRequest.idl
@@ -28,9 +28,8 @@
*/
[
- ActiveDOMObject,
- EventTarget
-] interface IDBRequest {
+ ActiveDOMObject
+] interface IDBRequest : EventTarget {
[GetterRaisesException] readonly attribute IDBAny result;
[GetterRaisesException] readonly attribute DOMError error;
@@ -43,13 +42,4 @@
// Events
attribute EventListener onsuccess;
attribute EventListener onerror;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/indexeddb/IDBTransaction.idl b/Source/modules/indexeddb/IDBTransaction.idl
index 912736d..9eac27f 100644
--- a/Source/modules/indexeddb/IDBTransaction.idl
+++ b/Source/modules/indexeddb/IDBTransaction.idl
@@ -25,9 +25,8 @@
*/
[
- ActiveDOMObject,
- EventTarget
-] interface IDBTransaction {
+ ActiveDOMObject
+] interface IDBTransaction : EventTarget {
// Properties
readonly attribute DOMString mode;
@@ -42,12 +41,4 @@
attribute EventListener onabort;
attribute EventListener oncomplete;
attribute EventListener onerror;
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/mediasource/MediaSource.idl b/Source/modules/mediasource/MediaSource.idl
index d0b407d..49d0fd3 100644
--- a/Source/modules/mediasource/MediaSource.idl
+++ b/Source/modules/mediasource/MediaSource.idl
@@ -31,10 +31,9 @@
[
EnabledAtRuntime=mediaSource,
ActiveDOMObject,
- EventTarget,
Constructor,
ConstructorCallWith=ScriptExecutionContext
-] interface MediaSource {
+] interface MediaSource : EventTarget {
// All the source buffers created by this object.
readonly attribute SourceBufferList sourceBuffers;
@@ -51,13 +50,4 @@
[RaisesException] void endOfStream([Default=NullString] optional DOMString error);
static boolean isTypeSupported (DOMString type);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediasource/SourceBuffer.idl b/Source/modules/mediasource/SourceBuffer.idl
index d04be71..7f368c7 100644
--- a/Source/modules/mediasource/SourceBuffer.idl
+++ b/Source/modules/mediasource/SourceBuffer.idl
@@ -31,9 +31,8 @@
[
NoInterfaceObject,
ActiveDOMObject,
- EventTarget,
EnabledAtRuntime=mediaSource
-] interface SourceBuffer {
+] interface SourceBuffer : EventTarget {
readonly attribute boolean updating;
@@ -49,14 +48,5 @@
// Abort the current segment append sequence.
[RaisesException] void abort();
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediasource/SourceBufferList.idl b/Source/modules/mediasource/SourceBufferList.idl
index 8c22965..80f231d 100644
--- a/Source/modules/mediasource/SourceBufferList.idl
+++ b/Source/modules/mediasource/SourceBufferList.idl
@@ -31,19 +31,9 @@
[
NoInterfaceObject,
EnabledAtRuntime=mediaSource,
- EventTarget,
CallWith=ScriptExecutionContext
-] interface SourceBufferList {
+] interface SourceBufferList : EventTarget {
readonly attribute unsigned long length;
getter SourceBuffer item(unsigned long index);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediasource/WebKitMediaSource.idl b/Source/modules/mediasource/WebKitMediaSource.idl
index 1bc542c..61eaa1c 100644
--- a/Source/modules/mediasource/WebKitMediaSource.idl
+++ b/Source/modules/mediasource/WebKitMediaSource.idl
@@ -32,10 +32,9 @@
NoInterfaceObject,
EnabledAtRuntime=webKitMediaSource,
ActiveDOMObject,
- EventTarget,
Constructor,
ConstructorCallWith=ScriptExecutionContext
-] interface WebKitMediaSource {
+] interface WebKitMediaSource : EventTarget {
// All the source buffers created by this object.
readonly attribute WebKitSourceBufferList sourceBuffers;
@@ -52,14 +51,5 @@
[RaisesException] void endOfStream([Default=NullString] optional DOMString error);
static boolean isTypeSupported (DOMString type);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediasource/WebKitSourceBufferList.idl b/Source/modules/mediasource/WebKitSourceBufferList.idl
index ba1768e..5acd8ca 100644
--- a/Source/modules/mediasource/WebKitSourceBufferList.idl
+++ b/Source/modules/mediasource/WebKitSourceBufferList.idl
@@ -30,19 +30,9 @@
[
NoInterfaceObject,
- EnabledAtRuntime=webKitMediaSource,
- EventTarget,
-] interface WebKitSourceBufferList {
+ EnabledAtRuntime=webKitMediaSource
+] interface WebKitSourceBufferList : EventTarget {
readonly attribute unsigned long length;
getter WebKitSourceBuffer item(unsigned long index);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediastream/MediaStream.idl b/Source/modules/mediastream/MediaStream.idl
index bd7e78f..5270472 100644
--- a/Source/modules/mediastream/MediaStream.idl
+++ b/Source/modules/mediastream/MediaStream.idl
@@ -24,12 +24,11 @@
[
NoInterfaceObject,
- EventTarget,
Constructor,
Constructor(MediaStream stream),
Constructor(MediaStreamTrack[] tracks),
ConstructorCallWith=ScriptExecutionContext
-] interface MediaStream {
+] interface MediaStream : EventTarget {
// DEPRECATED
readonly attribute DOMString label;
@@ -48,14 +47,5 @@
attribute EventListener onended;
attribute EventListener onaddtrack;
attribute EventListener onremovetrack;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediastream/MediaStreamTrack.idl b/Source/modules/mediastream/MediaStreamTrack.idl
index d02d8ed..c2df9f9 100644
--- a/Source/modules/mediastream/MediaStreamTrack.idl
+++ b/Source/modules/mediastream/MediaStreamTrack.idl
@@ -23,9 +23,8 @@
*/
[
- EventTarget,
ActiveDOMObject
-] interface MediaStreamTrack {
+] interface MediaStreamTrack : EventTarget {
readonly attribute DOMString kind;
readonly attribute DOMString id;
readonly attribute DOMString label;
@@ -38,14 +37,5 @@
attribute EventListener onended;
[CallWith=ScriptExecutionContext, RaisesException] static void getSources(MediaStreamTrackSourcesCallback callback);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediastream/RTCDTMFSender.idl b/Source/modules/mediastream/RTCDTMFSender.idl
index ff3b6da..c06a48c 100644
--- a/Source/modules/mediastream/RTCDTMFSender.idl
+++ b/Source/modules/mediastream/RTCDTMFSender.idl
@@ -25,9 +25,8 @@
[
NoInterfaceObject,
- ActiveDOMObject,
- EventTarget
-] interface RTCDTMFSender {
+ ActiveDOMObject
+] interface RTCDTMFSender : EventTarget {
readonly attribute boolean canInsertDTMF;
readonly attribute MediaStreamTrack track;
readonly attribute DOMString toneBuffer;
@@ -37,13 +36,4 @@
[RaisesException] void insertDTMF(DOMString tones, optional long duration, optional long interToneGap);
attribute EventListener ontonechange;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediastream/RTCDataChannel.idl b/Source/modules/mediastream/RTCDataChannel.idl
index b4263df..5abf290 100644
--- a/Source/modules/mediastream/RTCDataChannel.idl
+++ b/Source/modules/mediastream/RTCDataChannel.idl
@@ -23,9 +23,8 @@
*/
[
- NoInterfaceObject,
- EventTarget
-] interface RTCDataChannel {
+ NoInterfaceObject
+] interface RTCDataChannel : EventTarget {
readonly attribute DOMString label;
readonly attribute boolean reliable;
readonly attribute DOMString readyState;
@@ -44,13 +43,4 @@
attribute EventListener onerror;
attribute EventListener onclose;
attribute EventListener onmessage;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/mediastream/RTCPeerConnection.idl b/Source/modules/mediastream/RTCPeerConnection.idl
index 33daf3a..a2255c8 100644
--- a/Source/modules/mediastream/RTCPeerConnection.idl
+++ b/Source/modules/mediastream/RTCPeerConnection.idl
@@ -33,9 +33,8 @@
ActiveDOMObject,
Constructor(Dictionary rtcIceServers, optional Dictionary mediaConstraints),
ConstructorRaisesException,
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface RTCPeerConnection {
+ ConstructorCallWith=ScriptExecutionContext
+] interface RTCPeerConnection : EventTarget {
[RaisesException] void createOffer(RTCSessionDescriptionCallback successCallback, [Default=Undefined] optional RTCErrorCallback failureCallback, optional Dictionary mediaConstraints);
[RaisesException] void createAnswer(RTCSessionDescriptionCallback successCallback, [Default=Undefined] optional RTCErrorCallback failureCallback, optional Dictionary mediaConstraints);
@@ -77,14 +76,5 @@
attribute EventListener onremovestream;
attribute EventListener oniceconnectionstatechange;
attribute EventListener ondatachannel;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/notifications/Notification.idl b/Source/modules/notifications/Notification.idl
index 0d5d7f7..a8dd30a 100644
--- a/Source/modules/notifications/Notification.idl
+++ b/Source/modules/notifications/Notification.idl
@@ -32,10 +32,9 @@
[
Conditional=NOTIFICATIONS|LEGACY_NOTIFICATIONS,
ActiveDOMObject,
- EventTarget,
Constructor(DOMString title, [Default=Undefined] optional Dictionary options),
ConstructorCallWith=ScriptExecutionContext,
-] interface Notification {
+] interface Notification : EventTarget {
void show();
[Conditional=LEGACY_NOTIFICATIONS] void cancel();
[Conditional=NOTIFICATIONS] void close();
@@ -53,14 +52,5 @@
[Conditional=LEGACY_NOTIFICATIONS] attribute DOMString dir;
[Conditional=LEGACY_NOTIFICATIONS] attribute DOMString replaceId;
[Conditional=NOTIFICATIONS] attribute DOMString tag;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/speech/SpeechRecognition.idl b/Source/modules/speech/SpeechRecognition.idl
index 2baaa9d..9f6634e 100644
--- a/Source/modules/speech/SpeechRecognition.idl
+++ b/Source/modules/speech/SpeechRecognition.idl
@@ -27,9 +27,8 @@
NoInterfaceObject,
ActiveDOMObject,
Constructor,
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface SpeechRecognition {
+ ConstructorCallWith=ScriptExecutionContext
+] interface SpeechRecognition : EventTarget {
attribute SpeechGrammarList grammars;
attribute DOMString lang;
attribute boolean continuous;
@@ -51,13 +50,4 @@
attribute EventListener onerror;
attribute EventListener onstart;
attribute EventListener onend;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};
diff --git a/Source/modules/speech/SpeechSynthesisUtterance.idl b/Source/modules/speech/SpeechSynthesisUtterance.idl
index 3a9a64b..61a2a7c 100644
--- a/Source/modules/speech/SpeechSynthesisUtterance.idl
+++ b/Source/modules/speech/SpeechSynthesisUtterance.idl
@@ -25,10 +25,9 @@
[
EnabledAtRuntime=speechSynthesis,
- EventTarget,
ConstructorCallWith=ScriptExecutionContext,
Constructor([Default=NullString] optional DOMString text)
-] interface SpeechSynthesisUtterance {
+] interface SpeechSynthesisUtterance : EventTarget {
attribute DOMString text;
attribute DOMString lang;
attribute SpeechSynthesisVoice voice;
diff --git a/Source/modules/webaudio/AudioContext.idl b/Source/modules/webaudio/AudioContext.idl
index aa9f811..940e0d5 100644
--- a/Source/modules/webaudio/AudioContext.idl
+++ b/Source/modules/webaudio/AudioContext.idl
@@ -27,9 +27,8 @@
NoInterfaceObject,
Conditional=WEB_AUDIO,
ActiveDOMObject,
- CustomConstructor,
- EventTarget
-] interface AudioContext {
+ CustomConstructor
+] interface AudioContext : EventTarget {
// All rendered audio ultimately connects to destination, which represents the audio hardware.
readonly attribute AudioDestinationNode destination;
diff --git a/Source/modules/webaudio/AudioNode.idl b/Source/modules/webaudio/AudioNode.idl
index f311d27..f130889 100644
--- a/Source/modules/webaudio/AudioNode.idl
+++ b/Source/modules/webaudio/AudioNode.idl
@@ -41,14 +41,4 @@
[RaisesException] void connect(AudioParam? destination, [Default=Undefined] optional unsigned long output);
[RaisesException] void disconnect([Default=Undefined] optional unsigned long output);
-
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/webaudio/OfflineAudioContext.idl b/Source/modules/webaudio/OfflineAudioContext.idl
index 3a3e9ef..81c104e 100644
--- a/Source/modules/webaudio/OfflineAudioContext.idl
+++ b/Source/modules/webaudio/OfflineAudioContext.idl
@@ -25,7 +25,6 @@
[
NoInterfaceObject,
Conditional=WEB_AUDIO,
- EventTarget,
Constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate),
ConstructorRaisesException,
ConstructorCallWith=ScriptExecutionContext
diff --git a/Source/modules/webmidi/MIDIAccess.idl b/Source/modules/webmidi/MIDIAccess.idl
index ea5fe0a..c7a51a1 100644
--- a/Source/modules/webmidi/MIDIAccess.idl
+++ b/Source/modules/webmidi/MIDIAccess.idl
@@ -30,21 +30,11 @@
[
NoInterfaceObject,
- ActiveDOMObject,
- EventTarget
-] interface MIDIAccess {
+ ActiveDOMObject
+] interface MIDIAccess : EventTarget {
sequence<MIDIInput> inputs();
sequence<MIDIOutput> outputs();
attribute EventListener onconnect;
attribute EventListener ondisconnect;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/webmidi/MIDIInput.idl b/Source/modules/webmidi/MIDIInput.idl
index 8c0ae3c..4bf7e8f 100644
--- a/Source/modules/webmidi/MIDIInput.idl
+++ b/Source/modules/webmidi/MIDIInput.idl
@@ -30,8 +30,7 @@
[
NoInterfaceObject,
- ActiveDOMObject,
- EventTarget
+ ActiveDOMObject
] interface MIDIInput : MIDIPort {
attribute EventListener onmidimessage;
};
diff --git a/Source/modules/webmidi/MIDIPort.idl b/Source/modules/webmidi/MIDIPort.idl
index e7e2aa9..261eb7c 100644
--- a/Source/modules/webmidi/MIDIPort.idl
+++ b/Source/modules/webmidi/MIDIPort.idl
@@ -35,9 +35,8 @@
[
NoInterfaceObject,
- ActiveDOMObject,
- EventTarget
-] interface MIDIPort {
+ ActiveDOMObject
+] interface MIDIPort : EventTarget {
readonly attribute DOMString id;
readonly attribute DOMString manufacturer;
readonly attribute DOMString name;
@@ -45,13 +44,4 @@
readonly attribute DOMString version;
attribute EventListener ondisconnect;
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event event);
};
diff --git a/Source/modules/websockets/WebSocket.idl b/Source/modules/websockets/WebSocket.idl
index 7ebf523..e332465 100644
--- a/Source/modules/websockets/WebSocket.idl
+++ b/Source/modules/websockets/WebSocket.idl
@@ -36,9 +36,8 @@
Constructor(DOMString url, sequence<DOMString> protocols),
Constructor(DOMString url, DOMString protocol),
ConstructorRaisesException,
- ConstructorCallWith=ScriptExecutionContext,
- EventTarget
-] interface WebSocket {
+ ConstructorCallWith=ScriptExecutionContext
+] interface WebSocket : EventTarget {
readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
readonly attribute DOMString url;
@@ -68,13 +67,4 @@
[RaisesException] void send(DOMString data);
[RaisesException] void close([Clamp] optional unsigned short code, optional DOMString reason);
-
- // EventTarget interface
- void addEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- void removeEventListener(DOMString type,
- EventListener listener,
- optional boolean useCapture);
- [RaisesException] boolean dispatchEvent(Event evt);
};