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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_methods.py

Issue 2439013002: Implement cross-origin attributes using access check interceptors. (Closed)
Patch Set: Clean up named enumerator interceptor. Created 4 years 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/scripts/v8_methods.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_methods.py b/third_party/WebKit/Source/bindings/scripts/v8_methods.py
index 92e9646601b674f8af43ce3c5f2a366e84fe724d..ef22d7187a60037147cc600b5c09808d27d47f53 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_methods.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_methods.py
@@ -43,13 +43,6 @@ from v8_utilities import (has_extended_attribute_value, is_unforgeable,
is_legacy_interface_type_checking)
-# Methods with any of these require custom method registration code in the
-# interface's configure*Template() function.
-CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
- 'DoNotCheckSecurity',
-])
-
-
def method_is_visible(method, interface_is_partial):
if 'overloads' in method:
return method['overloads']['visible'] and not (method['overloads']['has_partial_overloads'] and interface_is_partial)
@@ -68,12 +61,15 @@ def filter_conditionally_exposed(methods, interface_is_partial):
def custom_registration(method):
+ # TODO(dcheng): Custom registration shouldn't be necessary with cross-origin
+ # interceptors, but v8 doesn't support querying the incumbent context. For
+ # now, always use custom registration for these methods.
+ if method['is_cross_origin']:
+ return True
if 'overloads' in method:
- return (method['overloads']['has_custom_registration_all'] or
- method['overloads']['runtime_determined_lengths'] or
+ return (method['overloads']['runtime_determined_lengths'] or
(method['overloads']['runtime_enabled_function_all'] and not conditionally_exposed(method)))
- return (method['has_custom_registration'] or
- (method['runtime_enabled_function'] and not conditionally_exposed(method)))
+ return method['runtime_enabled_function'] and not conditionally_exposed(method)
def filter_custom_registration(methods, interface_is_partial):
@@ -149,10 +145,10 @@ def method_context(interface, method, is_visible=True):
includes.add('bindings/core/v8/ScriptState.h')
# [CheckSecurity]
- is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes
+ is_cross_origin = 'CrossOrigin' in extended_attributes
is_check_security_for_receiver = (
has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and
- not is_do_not_check_security)
+ not is_cross_origin)
is_check_security_for_return_value = (
has_extended_attribute_value(method, 'CheckSecurity', 'ReturnValue'))
if is_check_security_for_receiver or is_check_security_for_return_value:
@@ -190,17 +186,9 @@ def method_context(interface, method, is_visible=True):
if idl_type.is_explicit_nullable else idl_type.cpp_type),
'cpp_value': this_cpp_value,
'cpp_type_initializer': idl_type.cpp_type_initializer,
- 'custom_registration_extended_attributes':
- CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection(
- extended_attributes.iterkeys()),
'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs]
'do_not_test_new_object': 'DoNotTestNewObject' in extended_attributes,
'exposed_test': v8_utilities.exposed(method, interface), # [Exposed]
- # TODO(yukishiino): Retire has_custom_registration flag. Should be
- # replaced with V8DOMConfiguration::PropertyLocationConfiguration.
- 'has_custom_registration':
- v8_utilities.has_extended_attribute(
- method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
'has_exception_state':
is_raises_exception or
is_check_security_for_receiver or
@@ -218,12 +206,12 @@ def method_context(interface, method, is_visible=True):
'is_ce_reactions': is_ce_reactions,
'is_check_security_for_receiver': is_check_security_for_receiver,
'is_check_security_for_return_value': is_check_security_for_return_value,
+ 'is_cross_origin': 'CrossOrigin' in extended_attributes,
'is_custom': 'Custom' in extended_attributes and
not (is_custom_call_prologue or is_custom_call_epilogue),
'is_custom_call_prologue': is_custom_call_prologue,
'is_custom_call_epilogue': is_custom_call_epilogue,
'is_custom_element_callbacks': is_custom_element_callbacks,
- 'is_do_not_check_security': is_do_not_check_security,
'is_explicit_nullable': idl_type.is_explicit_nullable,
'is_implemented_in_private_script': is_implemented_in_private_script,
'is_new_object': 'NewObject' in extended_attributes,

Powered by Google App Engine
This is Rietveld 408576698