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

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

Issue 424163002: Enable the WebIDL [Exposed] annotation on an interface's members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove some noise Created 6 years, 5 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
Index: Source/bindings/scripts/v8_utilities.py
diff --git a/Source/bindings/scripts/v8_utilities.py b/Source/bindings/scripts/v8_utilities.py
index 674a1b8d9969b08a53404147c1c7e289db1f73f4..990af2a33cdeef6b93b4030b9c8db4063a1208f6 100644
--- a/Source/bindings/scripts/v8_utilities.py
+++ b/Source/bindings/scripts/v8_utilities.py
@@ -225,6 +225,32 @@ def deprecate_as(member):
return extended_attributes['DeprecateAs']
+# [Exposed]
+def exposed(definition_or_member, interface):
+ extended_attributes = definition_or_member.extended_attributes
+ if 'Exposed' not in extended_attributes:
+ return None
+
+ # FIXME: [Exposed] is an extended attribute, the value of which should be parsed
+ # as |ExtendedAttributeIdentList| per the WebIDL parsing rules.
Peter Beverloo 2014/07/29 17:40:26 Note: This was resolved 12 hours ago, and hasn't b
+ exposure_set = set(extended_attributes['Exposed'].split('&'))
bashi 2014/07/30 00:34:34 extended_attributes['Exposed'].split('[|&]') ? I
Peter Beverloo 2014/07/30 14:48:15 I added |sorted_extended_attribute_set| for the ge
+ interface_exposure_set = ('Window') # Default value
Jens Widell 2014/07/29 18:24:29 This ought to be ['Window'] or ('Window',). You're
Peter Beverloo 2014/07/30 14:48:15 Heh, thanks! Done
+
+ interface_extended_attributes = interface.extended_attributes
+ if 'Exposed' in interface_extended_attributes:
+ interface_exposure_set = interface_extended_attributes['Exposed'].split('&')
+
+ # Methods must not be exposed to a broader scope than their interface.
+ if not exposure_set.issubset(interface_exposure_set):
+ raise Exception('Interface members\' exposure sets must be a subset of the interface\'s.')
+
+ exposure_checks = []
+ for environment in exposure_set:
+ exposure_checks.append('context->is%s()' % environment)
Peter Beverloo 2014/07/29 17:40:26 Do we have a canonical way of checking what kind o
haraken 2014/07/29 20:13:10 As far as I know, we currently don't have such met
Peter Beverloo 2014/07/30 14:48:15 Done.
+
+ return ' || '.join(exposure_checks)
Peter Beverloo 2014/07/29 17:40:26 Is this the correct layer to join the checks toget
Jens Widell 2014/07/29 18:24:29 You ought to sort somehow here, otherwise code gen
Peter Beverloo 2014/07/30 14:48:15 Done.
+
+
# [GarbageCollected], [WillBeGarbageCollected]
def gc_type(definition):
extended_attributes = definition.extended_attributes

Powered by Google App Engine
This is Rietveld 408576698