- a/Source/WebCore/ChangeLog +45 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2012-08-20  Kentaro Hara  <haraken@chromium.org>
2
3
        [V8] Remove String::New() from V8 binding (Part 1)
4
        https://bugs.webkit.org/show_bug.cgi?id=94574
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Currently, V8 binding mixes String::New(), String::NewSymbol() and v8String().
9
        String::New() should be replaced with String::NewSymbol() or v8String(),
10
        depending on use cases:
11
12
        - If it is a symbol (e.g. attribute name, constant string, etc),
13
        String::NewSymbol() should be used. Cache of created symbols is managed by V8.
14
15
        - If it is not a symbol, v8String() should be used. Cache of created strings
16
        is managed by V8 binding (i.e. StringCache class).
17
18
        This patch replaces String::New() for symbols with String::NewSymbol().
19
20
        No tests. No change in behavior.
21
22
        * bindings/scripts/CodeGeneratorV8.pm:
23
        (GenerateNamedConstructorCallback):
24
        (GenerateNonStandardFunction):
25
        (GenerateImplementation):
26
        * bindings/scripts/test/V8/V8Float64Array.cpp:
27
        (WebCore::ConfigureV8Float64ArrayTemplate):
28
        * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
29
        (WebCore::ConfigureV8TestActiveDOMObjectTemplate):
30
        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
31
        (WebCore::ConfigureV8TestEventTargetTemplate):
32
        * bindings/scripts/test/V8/V8TestInterface.cpp:
33
        (WebCore::ConfigureV8TestInterfaceTemplate):
34
        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
35
        (WebCore::V8TestNamedConstructorConstructor::GetTemplate):
36
        * bindings/scripts/test/V8/V8TestObj.cpp:
37
        (WebCore::ConfigureV8TestObjTemplate):
38
        (WebCore::V8TestObj::installPerContextProperties):
39
        * bindings/v8/V8DOMConfiguration.cpp:
40
        (WebCore::V8DOMConfiguration::batchConfigureConstants):
41
        (WebCore::V8DOMConfiguration::batchConfigureCallbacks):
42
        (WebCore::V8DOMConfiguration::configureTemplate):
43
        * bindings/v8/V8DOMConfiguration.h:
44
        (WebCore::V8DOMConfiguration::configureAttribute):
45
1
2012-08-20  Shinya Kawanaka  <shinyak@chromium.org>
46
2012-08-20  Shinya Kawanaka  <shinyak@chromium.org>
2
47
3
        ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.
48
        ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.
- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm -7 / +7 lines
Lines 2098-2104 v8::Persistent<v8::FunctionTemplate> V8${implClassName}Constructor::GetTemplate( a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec1
2098
2098
2099
    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
2099
    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
2100
    instance->SetInternalFieldCount(V8${implClassName}::internalFieldCount);
2100
    instance->SetInternalFieldCount(V8${implClassName}::internalFieldCount);
2101
    result->SetClassName(v8::String::New("${implClassName}"));
2101
    result->SetClassName(v8::String::NewSymbol("${implClassName}"));
2102
    result->Inherit(V8${implClassName}::GetTemplate());
2102
    result->Inherit(V8${implClassName}::GetTemplate());
2103
2103
2104
    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
2104
    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
Lines 2298-2304 sub GenerateNonStandardFunction a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec2
2298
        push(@implContent, <<END);
2298
        push(@implContent, <<END);
2299
2299
2300
    // $commentInfo
2300
    // $commentInfo
2301
    ${conditional}$template->SetAccessor(v8::String::New("$name"), ${interfaceName}V8Internal::${name}AttrGetter, ${interfaceName}V8Internal::${interfaceName}DomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>($property_attributes));
2301
    ${conditional}$template->SetAccessor(v8::String::NewSymbol("$name"), ${interfaceName}V8Internal::${name}AttrGetter, ${interfaceName}V8Internal::${interfaceName}DomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>($property_attributes));
2302
END
2302
END
2303
        return;
2303
        return;
2304
    }
2304
    }
Lines 2329-2335 END a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec3
2329
    my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
2329
    my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
2330
    push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
2330
    push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
2331
2331
2332
    push(@implContent, "    ${conditional}$template->Set(v8::String::New(\"$name\"), v8::FunctionTemplate::New($callback, v8Undefined(), ${signature})$property_attributes);\n");
2332
    push(@implContent, "    ${conditional}$template->Set(v8::String::NewSymbol(\"$name\"), v8::FunctionTemplate::New($callback, v8Undefined(), ${signature})$property_attributes);\n");
2333
2333
2334
    push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
2334
    push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
2335
}
2335
}
Lines 2951-2959 END a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec4
2951
2951
2952
    // For security reasons, these functions are on the instance instead
2952
    // For security reasons, these functions are on the instance instead
2953
    // of on the prototype object to ensure that they cannot be overwritten.
2953
    // of on the prototype object to ensure that they cannot be overwritten.
2954
    instance->SetAccessor(v8::String::New("reload"), V8Location::reloadAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2954
    instance->SetAccessor(v8::String::NewSymbol("reload"), V8Location::reloadAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2955
    instance->SetAccessor(v8::String::New("replace"), V8Location::replaceAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2955
    instance->SetAccessor(v8::String::NewSymbol("replace"), V8Location::replaceAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2956
    instance->SetAccessor(v8::String::New("assign"), V8Location::assignAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2956
    instance->SetAccessor(v8::String::NewSymbol("assign"), V8Location::assignAccessorGetter, 0, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
2957
END
2957
END
2958
    }
2958
    }
2959
2959
Lines 3040-3046 END a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm_sec5
3040
                my $name = $runtimeFunc->signature->name;
3040
                my $name = $runtimeFunc->signature->name;
3041
                my $callback = GetFunctionTemplateCallbackName($runtimeFunc, $interfaceName);
3041
                my $callback = GetFunctionTemplateCallbackName($runtimeFunc, $interfaceName);
3042
                push(@implContent, <<END);
3042
                push(@implContent, <<END);
3043
        proto->Set(v8::String::New("${name}"), v8::FunctionTemplate::New(${callback}, v8Undefined(), defaultSignature)->GetFunction());
3043
        proto->Set(v8::String::NewSymbol("${name}"), v8::FunctionTemplate::New(${callback}, v8Undefined(), defaultSignature)->GetFunction());
3044
END
3044
END
3045
                push(@implContent, "    }\n");
3045
                push(@implContent, "    }\n");
3046
                push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
3046
                push(@implContent, "#endif // ${conditionalString}\n") if $conditionalString;
- a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp -1 / +1 lines
Lines 107-113 static v8::Persistent<v8::FunctionTemplate> ConfigureV8Float64ArrayTemplate(v8:: a/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp_sec1
107
    const int fooArgc = 1;
107
    const int fooArgc = 1;
108
    v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { V8Float32Array::GetRawTemplate() };
108
    v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { V8Float32Array::GetRawTemplate() };
109
    v8::Handle<v8::Signature> fooSignature = v8::Signature::New(desc, fooArgc, fooArgv);
109
    v8::Handle<v8::Signature> fooSignature = v8::Signature::New(desc, fooArgc, fooArgv);
110
    proto->Set(v8::String::New("foo"), v8::FunctionTemplate::New(Float64ArrayV8Internal::fooCallback, v8Undefined(), fooSignature));
110
    proto->Set(v8::String::NewSymbol("foo"), v8::FunctionTemplate::New(Float64ArrayV8Internal::fooCallback, v8Undefined(), fooSignature));
111
111
112
    // Custom toString template
112
    // Custom toString template
113
    desc->Set(getToStringName(), getToStringTemplate());
113
    desc->Set(getToStringName(), getToStringTemplate());
- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp -2 / +2 lines
Lines 134-143 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestActiveDOMObjectTempla a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp_sec1
134
    const int excitingFunctionArgc = 1;
134
    const int excitingFunctionArgc = 1;
135
    v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] = { V8Node::GetRawTemplate() };
135
    v8::Handle<v8::FunctionTemplate> excitingFunctionArgv[excitingFunctionArgc] = { V8Node::GetRawTemplate() };
136
    v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(desc, excitingFunctionArgc, excitingFunctionArgv);
136
    v8::Handle<v8::Signature> excitingFunctionSignature = v8::Signature::New(desc, excitingFunctionArgc, excitingFunctionArgv);
137
    proto->Set(v8::String::New("excitingFunction"), v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::excitingFunctionCallback, v8Undefined(), excitingFunctionSignature));
137
    proto->Set(v8::String::NewSymbol("excitingFunction"), v8::FunctionTemplate::New(TestActiveDOMObjectV8Internal::excitingFunctionCallback, v8Undefined(), excitingFunctionSignature));
138
138
139
    // Function 'postMessage' (ExtAttr: 'DoNotCheckSecurity')
139
    // Function 'postMessage' (ExtAttr: 'DoNotCheckSecurity')
140
    proto->SetAccessor(v8::String::New("postMessage"), TestActiveDOMObjectV8Internal::postMessageAttrGetter, TestActiveDOMObjectV8Internal::TestActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete));
140
    proto->SetAccessor(v8::String::NewSymbol("postMessage"), TestActiveDOMObjectV8Internal::postMessageAttrGetter, TestActiveDOMObjectV8Internal::TestActiveDOMObjectDomainSafeFunctionSetter, v8Undefined(), v8::ALL_CAN_READ, static_cast<v8::PropertyAttribute>(v8::DontDelete));
141
141
142
    // Custom toString template
142
    // Custom toString template
143
    desc->Set(getToStringName(), getToStringTemplate());
143
    desc->Set(getToStringName(), getToStringTemplate());
- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp -1 / +1 lines
Lines 131-137 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestEventTargetTemplate(v a/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp_sec1
131
    const int dispatchEventArgc = 1;
131
    const int dispatchEventArgc = 1;
132
    v8::Handle<v8::FunctionTemplate> dispatchEventArgv[dispatchEventArgc] = { V8Event::GetRawTemplate() };
132
    v8::Handle<v8::FunctionTemplate> dispatchEventArgv[dispatchEventArgc] = { V8Event::GetRawTemplate() };
133
    v8::Handle<v8::Signature> dispatchEventSignature = v8::Signature::New(desc, dispatchEventArgc, dispatchEventArgv);
133
    v8::Handle<v8::Signature> dispatchEventSignature = v8::Signature::New(desc, dispatchEventArgc, dispatchEventArgv);
134
    proto->Set(v8::String::New("dispatchEvent"), v8::FunctionTemplate::New(TestEventTargetV8Internal::dispatchEventCallback, v8Undefined(), dispatchEventSignature));
134
    proto->Set(v8::String::NewSymbol("dispatchEvent"), v8::FunctionTemplate::New(TestEventTargetV8Internal::dispatchEventCallback, v8Undefined(), dispatchEventSignature));
135
135
136
    // Custom toString template
136
    // Custom toString template
137
    desc->Set(getToStringName(), getToStringTemplate());
137
    desc->Set(getToStringName(), getToStringTemplate());
- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp -2 / +2 lines
Lines 295-304 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8: a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp_sec1
295
    v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2Argc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
295
    v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2Argc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
296
    v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(desc, supplementalMethod2Argc, supplementalMethod2Argv);
296
    v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(desc, supplementalMethod2Argc, supplementalMethod2Argv);
297
#if ENABLE(Condition11) || ENABLE(Condition12)
297
#if ENABLE(Condition11) || ENABLE(Condition12)
298
    proto->Set(v8::String::New("supplementalMethod2"), v8::FunctionTemplate::New(TestInterfaceV8Internal::supplementalMethod2Callback, v8Undefined(), supplementalMethod2Signature));
298
    proto->Set(v8::String::NewSymbol("supplementalMethod2"), v8::FunctionTemplate::New(TestInterfaceV8Internal::supplementalMethod2Callback, v8Undefined(), supplementalMethod2Signature));
299
#endif // ENABLE(Condition11) || ENABLE(Condition12)
299
#endif // ENABLE(Condition11) || ENABLE(Condition12)
300
#if ENABLE(Condition11) || ENABLE(Condition12)
300
#if ENABLE(Condition11) || ENABLE(Condition12)
301
    desc->Set(v8::String::New("supplementalMethod4"), v8::FunctionTemplate::New(TestInterfaceV8Internal::supplementalMethod4Callback, v8Undefined(), v8::Local<v8::Signature>()));
301
    desc->Set(v8::String::NewSymbol("supplementalMethod4"), v8::FunctionTemplate::New(TestInterfaceV8Internal::supplementalMethod4Callback, v8Undefined(), v8::Local<v8::Signature>()));
302
#endif // ENABLE(Condition11) || ENABLE(Condition12)
302
#endif // ENABLE(Condition11) || ENABLE(Condition12)
303
    V8DOMConfiguration::batchConfigureConstants(desc, proto, TestInterfaceConsts, WTF_ARRAY_LENGTH(TestInterfaceConsts));
303
    V8DOMConfiguration::batchConfigureConstants(desc, proto, TestInterfaceConsts, WTF_ARRAY_LENGTH(TestInterfaceConsts));
304
304
- a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp -1 / +1 lines
Lines 95-101 v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTempl a/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp_sec1
95
95
96
    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
96
    v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
97
    instance->SetInternalFieldCount(V8TestNamedConstructor::internalFieldCount);
97
    instance->SetInternalFieldCount(V8TestNamedConstructor::internalFieldCount);
98
    result->SetClassName(v8::String::New("TestNamedConstructor"));
98
    result->SetClassName(v8::String::NewSymbol("TestNamedConstructor"));
99
    result->Inherit(V8TestNamedConstructor::GetTemplate());
99
    result->Inherit(V8TestNamedConstructor::GetTemplate());
100
100
101
    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
101
    cachedTemplate = v8::Persistent<v8::FunctionTemplate>::New(result);
- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp -17 / +17 lines
Lines 2192-2256 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp_sec1
2192
    const int voidMethodWithArgsArgc = 3;
2192
    const int voidMethodWithArgsArgc = 3;
2193
    v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2193
    v8::Handle<v8::FunctionTemplate> voidMethodWithArgsArgv[voidMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2194
    v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
2194
    v8::Handle<v8::Signature> voidMethodWithArgsSignature = v8::Signature::New(desc, voidMethodWithArgsArgc, voidMethodWithArgsArgv);
2195
    proto->Set(v8::String::New("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::voidMethodWithArgsCallback, v8Undefined(), voidMethodWithArgsSignature));
2195
    proto->Set(v8::String::NewSymbol("voidMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::voidMethodWithArgsCallback, v8Undefined(), voidMethodWithArgsSignature));
2196
2196
2197
    // Custom Signature 'MethodWithArgs'
2197
    // Custom Signature 'MethodWithArgs'
2198
    const int MethodWithArgsArgc = 3;
2198
    const int MethodWithArgsArgc = 3;
2199
    v8::Handle<v8::FunctionTemplate> MethodWithArgsArgv[MethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2199
    v8::Handle<v8::FunctionTemplate> MethodWithArgsArgv[MethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2200
    v8::Handle<v8::Signature> MethodWithArgsSignature = v8::Signature::New(desc, MethodWithArgsArgc, MethodWithArgsArgv);
2200
    v8::Handle<v8::Signature> MethodWithArgsSignature = v8::Signature::New(desc, MethodWithArgsArgc, MethodWithArgsArgv);
2201
    proto->Set(v8::String::New("MethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::MethodWithArgsCallback, v8Undefined(), MethodWithArgsSignature));
2201
    proto->Set(v8::String::NewSymbol("MethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::MethodWithArgsCallback, v8Undefined(), MethodWithArgsSignature));
2202
2202
2203
    // Custom Signature 'objMethodWithArgs'
2203
    // Custom Signature 'objMethodWithArgs'
2204
    const int objMethodWithArgsArgc = 3;
2204
    const int objMethodWithArgsArgc = 3;
2205
    v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2205
    v8::Handle<v8::FunctionTemplate> objMethodWithArgsArgv[objMethodWithArgsArgc] = { v8::Handle<v8::FunctionTemplate>(), v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2206
    v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
2206
    v8::Handle<v8::Signature> objMethodWithArgsSignature = v8::Signature::New(desc, objMethodWithArgsArgc, objMethodWithArgsArgv);
2207
    proto->Set(v8::String::New("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::objMethodWithArgsCallback, v8Undefined(), objMethodWithArgsSignature));
2207
    proto->Set(v8::String::NewSymbol("objMethodWithArgs"), v8::FunctionTemplate::New(TestObjV8Internal::objMethodWithArgsCallback, v8Undefined(), objMethodWithArgsSignature));
2208
2208
2209
    // Custom Signature 'methodWithSequenceArg'
2209
    // Custom Signature 'methodWithSequenceArg'
2210
    const int methodWithSequenceArgArgc = 1;
2210
    const int methodWithSequenceArgArgc = 1;
2211
    v8::Handle<v8::FunctionTemplate> methodWithSequenceArgArgv[methodWithSequenceArgArgc] = { V8sequence<ScriptProfile>::GetRawTemplate() };
2211
    v8::Handle<v8::FunctionTemplate> methodWithSequenceArgArgv[methodWithSequenceArgArgc] = { V8sequence<ScriptProfile>::GetRawTemplate() };
2212
    v8::Handle<v8::Signature> methodWithSequenceArgSignature = v8::Signature::New(desc, methodWithSequenceArgArgc, methodWithSequenceArgArgv);
2212
    v8::Handle<v8::Signature> methodWithSequenceArgSignature = v8::Signature::New(desc, methodWithSequenceArgArgc, methodWithSequenceArgArgv);
2213
    proto->Set(v8::String::New("methodWithSequenceArg"), v8::FunctionTemplate::New(TestObjV8Internal::methodWithSequenceArgCallback, v8Undefined(), methodWithSequenceArgSignature));
2213
    proto->Set(v8::String::NewSymbol("methodWithSequenceArg"), v8::FunctionTemplate::New(TestObjV8Internal::methodWithSequenceArgCallback, v8Undefined(), methodWithSequenceArgSignature));
2214
2214
2215
    // Custom Signature 'methodThatRequiresAllArgsAndThrows'
2215
    // Custom Signature 'methodThatRequiresAllArgsAndThrows'
2216
    const int methodThatRequiresAllArgsAndThrowsArgc = 2;
2216
    const int methodThatRequiresAllArgsAndThrowsArgc = 2;
2217
    v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2217
    v8::Handle<v8::FunctionTemplate> methodThatRequiresAllArgsAndThrowsArgv[methodThatRequiresAllArgsAndThrowsArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestObj::GetRawTemplate() };
2218
    v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
2218
    v8::Handle<v8::Signature> methodThatRequiresAllArgsAndThrowsSignature = v8::Signature::New(desc, methodThatRequiresAllArgsAndThrowsArgc, methodThatRequiresAllArgsAndThrowsArgv);
2219
    proto->Set(v8::String::New("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback, v8Undefined(), methodThatRequiresAllArgsAndThrowsSignature));
2219
    proto->Set(v8::String::NewSymbol("methodThatRequiresAllArgsAndThrows"), v8::FunctionTemplate::New(TestObjV8Internal::methodThatRequiresAllArgsAndThrowsCallback, v8Undefined(), methodThatRequiresAllArgsAndThrowsSignature));
2220
    desc->Set(v8::String::New("classMethod"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodCallback, v8Undefined(), v8::Local<v8::Signature>()));
2220
    desc->Set(v8::String::NewSymbol("classMethod"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodCallback, v8Undefined(), v8::Local<v8::Signature>()));
2221
    desc->Set(v8::String::New("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodWithOptionalCallback, v8Undefined(), v8::Local<v8::Signature>()));
2221
    desc->Set(v8::String::NewSymbol("classMethodWithOptional"), v8::FunctionTemplate::New(TestObjV8Internal::classMethodWithOptionalCallback, v8Undefined(), v8::Local<v8::Signature>()));
2222
    desc->Set(v8::String::New("classMethod2"), v8::FunctionTemplate::New(V8TestObj::classMethod2Callback, v8Undefined(), v8::Local<v8::Signature>()));
2222
    desc->Set(v8::String::NewSymbol("classMethod2"), v8::FunctionTemplate::New(V8TestObj::classMethod2Callback, v8Undefined(), v8::Local<v8::Signature>()));
2223
#if ENABLE(Condition1)
2223
#if ENABLE(Condition1)
2224
    desc->Set(v8::String::New("overloadedMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::overloadedMethod1Callback, v8Undefined(), v8::Local<v8::Signature>()));
2224
    desc->Set(v8::String::NewSymbol("overloadedMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::overloadedMethod1Callback, v8Undefined(), v8::Local<v8::Signature>()));
2225
#endif // ENABLE(Condition1)
2225
#endif // ENABLE(Condition1)
2226
    if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
2226
    if (RuntimeEnabledFeatures::enabledAtRuntimeMethod1Enabled())
2227
        proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod1Callback, v8Undefined(), defaultSignature));
2227
        proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod1Callback, v8Undefined(), defaultSignature));
2228
    if (RuntimeEnabledFeatures::featureNameEnabled())
2228
    if (RuntimeEnabledFeatures::featureNameEnabled())
2229
        proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2Callback, v8Undefined(), defaultSignature));
2229
        proto->Set(v8::String::NewSymbol("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledAtRuntimeMethod2Callback, v8Undefined(), defaultSignature));
2230
2230
2231
    // Custom Signature 'convert1'
2231
    // Custom Signature 'convert1'
2232
    const int convert1Argc = 1;
2232
    const int convert1Argc = 1;
2233
    v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
2233
    v8::Handle<v8::FunctionTemplate> convert1Argv[convert1Argc] = { V8a::GetRawTemplate() };
2234
    v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv);
2234
    v8::Handle<v8::Signature> convert1Signature = v8::Signature::New(desc, convert1Argc, convert1Argv);
2235
    proto->Set(v8::String::New("convert1"), v8::FunctionTemplate::New(TestObjV8Internal::convert1Callback, v8Undefined(), convert1Signature));
2235
    proto->Set(v8::String::NewSymbol("convert1"), v8::FunctionTemplate::New(TestObjV8Internal::convert1Callback, v8Undefined(), convert1Signature));
2236
2236
2237
    // Custom Signature 'convert2'
2237
    // Custom Signature 'convert2'
2238
    const int convert2Argc = 1;
2238
    const int convert2Argc = 1;
2239
    v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() };
2239
    v8::Handle<v8::FunctionTemplate> convert2Argv[convert2Argc] = { V8b::GetRawTemplate() };
2240
    v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv);
2240
    v8::Handle<v8::Signature> convert2Signature = v8::Signature::New(desc, convert2Argc, convert2Argv);
2241
    proto->Set(v8::String::New("convert2"), v8::FunctionTemplate::New(TestObjV8Internal::convert2Callback, v8Undefined(), convert2Signature));
2241
    proto->Set(v8::String::NewSymbol("convert2"), v8::FunctionTemplate::New(TestObjV8Internal::convert2Callback, v8Undefined(), convert2Signature));
2242
2242
2243
    // Custom Signature 'convert4'
2243
    // Custom Signature 'convert4'
2244
    const int convert4Argc = 1;
2244
    const int convert4Argc = 1;
2245
    v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() };
2245
    v8::Handle<v8::FunctionTemplate> convert4Argv[convert4Argc] = { V8d::GetRawTemplate() };
2246
    v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv);
2246
    v8::Handle<v8::Signature> convert4Signature = v8::Signature::New(desc, convert4Argc, convert4Argv);
2247
    proto->Set(v8::String::New("convert4"), v8::FunctionTemplate::New(TestObjV8Internal::convert4Callback, v8Undefined(), convert4Signature));
2247
    proto->Set(v8::String::NewSymbol("convert4"), v8::FunctionTemplate::New(TestObjV8Internal::convert4Callback, v8Undefined(), convert4Signature));
2248
2248
2249
    // Custom Signature 'convert5'
2249
    // Custom Signature 'convert5'
2250
    const int convert5Argc = 1;
2250
    const int convert5Argc = 1;
2251
    v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() };
2251
    v8::Handle<v8::FunctionTemplate> convert5Argv[convert5Argc] = { V8e::GetRawTemplate() };
2252
    v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv);
2252
    v8::Handle<v8::Signature> convert5Signature = v8::Signature::New(desc, convert5Argc, convert5Argv);
2253
    proto->Set(v8::String::New("convert5"), v8::FunctionTemplate::New(TestObjV8Internal::convert5Callback, v8Undefined(), convert5Signature));
2253
    proto->Set(v8::String::NewSymbol("convert5"), v8::FunctionTemplate::New(TestObjV8Internal::convert5Callback, v8Undefined(), convert5Signature));
2254
    V8DOMConfiguration::batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
2254
    V8DOMConfiguration::batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
2255
2255
2256
    // Custom toString template
2256
    // Custom toString template
Lines 2310-2319 void V8TestObj::installPerContextProperties(v8::Handle<v8::Object> instance, Tes a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp_sec2
2310
    v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate());
2310
    v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate());
2311
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
2311
    UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
2312
    if (ContextFeatures::enabledPerContextMethod1Enabled(impl->document())) {
2312
    if (ContextFeatures::enabledPerContextMethod1Enabled(impl->document())) {
2313
        proto->Set(v8::String::New("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1Callback, v8Undefined(), defaultSignature)->GetFunction());
2313
        proto->Set(v8::String::NewSymbol("enabledPerContextMethod1"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod1Callback, v8Undefined(), defaultSignature)->GetFunction());
2314
    }
2314
    }
2315
    if (ContextFeatures::featureNameEnabled(impl->document())) {
2315
    if (ContextFeatures::featureNameEnabled(impl->document())) {
2316
        proto->Set(v8::String::New("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2Callback, v8Undefined(), defaultSignature)->GetFunction());
2316
        proto->Set(v8::String::NewSymbol("enabledPerContextMethod2"), v8::FunctionTemplate::New(TestObjV8Internal::enabledPerContextMethod2Callback, v8Undefined(), defaultSignature)->GetFunction());
2317
    }
2317
    }
2318
}
2318
}
2319
2319
- a/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp -4 / +4 lines
Lines 49-56 void V8DOMConfiguration::batchConfigureConstants(v8::Handle<v8::FunctionTemplate a/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp_sec1
49
{
49
{
50
    for (size_t i = 0; i < constantCount; ++i) {
50
    for (size_t i = 0; i < constantCount; ++i) {
51
        const BatchedConstant* constant = &constants[i];
51
        const BatchedConstant* constant = &constants[i];
52
        functionDescriptor->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
52
        functionDescriptor->Set(v8::String::NewSymbol(constant->name), v8Integer(constant->value), v8::ReadOnly);
53
        prototype->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
53
        prototype->Set(v8::String::NewSymbol(constant->name), v8Integer(constant->value), v8::ReadOnly);
54
    }
54
    }
55
}
55
}
56
56
Lines 61-67 void V8DOMConfiguration::batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> a/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp_sec2
61
                                                 size_t callbackCount)
61
                                                 size_t callbackCount)
62
{
62
{
63
    for (size_t i = 0; i < callbackCount; ++i)
63
    for (size_t i = 0; i < callbackCount; ++i)
64
        prototype->Set(v8::String::New(callbacks[i].name), v8::FunctionTemplate::New(callbacks[i].callback, v8Undefined(), signature), attributes);
64
        prototype->Set(v8::String::NewSymbol(callbacks[i].name), v8::FunctionTemplate::New(callbacks[i].callback, v8Undefined(), signature), attributes);
65
}
65
}
66
66
67
v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8::FunctionTemplate> functionDescriptor,
67
v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8::FunctionTemplate> functionDescriptor,
Lines 73-79 v8::Local<v8::Signature> V8DOMConfiguration::configureTemplate(v8::Persistent<v8 a/Source/WebCore/bindings/v8/V8DOMConfiguration.cpp_sec3
73
                                                               const BatchedCallback* callbacks,
73
                                                               const BatchedCallback* callbacks,
74
                                                               size_t callbackCount)
74
                                                               size_t callbackCount)
75
{
75
{
76
    functionDescriptor->SetClassName(v8::String::New(interfaceName));
76
    functionDescriptor->SetClassName(v8::String::NewSymbol(interfaceName));
77
    v8::Local<v8::ObjectTemplate> instance = functionDescriptor->InstanceTemplate();
77
    v8::Local<v8::ObjectTemplate> instance = functionDescriptor->InstanceTemplate();
78
    instance->SetInternalFieldCount(fieldCount);
78
    instance->SetInternalFieldCount(fieldCount);
79
    if (!parentClass.IsEmpty())
79
    if (!parentClass.IsEmpty())
- a/Source/WebCore/bindings/v8/V8DOMConfiguration.h -1 / +1 lines
Lines 63-69 public: a/Source/WebCore/bindings/v8/V8DOMConfiguration.h_sec1
63
                                          v8::Handle<ObjectOrTemplate> prototype,
63
                                          v8::Handle<ObjectOrTemplate> prototype,
64
                                          const BatchedAttribute& attribute)
64
                                          const BatchedAttribute& attribute)
65
    {
65
    {
66
        (attribute.onPrototype ? prototype : instance)->SetAccessor(v8::String::New(attribute.name),
66
        (attribute.onPrototype ? prototype : instance)->SetAccessor(v8::String::NewSymbol(attribute.name),
67
                                                                    attribute.getter,
67
                                                                    attribute.getter,
68
                                                                    attribute.setter,
68
                                                                    attribute.setter,
69
                                                                    v8::External::Wrap(attribute.data),
69
                                                                    v8::External::Wrap(attribute.data),

Return to Bug 94574