コード例 #1
0
v8::Local<v8::Signature> configureTemplate(v8::Persistent<v8::FunctionTemplate> desc,
                                           const char *interfaceName,
                                           v8::Persistent<v8::FunctionTemplate> parentClass,
                                           int fieldCount,
                                           const BatchedAttribute* attributes, 
                                           size_t attributeCount,
                                           const BatchedCallback* callbacks,
                                           size_t callbackCount)
{
    desc->SetClassName(v8::String::New(interfaceName));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    instance->SetInternalFieldCount(fieldCount);
    if (!parentClass.IsEmpty())
        desc->Inherit(parentClass);
    if (attributeCount)
        batchConfigureAttributes(instance, desc->PrototypeTemplate(),
                                 attributes, attributeCount);
    v8::Local<v8::Signature> defaultSignature = v8::Signature::New(desc);
    if (callbackCount)
        batchConfigureCallbacks(desc->PrototypeTemplate(),
                                defaultSignature,
                                static_cast<v8::PropertyAttribute>(v8::DontDelete),
                                callbacks, callbackCount);
    return defaultSignature;
}
コード例 #2
0
v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Persistent<v8::FunctionTemplate> parentClass,
    size_t fieldCount, const BatchedAttribute* attributes, size_t attributeCount, const BatchedCallback* callbacks, size_t callbackCount, v8::Isolate* isolate)
{
    functionDescriptor->SetClassName(v8::String::NewSymbol(interfaceName));
    v8::Local<v8::ObjectTemplate> instance = functionDescriptor->InstanceTemplate();
    instance->SetInternalFieldCount(fieldCount);
    if (!parentClass.IsEmpty())
        functionDescriptor->Inherit(parentClass);
    if (attributeCount)
        batchConfigureAttributes(instance, functionDescriptor->PrototypeTemplate(), attributes, attributeCount, isolate);
    v8::Local<v8::Signature> defaultSignature = v8::Signature::New(functionDescriptor);
    if (callbackCount)
        batchConfigureCallbacks(functionDescriptor->PrototypeTemplate(), defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete), callbacks, callbackCount, isolate);
    return defaultSignature;
}
コード例 #3
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8ClipboardTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "Clipboard", v8::Persistent<v8::FunctionTemplate>(), V8Clipboard::internalFieldCount,
        V8ClipboardAttrs, WTF_ARRAY_LENGTH(V8ClipboardAttrs),
        V8ClipboardCallbacks, WTF_ARRAY_LENGTH(V8ClipboardCallbacks));
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    

#if ENABLE(DATA_TRANSFER_ITEMS)
    if (RuntimeEnabledFeatures::dataTransferItemsEnabled()) {
        static const V8DOMConfiguration::BatchedAttribute attrData =\
        // Attribute 'items' (Type: 'readonly attribute' ExtAttr: 'V8EnabledAtRuntime Conditional')
        {"items", ClipboardV8Internal::itemsAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
        V8DOMConfiguration::configureAttribute(instance, proto, attrData);
    }

#endif // ENABLE(DATA_TRANSFER_ITEMS)

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #4
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TreeWalkerTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "TreeWalker",
      v8::Persistent<v8::FunctionTemplate>(), V8TreeWalker::internalFieldCount,
      TreeWalker_attrs, sizeof(TreeWalker_attrs)/sizeof(*TreeWalker_attrs),
      TreeWalker_callbacks, sizeof(TreeWalker_callbacks)/sizeof(*TreeWalker_callbacks));
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #5
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8PopStateEventTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
    v8::Local<v8::Signature> default_signature = configureTemplate(desc, "PopStateEvent",
            V8Event::GetTemplate(), V8PopStateEvent::internalFieldCount,
            PopStateEvent_attrs, sizeof(PopStateEvent_attrs)/sizeof(*PopStateEvent_attrs),
            PopStateEvent_callbacks, sizeof(PopStateEvent_callbacks)/sizeof(*PopStateEvent_callbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();


    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #6
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLMarqueeElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLMarqueeElement", V8HTMLElement::GetTemplate(), V8HTMLMarqueeElement::internalFieldCount,
        0, 0,
        HTMLMarqueeElementCallbacks, sizeof(HTMLMarqueeElementCallbacks) / sizeof(*HTMLMarqueeElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #7
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8InspectorFrontendHostTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "InspectorFrontendHost",
      v8::Persistent<v8::FunctionTemplate>(), V8InspectorFrontendHost::internalFieldCount,
      NULL, 0,
      InspectorFrontendHost_callbacks, sizeof(InspectorFrontendHost_callbacks)/sizeof(*InspectorFrontendHost_callbacks));
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #8
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8StyleMediaTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "StyleMedia", v8::Persistent<v8::FunctionTemplate>(), V8StyleMedia::internalFieldCount,
        StyleMediaAttrs, sizeof(StyleMediaAttrs) / sizeof(*StyleMediaAttrs),
        StyleMediaCallbacks, sizeof(StyleMediaCallbacks) / sizeof(*StyleMediaCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #9
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8GeolocationTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "Geolocation", v8::Persistent<v8::FunctionTemplate>(), V8Geolocation::internalFieldCount,
        0, 0,
        GeolocationCallbacks, sizeof(GeolocationCallbacks) / sizeof(*GeolocationCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #10
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SQLErrorTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SQLError", v8::Persistent<v8::FunctionTemplate>(), V8SQLError::internalFieldCount,
        SQLErrorAttrs, sizeof(SQLErrorAttrs) / sizeof(*SQLErrorAttrs),
        0, 0);
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SQLErrorConsts, sizeof(SQLErrorConsts) / sizeof(*SQLErrorConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #11
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8CSSVariablesDeclarationTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "CSSVariablesDeclaration", v8::Persistent<v8::FunctionTemplate>(), V8CSSVariablesDeclaration::internalFieldCount,
            CSSVariablesDeclarationAttrs, sizeof(CSSVariablesDeclarationAttrs) / sizeof(*CSSVariablesDeclarationAttrs),
            CSSVariablesDeclarationCallbacks, sizeof(CSSVariablesDeclarationCallbacks) / sizeof(*CSSVariablesDeclarationCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();

    setCollectionStringIndexedGetter<CSSVariablesDeclaration>(desc);

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #12
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SVGFECompositeElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SVGFECompositeElement", V8SVGElement::GetTemplate(), V8SVGFECompositeElement::internalFieldCount,
        SVGFECompositeElementAttrs, sizeof(SVGFECompositeElementAttrs) / sizeof(*SVGFECompositeElementAttrs),
        SVGFECompositeElementCallbacks, sizeof(SVGFECompositeElementCallbacks) / sizeof(*SVGFECompositeElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SVGFECompositeElementConsts, sizeof(SVGFECompositeElementConsts) / sizeof(*SVGFECompositeElementConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #13
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8MediaListTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "MediaList", v8::Persistent<v8::FunctionTemplate>(), V8MediaList::internalFieldCount,
        MediaListAttrs, sizeof(MediaListAttrs) / sizeof(*MediaListAttrs),
        MediaListCallbacks, sizeof(MediaListCallbacks) / sizeof(*MediaListCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    setCollectionStringOrNullIndexedGetter<MediaList>(desc);

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #14
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8ConnectionTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
    v8::Local<v8::Signature> default_signature = configureTemplate(desc, "Connection",
            v8::Persistent<v8::FunctionTemplate>(), V8Connection::internalFieldCount,
            Connection_attrs, sizeof(Connection_attrs)/sizeof(*Connection_attrs),
            NULL, 0);
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();

    batchConfigureConstants(desc, proto, Connection_consts, sizeof(Connection_consts)/sizeof(*Connection_consts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #15
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8WebGLUnsignedIntArrayTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "WebGLUnsignedIntArray",
      V8WebGLArray::GetTemplate(), V8WebGLUnsignedIntArray::internalFieldCount,
      NULL, 0,
      WebGLUnsignedIntArray_callbacks, sizeof(WebGLUnsignedIntArray_callbacks)/sizeof(*WebGLUnsignedIntArray_callbacks));
      desc->SetCallHandler(V8WebGLUnsignedIntArray::constructorCallback);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #16
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8DOMParserTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "DOMParser",
      v8::Persistent<v8::FunctionTemplate>(), V8DOMParser::internalFieldCount,
      NULL, 0,
      DOMParser_callbacks, sizeof(DOMParser_callbacks)/sizeof(*DOMParser_callbacks));
      desc->SetCallHandler(V8DOMParser::constructorCallback);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #17
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLAnchorElementTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "HTMLAnchorElement",
      V8HTMLElement::GetTemplate(), V8HTMLAnchorElement::internalFieldCount,
      HTMLAnchorElement_attrs, sizeof(HTMLAnchorElement_attrs)/sizeof(*HTMLAnchorElement_attrs),
      NULL, 0);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  
  proto->Set(v8::String::New("toString"), v8::FunctionTemplate::New(HTMLAnchorElementInternal::toStringCallback, v8::Handle<v8::Value>(), default_signature), static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::DontEnum));

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #18
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8XPathResultTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "XPathResult", v8::Persistent<v8::FunctionTemplate>(), V8XPathResult::internalFieldCount,
        XPathResultAttrs, sizeof(XPathResultAttrs) / sizeof(*XPathResultAttrs),
        XPathResultCallbacks, sizeof(XPathResultCallbacks) / sizeof(*XPathResultCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, XPathResultConsts, sizeof(XPathResultConsts) / sizeof(*XPathResultConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #19
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8CSSRuleListTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "CSSRuleList",
      v8::Persistent<v8::FunctionTemplate>(), V8CSSRuleList::internalFieldCount,
      CSSRuleList_attrs, sizeof(CSSRuleList_attrs)/sizeof(*CSSRuleList_attrs),
      CSSRuleList_callbacks, sizeof(CSSRuleList_callbacks)/sizeof(*CSSRuleList_callbacks));
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  
  setCollectionIndexedGetter<CSSRuleList, CSSRule>(desc, V8ClassIndex::CSSRULE);

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #20
0
ファイル: V8Float32Array.cpp プロジェクト: sinoory/webv8
static v8::Persistent<v8::FunctionTemplate> ConfigureV8Float32ArrayTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "Float32Array", V8ArrayBufferView::GetTemplate(), V8Float32Array::internalFieldCount,
        Float32ArrayAttrs, WTF_ARRAY_LENGTH(Float32ArrayAttrs),
        Float32ArrayCallbacks, WTF_ARRAY_LENGTH(Float32ArrayCallbacks));
        desc->SetCallHandler(V8Float32Array::constructorCallback);
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, Float32ArrayConsts, WTF_ARRAY_LENGTH(Float32ArrayConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #21
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLOutputElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLOutputElement", V8HTMLElement::GetTemplate(), V8HTMLOutputElement::internalFieldCount,
        HTMLOutputElementAttrs, WTF_ARRAY_LENGTH(HTMLOutputElementAttrs),
        HTMLOutputElementCallbacks, WTF_ARRAY_LENGTH(HTMLOutputElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #22
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8EventExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc) {
  v8::Local<v8::Signature> default_signature = configureTemplate(desc, "EventException",
      v8::Persistent<v8::FunctionTemplate>(), V8EventException::internalFieldCount,
      EventException_attrs, sizeof(EventException_attrs)/sizeof(*EventException_attrs),
      NULL, 0);
  v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
  v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
  
  proto->Set(v8::String::New("toString"), v8::FunctionTemplate::New(EventExceptionInternal::toStringCallback, v8::Handle<v8::Value>(), default_signature), static_cast<v8::PropertyAttribute>(v8::DontDelete|v8::DontEnum));
  batchConfigureConstants(desc, proto, EventException_consts, sizeof(EventException_consts)/sizeof(*EventException_consts));

  // Custom toString template
  desc->Set(getToStringName(), getToStringTemplate());
  return desc;
}
コード例 #23
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8XPathNSResolverTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "XPathNSResolver", v8::Persistent<v8::FunctionTemplate>(), V8XPathNSResolver::internalFieldCount,
        0, 0,
        XPathNSResolverCallbacks, WTF_ARRAY_LENGTH(XPathNSResolverCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #24
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLObjectElementTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLObjectElement", V8HTMLElement::GetTemplate(), V8HTMLObjectElement::internalFieldCount,
        HTMLObjectElementAttrs, sizeof(HTMLObjectElementAttrs) / sizeof(*HTMLObjectElementAttrs),
        HTMLObjectElementCallbacks, sizeof(HTMLObjectElementCallbacks) / sizeof(*HTMLObjectElementCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    desc->InstanceTemplate()->SetIndexedPropertyHandler(V8HTMLObjectElement::indexedPropertyGetter, V8HTMLObjectElement::indexedPropertySetter, 0, 0);
    desc->InstanceTemplate()->SetNamedPropertyHandler(V8HTMLObjectElement::namedPropertyGetter, V8HTMLObjectElement::namedPropertySetter, 0, 0, 0);
    desc->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLObjectElement::callAsFunctionCallback);

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #25
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8SQLExceptionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "SQLException", v8::Persistent<v8::FunctionTemplate>(), V8SQLException::internalFieldCount,
        SQLExceptionAttrs, WTF_ARRAY_LENGTH(SQLExceptionAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    batchConfigureConstants(desc, proto, SQLExceptionConsts, WTF_ARRAY_LENGTH(SQLExceptionConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #26
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8WorkerLocationTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "WorkerLocation", v8::Persistent<v8::FunctionTemplate>(), V8WorkerLocation::internalFieldCount,
        WorkerLocationAttrs, WTF_ARRAY_LENGTH(WorkerLocationAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    proto->Set(v8::String::New("toString"), v8::FunctionTemplate::New(WorkerLocationInternal::toStringCallback, v8::Handle<v8::Value>(), defaultSignature), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #27
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8WebKitCSSTransformValueTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "WebKitCSSTransformValue", V8CSSValueList::GetTemplate(), V8WebKitCSSTransformValue::internalFieldCount,
        WebKitCSSTransformValueAttrs, WTF_ARRAY_LENGTH(WebKitCSSTransformValueAttrs),
        0, 0);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    setCollectionIndexedGetter<WebKitCSSTransformValue, CSSValue>(desc);
    batchConfigureConstants(desc, proto, WebKitCSSTransformValueConsts, WTF_ARRAY_LENGTH(WebKitCSSTransformValueConsts));

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
コード例 #28
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestMediaQueryListListenerTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestMediaQueryListListener", v8::Persistent<v8::FunctionTemplate>(), V8TestMediaQueryListListener::internalFieldCount,
        0, 0,
        V8TestMediaQueryListListenerMethods, WTF_ARRAY_LENGTH(V8TestMediaQueryListListenerMethods), isolate, currentWorldType);
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}
コード例 #29
0
static v8::Persistent<v8::FunctionTemplate> ConfigureV8HTMLCollectionTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "HTMLCollection", v8::Persistent<v8::FunctionTemplate>(), V8HTMLCollection::internalFieldCount,
        HTMLCollectionAttrs, WTF_ARRAY_LENGTH(HTMLCollectionAttrs),
        HTMLCollectionCallbacks, WTF_ARRAY_LENGTH(HTMLCollectionCallbacks));
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    
    setCollectionIndexedGetter<HTMLCollection, Node>(desc);
    desc->InstanceTemplate()->SetNamedPropertyHandler(V8HTMLCollection::namedPropertyGetter, 0, 0, 0, 0);
    desc->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);

    // Custom toString template
    desc->Set(getToStringName(), getToStringTemplate());
    return desc;
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8InjectedScriptHostTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
    desc->ReadOnlyPrototype();

    v8::Local<v8::Signature> defaultSignature;
    defaultSignature = V8DOMConfiguration::configureTemplate(desc, "InjectedScriptHost", v8::Persistent<v8::FunctionTemplate>(), V8InjectedScriptHost::internalFieldCount,
        0, 0,
        V8InjectedScriptHostCallbacks, WTF_ARRAY_LENGTH(V8InjectedScriptHostCallbacks));
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
    v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
    v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
    UNUSED_PARAM(instance); // In some cases, it will not be used.
    UNUSED_PARAM(proto); // In some cases, it will not be used.
    

    // Custom toString template
    desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
    return desc;
}