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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_methods.py

Issue 2207423002: Implement '[SecureContext]' IDL attribute for interfaces, methods and attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 4 years, 4 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 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ]) 50 ])
51 51
52 52
53 def method_is_visible(method, interface_is_partial): 53 def method_is_visible(method, interface_is_partial):
54 if 'overloads' in method: 54 if 'overloads' in method:
55 return method['overloads']['visible'] and not (method['overloads']['has_ partial_overloads'] and interface_is_partial) 55 return method['overloads']['visible'] and not (method['overloads']['has_ partial_overloads'] and interface_is_partial)
56 return method['visible'] and 'overload_index' not in method 56 return method['visible'] and 'overload_index' not in method
57 57
58 58
59 def conditionally_exposed(method): 59 def conditionally_exposed(method):
60 return method['overloads']['exposed_test_all'] if 'overloads' in method else method['exposed_test'] 60 exposed = method['overloads']['exposed_test_all'] if 'overloads' in method e lse method['exposed_test']
61 secure_context = method['overloads']['secure_context_test_all'] if 'overload s' in method else method['secure_context_test']
62 return exposed or secure_context
61 63
62 64
63 def filter_conditionally_exposed(methods, interface_is_partial): 65 def filter_conditionally_exposed(methods, interface_is_partial):
64 return [method for method in methods if ( 66 return [method for method in methods if (
65 method_is_visible(method, interface_is_partial) and conditionally_expose d(method))] 67 method_is_visible(method, interface_is_partial) and conditionally_expose d(method))]
66 68
67 69
68 def custom_registration(method): 70 def custom_registration(method):
69 if 'overloads' in method: 71 if 'overloads' in method:
70 return (method['overloads']['has_custom_registration_all'] or 72 return (method['overloads']['has_custom_registration_all'] or
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 'on_interface': v8_utilities.on_interface(interface, method), 247 'on_interface': v8_utilities.on_interface(interface, method),
246 'on_prototype': v8_utilities.on_prototype(interface, method), 248 'on_prototype': v8_utilities.on_prototype(interface, method),
247 'only_exposed_to_private_script': is_only_exposed_to_private_script, 249 'only_exposed_to_private_script': is_only_exposed_to_private_script,
248 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(method), # [OriginTrialEnabled] 250 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(method), # [OriginTrialEnabled]
249 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth od), # [OriginTrialEnabled] 251 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(meth od), # [OriginTrialEnabled]
250 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 252 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
251 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'), 253 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', bailout_return_value='false'),
252 'property_attributes': property_attributes(interface, method), 254 'property_attributes': property_attributes(interface, method),
253 'returns_promise': method.returns_promise, 255 'returns_promise': method.returns_promise,
254 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] 256 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled]
257 'secure_context_test': v8_utilities.secure_context(method, interface), # [SecureContext]
255 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 258 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
256 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult, 259 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res ult,
257 'use_local_result': use_local_result(method), 260 'use_local_result': use_local_result(method),
258 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 261 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
259 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 262 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
260 'visible': is_visible, 263 'visible': is_visible,
261 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings], 264 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings],
262 } 265 }
263 266
264 267
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 return method.idl_type and method.idl_type.name == 'Promise' 523 return method.idl_type and method.idl_type.name == 'Promise'
521 524
522 IdlOperation.returns_promise = property(method_returns_promise) 525 IdlOperation.returns_promise = property(method_returns_promise)
523 526
524 527
525 def argument_conversion_needs_exception_state(method, argument): 528 def argument_conversion_needs_exception_state(method, argument):
526 idl_type = argument.idl_type 529 idl_type = argument.idl_type
527 return (idl_type.v8_conversion_needs_exception_state or 530 return (idl_type.v8_conversion_needs_exception_state or
528 argument.is_variadic or 531 argument.is_variadic or
529 (method.returns_promise and idl_type.is_string_type)) 532 (method.returns_promise and idl_type.is_string_type))
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/v8_interface.py ('k') | third_party/WebKit/Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698