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

Unified Diff: Source/bindings/scripts/generate_global_constructors.py

Issue 771323004: Expose Fetch API related classes to Window and WorkerGlobalScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@exposed-runtime-enabled
Patch Set: Created 6 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: 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):

Powered by Google App Engine
This is Rietveld 408576698