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

Unified Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2880713002: Support combination of [OriginTrialEnabled] and [SecureContext] (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
index f57a236adea40be7d879a36661d1f522ec1c3918..0d0bab2c97359e0a8705c8af2a232ddb39abc53a 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -704,8 +704,13 @@ void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ALLOW_UNUSED_LOCAL(signature);
{% endif %}
+ {% if feature.needs_secure_context %}
+ ExecutionContext* executionContext = ToExecutionContext(isolate->GetCurrentContext());
+ bool isSecureContext = (executionContext && executionContext->IsSecureContext());
+ {% endif %}{# needs secure context #}
{# Origin-Trial-enabled attributes #}
{% for attribute in feature.attributes %}
+ {% filter secure_context(attribute.secure_context_test, 'isSecureContext') %}
{% if attribute.is_data_type_property %}
static const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration[] = {
{{attribute_configuration(attribute) | indent(2)}}
@@ -719,6 +724,7 @@ void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons
for (const auto& accessorConfig : accessor{{attribute.name}}Configuration)
V8DOMConfiguration::InstallAccessor(isolate, world, instance, prototype, interface, signature, accessorConfig);
{% endif %}
+ {% endfilter %}{# secure_context #}
{% endfor %}
{# Origin-Trial-enabled constants #}
{% for constant in feature.constants %}
@@ -728,12 +734,14 @@ void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons
{% endfor %}
{# Origin-Trial-enabled methods (no overloads) #}
{% for method in feature.methods %}
+ {% filter secure_context(method.secure_context_test, 'isSecureContext') %}
{% set method_name = method.name.title().replace('_', '') %}
static const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configuration[] = {
{{method_configuration(method) | indent(2)}}
};
for (const auto& methodConfig : method{{method_name}}Configuration)
V8DOMConfiguration::InstallMethod(isolate, world, instance, prototype, interface, signature, methodConfig);
+ {% endfilter %}{# secure_context #}
{% endfor %}
}
@@ -771,7 +779,7 @@ void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::C
{% endif %}
v8::Isolate* isolate = context->GetIsolate();
- {% if has_conditional_attributes_on_prototype or methods | conditionally_exposed(is_partial) %}
+ {% if has_conditional_attributes_on_prototype or conditionally_enabled_methods %}
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ExecutionContext* executionContext = ToExecutionContext(context);
DCHECK(executionContext);
@@ -794,7 +802,7 @@ void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::C
{% if has_conditional_attributes_on_prototype %}
{{install_conditionally_enabled_attributes_on_prototype() | indent(2)}}
{% endif %}
-{% if methods | conditionally_exposed(is_partial) %}
+{% if conditionally_enabled_methods %}
{{install_conditionally_enabled_methods() | indent(2)}}
{% endif %}
}

Powered by Google App Engine
This is Rietveld 408576698