| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 'LogAllWorlds' not in extended_attributes): | 193 'LogAllWorlds' not in extended_attributes): |
| 194 return True | 194 return True |
| 195 return False | 195 return False |
| 196 | 196 |
| 197 | 197 |
| 198 # [CallWith] | 198 # [CallWith] |
| 199 CALL_WITH_ARGUMENTS = { | 199 CALL_WITH_ARGUMENTS = { |
| 200 'ScriptState': 'scriptState', | 200 'ScriptState': 'scriptState', |
| 201 'ExecutionContext': 'executionContext', | 201 'ExecutionContext': 'executionContext', |
| 202 'ScriptArguments': 'scriptArguments', | 202 'ScriptArguments': 'scriptArguments', |
| 203 'CurrentWindow': 'currentDOMWindow(info.GetIsolate())', | 203 'CurrentWindow': 'CurrentDOMWindow(info.GetIsolate())', |
| 204 'EnteredWindow': 'enteredDOMWindow(info.GetIsolate())', | 204 'EnteredWindow': 'EnteredDOMWindow(info.GetIsolate())', |
| 205 'Document': 'document', | 205 'Document': 'document', |
| 206 'ThisValue': 'ScriptValue(scriptState, info.Holder())', | 206 'ThisValue': 'ScriptValue(scriptState, info.Holder())', |
| 207 } | 207 } |
| 208 # List because key order matters, as we want arguments in deterministic order | 208 # List because key order matters, as we want arguments in deterministic order |
| 209 CALL_WITH_VALUES = [ | 209 CALL_WITH_VALUES = [ |
| 210 'ScriptState', | 210 'ScriptState', |
| 211 'ExecutionContext', | 211 'ExecutionContext', |
| 212 'ScriptArguments', | 212 'ScriptArguments', |
| 213 'CurrentWindow', | 213 'CurrentWindow', |
| 214 'EnteredWindow', | 214 'EnteredWindow', |
| (...skipping 21 matching lines...) Expand all Loading... |
| 236 def deprecate_as(member): | 236 def deprecate_as(member): |
| 237 extended_attributes = member.extended_attributes | 237 extended_attributes = member.extended_attributes |
| 238 if 'DeprecateAs' not in extended_attributes: | 238 if 'DeprecateAs' not in extended_attributes: |
| 239 return None | 239 return None |
| 240 includes.add('core/frame/Deprecation.h') | 240 includes.add('core/frame/Deprecation.h') |
| 241 return extended_attributes['DeprecateAs'] | 241 return extended_attributes['DeprecateAs'] |
| 242 | 242 |
| 243 | 243 |
| 244 # [Exposed] | 244 # [Exposed] |
| 245 EXPOSED_EXECUTION_CONTEXT_METHOD = { | 245 EXPOSED_EXECUTION_CONTEXT_METHOD = { |
| 246 'AnimationWorklet': 'isAnimationWorkletGlobalScope', | 246 'AnimationWorklet': 'IsAnimationWorkletGlobalScope', |
| 247 'AudioWorklet': 'isAudioWorkletGlobalScope', | 247 'AudioWorklet': 'IsAudioWorkletGlobalScope', |
| 248 'CompositorWorker': 'isCompositorWorkerGlobalScope', | 248 'CompositorWorker': 'IsCompositorWorkerGlobalScope', |
| 249 'DedicatedWorker': 'isDedicatedWorkerGlobalScope', | 249 'DedicatedWorker': 'IsDedicatedWorkerGlobalScope', |
| 250 'PaintWorklet': 'isPaintWorkletGlobalScope', | 250 'PaintWorklet': 'IsPaintWorkletGlobalScope', |
| 251 'ServiceWorker': 'isServiceWorkerGlobalScope', | 251 'ServiceWorker': 'IsServiceWorkerGlobalScope', |
| 252 'SharedWorker': 'isSharedWorkerGlobalScope', | 252 'SharedWorker': 'IsSharedWorkerGlobalScope', |
| 253 'Window': 'isDocument', | 253 'Window': 'IsDocument', |
| 254 'Worker': 'isWorkerGlobalScope', | 254 'Worker': 'IsWorkerGlobalScope', |
| 255 'Worklet': 'isWorkletGlobalScope', | 255 'Worklet': 'IsWorkletGlobalScope', |
| 256 } | 256 } |
| 257 | 257 |
| 258 | 258 |
| 259 EXPOSED_WORKERS = set([ | 259 EXPOSED_WORKERS = set([ |
| 260 'CompositorWorker', | 260 'CompositorWorker', |
| 261 'DedicatedWorker', | 261 'DedicatedWorker', |
| 262 'SharedWorker', | 262 'SharedWorker', |
| 263 'ServiceWorker', | 263 'ServiceWorker', |
| 264 ]) | 264 ]) |
| 265 | 265 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 raise ValueError('Interface members\' exposure sets must be a subset of
the interface\'s.') | 337 raise ValueError('Interface members\' exposure sets must be a subset of
the interface\'s.') |
| 338 | 338 |
| 339 return exposure_set.code() | 339 return exposure_set.code() |
| 340 | 340 |
| 341 | 341 |
| 342 # [SecureContext] | 342 # [SecureContext] |
| 343 def secure_context(member, interface): | 343 def secure_context(member, interface): |
| 344 """Returns C++ code that checks whether an interface/method/attribute/etc. i
s exposed | 344 """Returns C++ code that checks whether an interface/method/attribute/etc. i
s exposed |
| 345 to the current context.""" | 345 to the current context.""" |
| 346 if 'SecureContext' in member.extended_attributes or 'SecureContext' in inter
face.extended_attributes: | 346 if 'SecureContext' in member.extended_attributes or 'SecureContext' in inter
face.extended_attributes: |
| 347 return "executionContext->isSecureContext()" | 347 return "executionContext->IsSecureContext()" |
| 348 return None | 348 return None |
| 349 | 349 |
| 350 | 350 |
| 351 # [ImplementedAs] | 351 # [ImplementedAs] |
| 352 def cpp_name(definition_or_member): | 352 def cpp_name(definition_or_member): |
| 353 extended_attributes = definition_or_member.extended_attributes | 353 extended_attributes = definition_or_member.extended_attributes |
| 354 if 'ImplementedAs' not in extended_attributes: | 354 if 'ImplementedAs' not in extended_attributes: |
| 355 return definition_or_member.name | 355 return definition_or_member.name |
| 356 return extended_attributes['ImplementedAs'] | 356 return extended_attributes['ImplementedAs'] |
| 357 | 357 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 """Returns True if the interface's member needs to be defined on every | 471 """Returns True if the interface's member needs to be defined on every |
| 472 instance object. | 472 instance object. |
| 473 | 473 |
| 474 The following members must be defiend on an instance object. | 474 The following members must be defiend on an instance object. |
| 475 - [Unforgeable] members | 475 - [Unforgeable] members |
| 476 - regular members of [Global] or [PrimaryGlobal] interfaces | 476 - regular members of [Global] or [PrimaryGlobal] interfaces |
| 477 """ | 477 """ |
| 478 if member.is_static: | 478 if member.is_static: |
| 479 return False | 479 return False |
| 480 | 480 |
| 481 # TODO(yukishiino): Remove a hack for toString once we support | 481 # TODO(yukishiino): Remove a hack for ToString once we support |
| 482 # Symbol.toStringTag. | 482 # Symbol.ToStringTag. |
| 483 if (interface.name == 'Window' and member.name == 'toString'): | 483 if interface.name == 'Window' and member.name == 'ToString': |
| 484 return False | 484 return False |
| 485 | 485 |
| 486 # TODO(yukishiino): Implement "interface object" and its [[Call]] method | 486 # TODO(yukishiino): Implement "interface object" and its [[Call]] method |
| 487 # in a better way. Then we can get rid of this hack. | 487 # in a better way. Then we can get rid of this hack. |
| 488 if is_constructor_attribute(member): | 488 if is_constructor_attribute(member): |
| 489 return True | 489 return True |
| 490 | 490 |
| 491 if ('PrimaryGlobal' in interface.extended_attributes or | 491 if ('PrimaryGlobal' in interface.extended_attributes or |
| 492 'Global' in interface.extended_attributes or | 492 'Global' in interface.extended_attributes or |
| 493 'Unforgeable' in member.extended_attributes or | 493 'Unforgeable' in member.extended_attributes or |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 def named_property_getter(interface): | 617 def named_property_getter(interface): |
| 618 try: | 618 try: |
| 619 # Find named property getter, if present; has form: | 619 # Find named property getter, if present; has form: |
| 620 # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1) | 620 # getter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1) |
| 621 getter = next( | 621 getter = next( |
| 622 method | 622 method |
| 623 for method in interface.operations | 623 for method in interface.operations |
| 624 if ('getter' in method.specials and | 624 if ('getter' in method.specials and |
| 625 len(method.arguments) == 1 and | 625 len(method.arguments) == 1 and |
| 626 str(method.arguments[0].idl_type) == 'DOMString')) | 626 str(method.arguments[0].idl_type) == 'DOMString')) |
| 627 getter.name = getter.name or 'anonymousNamedGetter' | 627 getter.name = getter.name or 'AnonymousNamedGetter' |
| 628 return getter | 628 return getter |
| 629 except StopIteration: | 629 except StopIteration: |
| 630 return None | 630 return None |
| 631 | 631 |
| 632 | 632 |
| 633 def named_property_setter(interface): | 633 def named_property_setter(interface): |
| 634 try: | 634 try: |
| 635 # Find named property setter, if present; has form: | 635 # Find named property setter, if present; has form: |
| 636 # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2
) | 636 # setter RETURN_TYPE [OPTIONAL_IDENTIFIER](DOMString ARG1, ARG_TYPE ARG2
) |
| 637 return next( | 637 return next( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 658 return None | 658 return None |
| 659 | 659 |
| 660 | 660 |
| 661 IdlInterface.legacy_caller = property(legacy_caller) | 661 IdlInterface.legacy_caller = property(legacy_caller) |
| 662 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 662 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
| 663 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 663 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
| 664 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 664 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
| 665 IdlInterface.named_property_getter = property(named_property_getter) | 665 IdlInterface.named_property_getter = property(named_property_getter) |
| 666 IdlInterface.named_property_setter = property(named_property_setter) | 666 IdlInterface.named_property_setter = property(named_property_setter) |
| 667 IdlInterface.named_property_deleter = property(named_property_deleter) | 667 IdlInterface.named_property_deleter = property(named_property_deleter) |
| OLD | NEW |