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

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

Issue 1940253002: Disallow certain blocking DOM calls during microtask execution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 {% if method.returns_promise and method.has_exception_state %} 5 {% if method.returns_promise and method.has_exception_state %}
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
7 {% else %} 7 {% else %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
9 {% endif %} 9 {% endif %}
10 { 10 {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 {% if method.visible %} 403 {% if method.visible %}
404 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and 404 {% filter runtime_enabled(not overloads.runtime_enabled_function_all and
405 method.runtime_enabled_function) %} 405 method.runtime_enabled_function) %}
406 if ({{test}}) { 406 if ({{test}}) {
407 {% if method.measure_as and not overloads.measure_all_as %} 407 {% if method.measure_as and not overloads.measure_all_as %}
408 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); 408 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecut ionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
409 {% endif %} 409 {% endif %}
410 {% if method.deprecate_as and not overloads.deprecate_all_as %} 410 {% if method.deprecate_as and not overloads.deprecate_all_as %}
411 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), c urrentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 411 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), c urrentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
412 {% endif %} 412 {% endif %}
413 {% if method.not_during_microtasks %}
414 if (v8::MicrotasksScope::IsRunningMicrotasks(info.GetIsolate()))
415 return;
haraken 2016/05/03 12:10:50 As Elliott is suggesting in the bug, would it be b
416 {% endif %}
413 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ; 417 {{method.name}}{{method.overload_index}}Method{{world_suffix}}(info) ;
414 return; 418 return;
415 } 419 }
416 {% endfilter %} 420 {% endfilter %}
417 {% endif %} 421 {% endif %}
418 {% endfor %} 422 {% endfor %}
419 break; 423 break;
420 {% endfor %} 424 {% endfor %}
421 {% if is_partial or not overloads.has_partial_overloads %} 425 {% if is_partial or not overloads.has_partial_overloads %}
422 default: 426 default:
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} 493 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #}
490 {% if method.measure_as %} 494 {% if method.measure_as %}
491 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); 495 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
492 {% endif %} 496 {% endif %}
493 {% if method.deprecate_as %} 497 {% if method.deprecate_as %}
494 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); 498 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
495 {% endif %} 499 {% endif %}
496 {% if method.origin_trial_enabled_function %} 500 {% if method.origin_trial_enabled_function %}
497 {{check_origin_trial(method) | indent}} 501 {{check_origin_trial(method) | indent}}
498 {% endif %} 502 {% endif %}
503 {% if method.not_during_microtasks %}
504 if (v8::MicrotasksScope::IsRunningMicrotasks(info.GetIsolate()))
505 return;
506 {% endif %}
499 {% endif %}{# not method.overloads #} 507 {% endif %}{# not method.overloads #}
500 {% if world_suffix in method.activity_logging_world_list %} 508 {% if world_suffix in method.activity_logging_world_list %}
501 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 509 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
502 V8PerContextData* contextData = scriptState->perContextData(); 510 V8PerContextData* contextData = scriptState->perContextData();
503 {% if method.activity_logging_world_check %} 511 {% if method.activity_logging_world_check %}
504 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) 512 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger())
505 {% else %} 513 {% else %}
506 if (contextData && contextData->activityLogger()) { 514 if (contextData && contextData->activityLogger()) {
507 {% endif %} 515 {% endif %}
508 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{metho d.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 516 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{metho d.name}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 696 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
689 if method.overloads else 697 if method.overloads else
690 method.runtime_enabled_function) %} 698 method.runtime_enabled_function) %}
691 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 699 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
692 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 700 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
693 {% endfilter %}{# runtime_enabled() #} 701 {% endfilter %}{# runtime_enabled() #}
694 {% endfilter %}{# exposed() #} 702 {% endfilter %}{# exposed() #}
695 {% endfor %} 703 {% endfor %}
696 {% endif %} 704 {% endif %}
697 {%- endmacro %} 705 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698