Index: Source/bindings/scripts/generate_global_constructors.py |
diff --git a/Source/bindings/scripts/generate_global_constructors.py b/Source/bindings/scripts/generate_global_constructors.py |
index a6c8598a0f050652113da52d6bda2dec86a22c16..06b90f26ce1c48ae2ae547ffdf66015426604310 100755 |
--- a/Source/bindings/scripts/generate_global_constructors.py |
+++ b/Source/bindings/scripts/generate_global_constructors.py |
@@ -25,7 +25,7 @@ import re |
import sys |
from collections import defaultdict |
-from utilities import get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl |
+from utilities import get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, get_interface_exposed_arguments, is_callback_interface_from_idl |
interface_name_to_global_names = {} |
global_name_to_constructors = defaultdict(list) |
@@ -87,13 +87,20 @@ def record_global_constructors(idl_filename): |
# associated with ECMAScript global environments whose global object |
# implements an interface that has a matching global name. |
exposed_global_names = extended_attributes.get('Exposed', 'Window').strip('()').split(',') |
- # Blink has Exposed(Arguments) form. In the form, each argument type |
- # represents the global context. |
- exposed_global_names = [name.split(' ')[0] for name in exposed_global_names] |
- new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes) |
- for exposed_global_name in exposed_global_names: |
- global_name_to_constructors[exposed_global_name].extend(new_constructors_list) |
+ exposed_arguments = get_interface_exposed_arguments(idl_file_contents) |
+ if exposed_global_names == ['Window'] and exposed_arguments is not None: |
+ for argument in exposed_arguments: |
+ if 'RuntimeEnabled' in extended_attributes: |
+ raise ValueError('RuntimeEnabled should not be used with Exposed(Arguments)') |
+ attributes = extended_attributes.copy() |
+ attributes['RuntimeEnabled'] = argument['runtime_enabled'] |
+ new_constructors_list = generate_global_constructors_list(interface_name, attributes) |
+ global_name_to_constructors[argument['exposed']].extend(new_constructors_list) |
+ else: |
+ new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes) |
+ for name in exposed_global_names: |
+ global_name_to_constructors[name].extend(new_constructors_list) |
def generate_global_constructors_list(interface_name, extended_attributes): |