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

Unified Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp

Issue 2199643003: binding: Uses the current context if attribute/method is static. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/attributes.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp b/third_party/WebKit/Source/bindings/templates/attributes.cpp
index be5b5ea2f838e08ab4e161064eb0c940defeba26..f5b93e47c4e23085f0ef311d08084e2dff9f0a5c 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp
@@ -62,7 +62,11 @@ const v8::FunctionCallbackInfo<v8::Value>& info
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
{% endif %}
{% if attribute.is_call_with_script_state %}
- ScriptState* scriptState = ScriptState::forHolderObject(info);
+ {% if attribute.is_static %}
+ ScriptState* scriptState = ScriptState::forFunctionObject(info);
+ {% else %}
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ {% endif %}
{% endif %}
{% if (attribute.is_check_security_for_receiver and
not attribute.is_data_type_property) or
@@ -193,7 +197,11 @@ const v8::FunctionCallbackInfo<v8::Value>& info
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeGetter')}});
{% endif %}
{% if world_suffix in attribute.activity_logging_world_list_for_getter %}
- ScriptState* scriptState = ScriptState::forHolderObject(info);
+ {% if attribute.is_static %}
+ ScriptState* scriptState = ScriptState::forFunctionObject(info);
+ {% else %}
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ {% endif %}
V8PerContextData* contextData = scriptState->perContextData();
{% if attribute.activity_logging_world_check %}
if (scriptState->world().isIsolatedWorld() && contextData && contextData->activityLogger())
@@ -342,7 +350,11 @@ v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
{% endif %}
{% if attribute.is_call_with_script_state %}
- ScriptState* scriptState = ScriptState::forHolderObject(info);
+ {% if attribute.is_static %}
+ ScriptState* scriptState = ScriptState::forFunctionObject(info);
+ {% else %}
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ {% endif %}
{% endif %}
{# Set #}
{% if attribute.cpp_setter %}
@@ -378,7 +390,11 @@ const v8::FunctionCallbackInfo<v8::Value>& info
UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeSetter')}});
{% endif %}
{% if world_suffix in attribute.activity_logging_world_list_for_setter %}
- ScriptState* scriptState = ScriptState::forHolderObject(info);
+ {% if attribute.is_static %}
+ ScriptState* scriptState = ScriptState::forFunctionObject(info);
+ {% else %}
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ {% endif %}
V8PerContextData* contextData = scriptState->perContextData();
{% if attribute.activity_logging_world_check %}
if (scriptState->world().isIsolatedWorld() && contextData && contextData->activityLogger()) {
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptState.h ('k') | third_party/WebKit/Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698