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

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

Issue 265773010: Add initial support for [Exposed=xx] extended IDL attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/IDLExtendedAttributes.txt ('k') | Source/core/dom/MessageChannel.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/bindings/IDLExtendedAttributes.txt ('k') | Source/core/dom/MessageChannel.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698