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 cf501f3d44d7b6070e26ba8760981cf64e23969e..1ec076b4d7889798e69382b773c6025bead2a984 100755 |
--- a/Source/bindings/scripts/generate_global_constructors.py |
+++ b/Source/bindings/scripts/generate_global_constructors.py |
@@ -11,7 +11,8 @@ Concretely these are implemented as "constructor attributes", meaning |
hence "global constructors" for short. |
For reference on global objects, see: |
-http://www.chromium.org/blink/webidl/blink-idl-extended-attributes#TOC-GlobalContext-i- |
+http://heycam.github.io/webidl/#Global |
+http://heycam.github.io/webidl/#Exposed |
Design document: http://www.chromium.org/developers/design-documents/idl-build |
""" |
@@ -48,6 +49,14 @@ def parse_options(): |
return options, args |
+# Global name: http://heycam.github.io/webidl/#dfn-global-name |
+# FIXME: We should add support for [Global=xx] extended attribute instead of hard-coding this mapping. |
Nils Barth (inactive)
2014/05/02 02:49:48
Could you wrap the comment?
(No need to open a bug
Inactive
2014/05/02 03:08:37
Done.
|
+def global_name_to_interface_name(global_name): |
+ if global_name.endswith('Worker'): |
+ return global_name + 'GlobalScope' |
+ return global_name |
+ |
+ |
def record_global_constructors(idl_filename): |
interface_name, _ = os.path.splitext(os.path.basename(idl_filename)) |
full_path = os.path.realpath(idl_filename) |
@@ -63,9 +72,11 @@ def record_global_constructors(idl_filename): |
'NoInterfaceObject' in extended_attributes): |
return |
- global_contexts = extended_attributes.get('GlobalContext', 'Window').split('&') |
+ # FIXME: Web IDL says the global names are comma-separated. |
Nils Barth (inactive)
2014/05/02 02:49:48
Could you note which that is a problem, and link t
Inactive
2014/05/02 03:08:37
Done.
|
+ global_names = extended_attributes.get('Exposed', 'Window').split('&') |
new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes) |
- for interface_name in global_contexts: |
+ for global_name in global_names: |
+ interface_name = global_name_to_interface_name(global_name) |
global_objects[interface_name]['constructors'].extend(new_constructors_list) |