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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.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/methods.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp
index 0ebe28af715ef708c165bda384d0836663ed42bf..c3805dcbd7cf17271c1580d42439f6e6f5588b33 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp
@@ -233,7 +233,11 @@ if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) {
{% if method.is_call_with_script_state or method.is_call_with_this_value %}
{# [ConstructorCallWith=ScriptState] #}
{# [CallWith=ScriptState] #}
-ScriptState* scriptState = ScriptState::forHolderObject(info);
+{% if method.is_static %}
+ScriptState* scriptState = ScriptState::forFunctionObject(info);
+{% else %}
+ScriptState* scriptState = ScriptState::forReceiverObject(info);
+{% endif %}
{% endif %}
{% if method.is_call_with_execution_context %}
{# [ConstructorCallWith=ExecutionContext] #}
@@ -502,7 +506,11 @@ static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall
{% endif %}
{% endif %}{# not method.overloads #}
{% if world_suffix in method.activity_logging_world_list %}
- ScriptState* scriptState = ScriptState::forHolderObject(info);
+ {% if method.is_static %}
+ ScriptState* scriptState = ScriptState::forFunctionObject(info);
+ {% else %}
+ ScriptState* scriptState = ScriptState::forReceiverObject(info);
+ {% endif %}
V8PerContextData* contextData = scriptState->perContextData();
{% if method.activity_logging_world_check %}
if (scriptState->world().isIsolatedWorld() && contextData && contextData->activityLogger())

Powered by Google App Engine
This is Rietveld 408576698