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

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: Fix comments 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..3889f132077826bf8919a616c33eef62c38aeb03 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,15 @@ 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.
+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 +73,12 @@ def record_global_constructors(idl_filename):
'NoInterfaceObject' in extended_attributes):
return
- global_contexts = extended_attributes.get('GlobalContext', 'Window').split('&')
+ # FIXME: In spec names are comma-separated, but that makes parsing very
+ # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
+ 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