15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    This file is part of the Blink open source project.
353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    This library is free software; you can redistribute it and/or
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    modify it under the terms of the GNU Library General Public
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    License as published by the Free Software Foundation; either
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    version 2 of the License, or (at your option) any later version.
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    This library is distributed in the hope that it will be useful,
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    but WITHOUT ANY WARRANTY; without even the implied warranty of
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Library General Public License for more details.
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    You should have received a copy of the GNU Library General Public License
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    along with this library; see the file COPYING.LIB.  If not, write to
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    Boston, MA 02111-1307, USA.
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)*/
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "config.h"
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "V8TestEventConstructor.h"
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "RuntimeEnabledFeatures.h"
2553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "bindings/v8/Dictionary.h"
2653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "bindings/v8/ScriptController.h"
2753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "bindings/v8/V8Binding.h"
28e52495584422c5edb5b2944981473a2e208da323Torne (Richard Coles)#include "bindings/v8/V8DOMConfiguration.h"
2953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "bindings/v8/V8DOMWrapper.h"
30e52495584422c5edb5b2944981473a2e208da323Torne (Richard Coles)#include "bindings/v8/V8ObjectConstructor.h"
3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/dom/ContextFeatures.h"
32e52495584422c5edb5b2944981473a2e208da323Torne (Richard Coles)#include "core/dom/Document.h"
3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/page/Frame.h"
34591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#include "core/platform/chromium/TraceEvent.h"
3581a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)#include "wtf/UnusedParam.h"
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace WebCore {
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
395267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static void initializeScriptWrappableForInterface(TestEventConstructor* object)
4053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles){
4153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    if (ScriptWrappable::wrapperCanBeStoredInObject(object))
4253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)        ScriptWrappable::setTypeInfoInObject(object, &V8TestEventConstructor::info);
4393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    else
4493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        ASSERT_NOT_REACHED();
4553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)}
465267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
475267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)} // namespace WebCore
485267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// In ScriptWrappable::init, the use of a local function declaration has an issue on Windows:
505267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
515267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// in the global namespace.
525267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)// (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
535267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)void webCoreInitializeScriptWrappableForInterface(WebCore::TestEventConstructor* object)
545267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles){
555267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    WebCore::initializeScriptWrappableForInterface(object);
565267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)}
575267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)
5853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)namespace WebCore {
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, 0, V8TestEventConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace TestEventConstructorV8Internal {
625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)template <typename T> void V8_USE(T) { }
645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
655267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static void attr1AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    TestEventConstructor* imp = V8TestEventConstructor::toNative(info.Holder());
683464d02a173573db42f8ee6bb07bb74fabf4f5f2Ben Murdoch    v8SetReturnValueString(info, imp->attr1(), info.GetIsolate());
695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    return;
70926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
71926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static void attr1AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
73926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
74e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
755267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    TestEventConstructorV8Internal::attr1AttrGetter(name, info);
76e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
795267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static void attr2AttrGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    TestEventConstructor* imp = V8TestEventConstructor::toNative(info.Holder());
823464d02a173573db42f8ee6bb07bb74fabf4f5f2Ben Murdoch    v8SetReturnValueString(info, imp->attr2(), info.GetIsolate());
835267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    return;
845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
865267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static void attr2AttrGetterCallback(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
88e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
895267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    TestEventConstructorV8Internal::attr2AttrGetter(name, info);
90e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
91926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
9393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
94926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
9593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    if (args.Length() < 1) {
9693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        throwNotEnoughArgumentsError(args.GetIsolate());
9793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        return;
9893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    }
995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
10093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]);
1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    TestEventConstructorInit eventInit;
1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    if (args.Length() >= 2) {
10393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate()));
1045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        if (!fillTestEventConstructorInit(eventInit, options))
10593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)            return;
1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    }
1075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    RefPtr<TestEventConstructor> event = TestEventConstructor::create(type, eventInit);
1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    v8::Handle<v8::Object> wrapper = args.Holder();
110e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    V8DOMWrapper::associateObjectWithWrapper<V8TestEventConstructor>(event.release(), &V8TestEventConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
111e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    v8SetReturnValue(args, wrapper);
1125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
113926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} // namespace TestEventConstructorV8Internal
114926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
115926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)static const V8DOMConfiguration::BatchedAttribute V8TestEventConstructorAttrs[] = {
116521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    // Attribute 'attr1'
117926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    {"attr1", TestEventConstructorV8Internal::attr1AttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
118521d96ec04ace82590870fb04353ec4f82bb150fTorne (Richard Coles)    // Attribute 'attr2'
119926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    {"attr2", TestEventConstructorV8Internal::attr2AttrGetterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
120926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)};
1215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)bool fillTestEventConstructorInit(TestEventConstructorInit& eventInit, const Dictionary& options)
1235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    options.get("attr2", eventInit.attr2);
1255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    return true;
1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
12893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)void V8TestEventConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
129926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){
130e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
13193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    if (!args.IsConstructCall()) {
13293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
13393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        return;
13493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    }
135926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
13693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
13793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        args.GetReturnValue().Set(args.Holder());
13893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)        return;
13993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    }
140926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
14193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)    TestEventConstructorV8Internal::constructor(args);
142926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)}
143926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
1445267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)static v8::Handle<v8::FunctionTemplate> ConfigureV8TestEventConstructorTemplate(v8::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
1455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
1465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    desc->ReadOnlyPrototype();
1475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    v8::Local<v8::Signature> defaultSignature;
1495267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestEventConstructor", v8::Local<v8::FunctionTemplate>(), V8TestEventConstructor::internalFieldCount,
1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        V8TestEventConstructorAttrs, WTF_ARRAY_LENGTH(V8TestEventConstructorAttrs),
151926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        0, 0, isolate, currentWorldType);
1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
1535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    desc->SetCallHandler(V8TestEventConstructor::constructorCallback);
15453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    desc->SetLength(1);
1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    // Custom toString template
1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    return desc;
1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1615267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)v8::Handle<v8::FunctionTemplate> V8TestEventConstructor::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
1625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
163926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    V8PerIsolateData* data = V8PerIsolateData::from(isolate);
164926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&info);
165926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    if (result != data->templateMap(currentWorldType).end())
1665267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)        return result->value.newLocal(isolate);
1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
168e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1695267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    v8::HandleScope handleScope(isolate);
1705267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    v8::Handle<v8::FunctionTemplate> templ =
171926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        ConfigureV8TestEventConstructorTemplate(data->rawTemplate(&info, currentWorldType), isolate, currentWorldType);
1725267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
1735267f701546148b83dfbe1d151cb184385bb5c22Torne (Richard Coles)    return handleScope.Close(templ);
1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
176926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)bool V8TestEventConstructor::HasInstance(v8::Handle<v8::Value> value, v8::Isolate* isolate, WrapperWorldType currentWorldType)
1775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
178926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    return V8PerIsolateData::from(isolate)->hasInstance(&info, value, currentWorldType);
1795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
181926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)bool V8TestEventConstructor::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::Isolate* isolate)
1825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
183926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    return V8PerIsolateData::from(isolate)->hasInstance(&info, value, MainWorld)
184926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        || V8PerIsolateData::from(isolate)->hasInstance(&info, value, IsolatedWorld)
185926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)        || V8PerIsolateData::from(isolate)->hasInstance(&info, value, WorkerWorld);
1865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
1875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
1885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
189926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)v8::Handle<v8::Object> V8TestEventConstructor::createWrapper(PassRefPtr<TestEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
191926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    ASSERT(impl.get());
192e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    ASSERT(DOMDataStore::getWrapper<V8TestEventConstructor>(impl.get(), isolate).IsEmpty());
1937757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch    if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
1947757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch        const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
1957757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch        // Might be a XXXConstructor::info instead of an XXX::info. These will both have
1967757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch        // the same object de-ref functions, though, so use that as the basis of the check.
1977757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == info.derefObjectFunction);
1987757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch    }
1997757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch
2005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
201e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &info, toInternalPointer(impl.get()), isolate);
2025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    if (UNLIKELY(wrapper.IsEmpty()))
2035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)        return wrapper;
204926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    installPerContextProperties(wrapper, impl.get(), isolate);
205e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    V8DOMWrapper::associateObjectWithWrapper<V8TestEventConstructor>(impl, &info, wrapper, isolate, WrapperConfiguration::Independent);
2065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    return wrapper;
2075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
2085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)void V8TestEventConstructor::derefObject(void* object)
2095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){
210e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    fromInternalPointer(object)->deref();
2115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}
2125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} // namespace WebCore
214