Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: Source/bindings/templates/methods.cpp

Issue 77453002: IDL compiler: [CheckSecurity=Frame] interface + [DoNotCheckSecurity] members (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Other extended attribute combinations Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {% if method.name in ['addEventListener', 'removeEventListener'] %} 6 {% if method.name in ['addEventListener', 'removeEventListener'] %}
7 {{add_remove_event_listener_method(method.name) | indent}} 7 {{add_remove_event_listener_method(method.name) | indent}}
8 {% else %} 8 {% else %}
9 {% if method.number_of_required_arguments %} 9 {% if method.number_of_required_arguments %}
10 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { 10 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 {% endif %} 208 {% endif %}
209 {% if method.is_custom %} 209 {% if method.is_custom %}
210 {{v8_class_name}}::{{method.name}}MethodCustom(info); 210 {{v8_class_name}}::{{method.name}}MethodCustom(info);
211 {% else %} 211 {% else %}
212 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info); 212 {{cpp_class_name}}V8Internal::{{method.name}}Method{{world_suffix}}(info);
213 {% endif %} 213 {% endif %}
214 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 214 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
215 } 215 }
216 {% endfilter %} 216 {% endfilter %}
217 {% endmacro %} 217 {% endmacro %}
218
219
220 {##############################################################################}
221 {% macro domain_safe_method_getter(method, world_suffix) %}
222 static void {{method.name}}AttributeGetter{{world_suffix}}(const v8::PropertyCal lbackInfo<v8::Value>& info)
haraken 2013/11/20 05:04:54 AttributeGetter => AttributeGetterWithSecurityChec
223 {
224 // This is only for getting a unique pointer which we can pass to privateTem plate.
225 static int privateTemplateUniqueKey;
226 WrapperWorldType currentWorldType = worldType(info.GetIsolate());
227 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate());
228 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #}
229 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur rentWorldType, &privateTemplateUniqueKey, {{cpp_class_name}}V8Internal::{{method .name}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(V8PerIs olateData::from(info.GetIsolate())->rawTemplate(&{{v8_class_name}}::wrapperTypeI nfo, currentWorldType)), {{method.number_of_required_or_variadic_arguments}});
230
231 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class_name}}::GetTemplate(info.GetIsolate(), currentWorldType));
232 if (holder.IsEmpty()) {
233 // can only reach here by 'object.__proto__.func', and it should passed
234 // domain security check already
235 v8SetReturnValue(info, privateTemplate->GetFunction());
236 return;
237 }
238 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(holder);
239 if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecu rityError)) {
240 static int sharedTemplateUniqueKey;
241 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate( currentWorldType, &sharedTemplateUniqueKey, {{cpp_class_name}}V8Internal::{{meth od.name}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(V8Per IsolateData::from(info.GetIsolate())->rawTemplate(&{{v8_class_name}}::wrapperTyp eInfo, currentWorldType)), {{method.number_of_required_or_variadic_arguments}});
242 v8SetReturnValue(info, sharedTemplate->GetFunction());
243 return;
244 }
245
246 v8::Local<v8::Value> hiddenValue = info.This()->GetHiddenValue(v8::String::N ewSymbol("{{method.name}}"));
247 if (!hiddenValue.IsEmpty()) {
248 v8SetReturnValue(info, hiddenValue);
249 return;
250 }
251
252 v8SetReturnValue(info, privateTemplate->GetFunction());
253 }
254
255 static void {{method.name}}AttributeGetterCallback{{world_suffix}}(v8::Local<v8: :String>, const v8::PropertyCallbackInfo<v8::Value>& info)
256 {
257 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
258 {{cpp_class_name}}V8Internal::{{method.name}}AttributeGetter{{world_suffix}} (info);
259 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
260 }
261 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698