Moved 39 roll Reviewers=vsm@google.com,asiva@google.com R=asiva@google.com, vsm@google.com Review URL: https://codereview.chromium.org//959933002 git-svn-id: http://dart.googlecode.com/svn/third_party/WebCore@44061 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/bindings/IDLExtendedAttributes.txt b/bindings/IDLExtendedAttributes.txt index 16296b6..73cd6bd 100644 --- a/bindings/IDLExtendedAttributes.txt +++ b/bindings/IDLExtendedAttributes.txt
@@ -36,7 +36,7 @@ ActiveDOMObject CachedAttribute=* CallWith=ExecutionContext|ScriptState|ScriptArguments|ActiveWindow|FirstWindow|ThisValue -CheckSecurity=Frame|Node +CheckSecurity=Frame|Node|Window Clamp Conditional=* Constructor @@ -81,14 +81,16 @@ ImplementedAs=* ImplementedInPrivateScript InitializedByEventConstructor +Iterable LegacyTreatAsPartialInterface LogActivity=|GetterOnly|SetterOnly LogAllWorlds -LogPreviousValue MeasureAs=* NamedConstructor=* +NoImplHeader NoInterfaceObject NotEnumerable +NotScriptWrappable OnlyExposedToPrivateScript OverrideBuiltins PartialInterfaceImplementedAs=*
diff --git a/bindings/README b/bindings/README index 1a601a7..418d1e5 100644 --- a/bindings/README +++ b/bindings/README
@@ -6,4 +6,4 @@ The current version corresponds to: URL: http://src.chromium.org/blink/branches/dart/dartium -Current revision: 182210 +Current revision: 190578
diff --git a/bindings/dart/scripts/code_generator_dart.py b/bindings/dart/scripts/code_generator_dart.py index 3c1c2ea..df3818e 100644 --- a/bindings/dart/scripts/code_generator_dart.py +++ b/bindings/dart/scripts/code_generator_dart.py
@@ -84,22 +84,24 @@ import dart_interface import dart_types from dart_utilities import DartUtilities -from utilities import write_pickle_file +from utilities import write_pickle_file, idl_filename_to_interface_name +import dart_dictionary from v8_globals import includes, interfaces -# TODO(jacobr): remove this hacked together list. -INTERFACES_WITHOUT_RESOLVERS = frozenset([ - 'TypeConversions', - 'GCObservation', - 'InternalProfilers', - 'InternalRuntimeFlags', - 'InternalSettings', - 'InternalSettingsGenerated', - 'Internals', - 'LayerRect', - 'LayerRectList', - 'MallocStatistics', - 'TypeConversions']) + +def render_template(interface_info, header_template, cpp_template, + template_context): + template_context['code_generator'] = module_pyname + + # Add includes for any dependencies + template_context['header_includes'] = sorted( + template_context['header_includes']) + includes.update(interface_info.get('dependencies_include_paths', [])) + template_context['cpp_includes'] = sorted(includes) + + header_text = header_template.render(template_context) + cpp_text = cpp_template.render(template_context) + return header_text, cpp_text class CodeGeneratorDart(object): def __init__(self, interfaces_info, cache_dir): @@ -108,45 +110,49 @@ self.jinja_env = initialize_jinja_env(cache_dir) # Set global type info - idl_types.set_ancestors(dict( - (interface_name, interface_info['ancestors']) - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['ancestors'])) - IdlType.set_callback_interfaces(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['is_callback_interface'])) - IdlType.set_implemented_as_interfaces(dict( - (interface_name, interface_info['implemented_as']) - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['implemented_as'])) - IdlType.set_garbage_collected_types(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if 'GarbageCollected' in interface_info['inherited_extended_attributes'])) - IdlType.set_will_be_garbage_collected_types(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes'])) - dart_types.set_component_dirs(dict( - (interface_name, interface_info['component_dir']) - for interface_name, interface_info in interfaces_info.iteritems())) + if 'ancestors' in interfaces_info: + idl_types.set_ancestors(interfaces_info['ancestors']) + if 'callback_interfaces' in interfaces_info: + IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) + if 'dictionaries' in interfaces_info: + IdlType.set_dictionaries(interfaces_info['dictionaries']) + if 'implemented_as_interfaces' in interfaces_info: + IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_interfaces']) + if 'garbage_collected_interfaces' in interfaces_info: + IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_interfaces']) + if 'will_be_garbage_collected_interfaces' in interfaces_info: + IdlType.set_will_be_garbage_collected_types(interfaces_info['will_be_garbage_collected_interfaces']) + if 'component_dirs' in interfaces_info: + dart_types.set_component_dirs(interfaces_info['component_dirs']) def generate_code(self, definitions, interface_name, idl_pickle_filename, only_if_changed): """Returns .h/.cpp code as (header_text, cpp_text).""" - try: + + IdlType.set_enums((enum.name, enum.values) + for enum in definitions.enumerations.values()) + + if interface_name in definitions.interfaces: interface = definitions.interfaces[interface_name] - except KeyError: - raise Exception('%s not in IDL definitions' % interface_name) + elif interface_name in definitions.dictionaries: + output_code_list = self.generate_dictionary_code( + definitions, interface_name, + definitions.dictionaries[interface_name]) + + # Pickle the dictionary information... + idl_world = self.load_idl_pickle_file(idl_pickle_filename) + idl_world['dictionary'] = {'name': interface_name} + write_pickle_file(idl_pickle_filename, idl_world, only_if_changed) + + return output_code_list + else: + raise ValueError('%s is not in IDL definitions' % interface_name) # Store other interfaces for introspection interfaces.update(definitions.interfaces) # Set local type info IdlType.set_callback_functions(definitions.callback_functions.keys()) - IdlType.set_enums((enum.name, enum.values) - for enum in definitions.enumerations.values()) # Select appropriate Jinja template and contents function if interface.is_callback: @@ -156,7 +162,7 @@ else: header_template_filename = 'interface_h.template' cpp_template_filename = 'interface_cpp.template' - generate_contents = dart_interface.generate_interface + generate_contents = dart_interface.interface_context header_template = self.jinja_env.get_template(header_template_filename) cpp_template = self.jinja_env.get_template(cpp_template_filename) @@ -177,27 +183,36 @@ includes.discard('core/dom/GlobalEventHandlers.h') includes.discard('core/frame/DOMWindowEventHandlers.h') + # Remove v8 usages not needed. + includes.discard('core/frame/UseCounter.h') + includes.discard('bindings/core/v8/V8ScriptState.h') + includes.discard('bindings/core/v8/V8DOMActivityLogger.h') + includes.discard('bindings/core/v8/V8DOMConfiguration.h') + includes.discard('bindings/core/v8/V8ExceptionState.h') + includes.discard('bindings/core/v8/V8HiddenValue.h') + includes.discard('bindings/core/v8/V8ObjectConstructor.h') + includes.discard('core/dom/ContextFeatures.h') + includes.discard('core/dom/Document.h') + includes.discard('platform/RuntimeEnabledFeatures.h') + includes.discard('platform/TraceEvent.h') + template_contents['cpp_includes'] = sorted(includes) - idl_world = {'interface': None, 'callback': None} - - # Load the pickle file for this IDL. - if os.path.isfile(idl_pickle_filename): - with open(idl_pickle_filename) as idl_pickle_file: - idl_global_data = pickle.load(idl_pickle_file) - idl_pickle_file.close() - idl_world['interface'] = idl_global_data['interface'] - idl_world['callback'] = idl_global_data['callback'] + idl_world = self.load_idl_pickle_file(idl_pickle_filename) if 'interface_name' in template_contents: - interface_global = {'component_dir': interface_info['component_dir'], - 'name': template_contents['interface_name'], + # interfaces no longer remember there component_dir re-compute based + # on relative_dir (first directory is the component). + component_dir = split_path(interface_info['relative_dir'])[0] + interface_global = {'name': template_contents['interface_name'], 'parent_interface': template_contents['parent_interface'], 'is_active_dom_object': template_contents['is_active_dom_object'], 'is_event_target': template_contents['is_event_target'], - 'has_resolver': template_contents['interface_name'] not in INTERFACES_WITHOUT_RESOLVERS, + 'has_resolver': template_contents['interface_name'], + 'native_entries': sorted(template_contents['native_entries'], key=lambda(x): x['blink_entry']), 'is_node': template_contents['is_node'], 'conditional_string': template_contents['conditional_string'], + 'component_dir': component_dir, } idl_world['interface'] = interface_global else: @@ -211,51 +226,106 @@ cpp_text = cpp_template.render(template_contents) return header_text, cpp_text - # Generates global file for all interfaces. - def generate_globals(self, global_pickle_directories, output_directory): - header_template_filename = 'global_h.template' - cpp_template_filename = 'global_cpp.template' + def load_idl_pickle_file(self, idl_pickle_filename): + # Pickle the dictionary information... + idl_world = {'interface': None, 'callback': None, 'dictionary': None} - # Delete the global pickle file we'll rebuild from each pickle generated - # for each IDL file '(%s_globals.pickle) % interface_name'. - global_pickle_filename = os.path.join(output_directory, 'global.pickle') - if os.path.isfile(global_pickle_filename): - os.remove(global_pickle_filename) + # Load the pickle file for this IDL. + if os.path.isfile(idl_pickle_filename): + with open(idl_pickle_filename) as idl_pickle_file: + idl_global_data = pickle.load(idl_pickle_file) + idl_pickle_file.close() + idl_world['interface'] = idl_global_data['interface'] + idl_world['callback'] = idl_global_data['callback'] + idl_world['dictionary'] = idl_global_data['dictionary'] + return idl_world + + def generate_dictionary_code(self, definitions, dictionary_name, + dictionary): + interface_info = self.interfaces_info[dictionary_name] + bindings_results = self.generate_dictionary_bindings( + dictionary_name, interface_info, dictionary) + impl_results = self.generate_dictionary_impl( + dictionary_name, interface_info, dictionary) + return bindings_results + impl_results + + def generate_dictionary_bindings(self, dictionary_name, + interface_info, dictionary): + header_template = self.jinja_env.get_template('dictionary_dart_h.template') + cpp_template = self.jinja_env.get_template('dictionary_dart_cpp.template') + template_context = dart_dictionary.dictionary_context(dictionary) + # Add the include for interface itself + template_context['header_includes'].add(interface_info['include_path']) + header_text, cpp_text = render_template( + interface_info, header_template, cpp_template, template_context) + return (header_text, cpp_text) + + def generate_dictionary_impl(self, dictionary_name, + interface_info, dictionary): + header_template = self.jinja_env.get_template('dictionary_impl_h.template') + cpp_template = self.jinja_env.get_template('dictionary_impl_cpp.template') + template_context = dart_dictionary.dictionary_impl_context( + dictionary, self.interfaces_info) + header_text, cpp_text = render_template( + interface_info, header_template, cpp_template, template_context) + return (header_text, cpp_text) + + def load_global_pickles(self, global_entries): # List of all interfaces and callbacks for global code generation. - world = {'interfaces': [], 'callbacks': []} + world = {'interfaces': [], 'callbacks': [], 'dictionary': []} # Load all pickled data for each interface. - for pickle_directory in global_pickle_directories: - listing = os.listdir(pickle_directory) - for filename in listing: - if filename.endswith('_globals.pickle'): - idl_filename = os.path.join(pickle_directory, filename) - with open(idl_filename) as idl_pickle_file: - idl_world = pickle.load(idl_pickle_file) - if 'interface' in idl_world: - # FIXME: Why are some of these None? - if idl_world['interface']: - world['interfaces'].append(idl_world['interface']) - if 'callbacks' in idl_world: - # FIXME: Why are some of these None? - if idl_world['callbacks']: - world['callbacks'].append(idl_world['callback']) - idl_pickle_file.close() - + for (directory, file_list) in global_entries: + for idl_filename in file_list: + interface_name = idl_filename_to_interface_name(idl_filename) + idl_pickle_filename = interface_name + "_globals.pickle" + idl_pickle_filename = os.path.join(directory, idl_pickle_filename) + with open(idl_pickle_filename) as idl_pickle_file: + idl_world = pickle.load(idl_pickle_file) + if 'interface' in idl_world: + # FIXME: Why are some of these None? + if idl_world['interface']: + world['interfaces'].append(idl_world['interface']) + if 'callbacks' in idl_world: + # FIXME: Why are some of these None? + if idl_world['callbacks']: + world['callbacks'].append(idl_world['callback']) + if 'dictionary' in idl_world: + # It's an IDL dictionary + if idl_world['dictionary']: + world['dictionary'].append(idl_world['dictionary']) world['interfaces'] = sorted(world['interfaces'], key=lambda (x): x['name']) world['callbacks'] = sorted(world['callbacks'], key=lambda (x): x['name']) + world['dictionary'] = sorted(world['dictionary'], key=lambda (x): x['name']) + return world - template_contents = world + # Generates global file for all interfaces. + def generate_globals(self, global_entries): + template_contents = self.load_global_pickles(global_entries) template_contents['code_generator'] = module_pyname + header_template_filename = 'global_h.template' header_template = self.jinja_env.get_template(header_template_filename) header_text = header_template.render(template_contents) + cpp_template_filename = 'global_cpp.template' cpp_template = self.jinja_env.get_template(cpp_template_filename) cpp_text = cpp_template.render(template_contents) + return header_text, cpp_text + # Generates global dart blink file for all interfaces. + def generate_dart_blink(self, global_entries): + template_contents = self.load_global_pickles(global_entries) + template_contents['code_generator'] = module_pyname + + template_filename = 'dart_blink.template' + template = self.jinja_env.get_template(template_filename) + + text = template.render(template_contents) + return text + def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( @@ -294,6 +364,15 @@ ' %s' % code) +def split_path(path): + path_list = [] + while os.path.basename(path): + path_list.append(os.path.basename(path)) + path = os.path.dirname(path) + path_list.reverse() + return path_list + + ################################################################################ def main(argv):
diff --git a/bindings/dart/scripts/compiler.py b/bindings/dart/scripts/compiler.py index 1f12119..6dbe8f2 100755 --- a/bindings/dart/scripts/compiler.py +++ b/bindings/dart/scripts/compiler.py
@@ -50,13 +50,19 @@ parser.add_option('--output-directory') parser.add_option('--interfaces-info-file') parser.add_option('--write-file-only-if-changed', type='int', default='1') - parser.add_option('--generate-global', type='int') - parser.add_option("-p", "--global-pickle-directories", - action="store", + parser.add_option('--generate-dart-blink', + action='append', type='string', - dest="global_pickle_directories", + dest='blink_global_entries', + nargs=3, + help="Pickle file directory, idl file list, idl dictionaries list") + + parser.add_option('--generate-globals', + action='append', + type='string', + dest='global_entries', nargs=2, - help="Directories to load _globals.pickle files (max 2)") + help="Pickle file directory and idl file list (global class table)") # ensure output comes last, so command line easy to parse via regexes parser.disable_interspersed_args() @@ -65,12 +71,12 @@ if options.output_directory is None: parser.error('Must specify output directory using --output-directory.') options.write_file_only_if_changed = bool(options.write_file_only_if_changed) - options.generate_global = bool(options.generate_global) - if len(args) != 1: - # parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args)) + if bool(options.global_entries) or bool(options.blink_global_entries): return options, None - idl_filename = os.path.realpath(args[0]) - return options, idl_filename + if len(args) != 1: + parser.error('Must specify exactly 1 input file as argument, but %d given.' % len(args)) + filename = os.path.realpath(args[0]) + return options, filename def idl_filename_to_interface_name(idl_filename): @@ -96,26 +102,46 @@ 'Dart%s.cpp' % interface_name) self.compile_and_write(idl_filename, (header_filename, cpp_filename)) - def generate_global(self, global_pickle_directories): + def generate_global(self, global_entries): + expanded_global_entries = [] + for (directory, file_list_file) in global_entries: + with open(file_list_file) as input_file: + idl_file_list = sorted([line.rstrip('\n') + for line in input_file]) + expanded_global_entries.append((directory, idl_file_list)) global_header_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.h') global_cpp_filename = os.path.join(self.output_directory, 'DartWebkitClassIds.cpp') - self.generate_global_and_write(global_pickle_directories, + self.generate_global_and_write(expanded_global_entries, (global_header_filename, global_cpp_filename)) + def generate_dart_blink(self, global_entries): + global_dart_blink_filename = os.path.join(self.output_directory, + '_blink_dartium.dart') + expanded_global_entries = [] + for (directory, file_list_file, file_list_dictionary) in global_entries: + with open(file_list_file) as input_file: + idl_file_list = sorted([line.rstrip('\n') + for line in input_file]) + with open(file_list_dictionary) as input_file: + dictionary_file_list = sorted([line.rstrip('\n') + for line in input_file]) + expanded_global_entries.append((directory, idl_file_list)) + expanded_global_entries.append((directory, dictionary_file_list)) + self.generate_dart_blink_and_write(expanded_global_entries, + global_dart_blink_filename) + def main(): - options, idl_filename = parse_options() - - if options.generate_global: - idl_compiler = IdlCompilerDart(options.output_directory, - interfaces_info_filename=options.interfaces_info_file, - only_if_changed=options.write_file_only_if_changed) - idl_compiler.generate_global(options.global_pickle_directories) + options, filename = parse_options() + idl_compiler = IdlCompilerDart(options.output_directory, + interfaces_info_filename=options.interfaces_info_file, + only_if_changed=options.write_file_only_if_changed) + if bool(options.global_entries): + idl_compiler.generate_global(options.global_entries) + elif bool(options.blink_global_entries): + idl_compiler.generate_dart_blink(options.blink_global_entries) else: - idl_compiler = IdlCompilerDart(options.output_directory, - interfaces_info_filename=options.interfaces_info_file, - only_if_changed=options.write_file_only_if_changed) - idl_compiler.compile_file(idl_filename) + idl_compiler.compile_file(filename) if __name__ == '__main__':
diff --git a/bindings/dart/scripts/dart_attributes.py b/bindings/dart/scripts/dart_attributes.py index 7aaec94..4559a66 100644 --- a/bindings/dart/scripts/dart_attributes.py +++ b/bindings/dart/scripts/dart_attributes.py
@@ -34,28 +34,28 @@ """ import idl_types -from idl_types import inherits_interface from dart_interface import suppress_getter, suppress_setter import dart_types from dart_utilities import DartUtilities -from v8_globals import includes, interfaces +from v8_globals import interfaces + +import v8_attributes -def generate_attribute(interface, attribute): +def attribute_context(interface, attribute): + # Call v8's implementation. + context = v8_attributes.attribute_context(interface, attribute) + + extended_attributes = attribute.extended_attributes + + # Augment's Dart's information to context. idl_type = attribute.idl_type base_idl_type = idl_type.base_type # TODO(terry): Work around for DOMString[] base should be IDLTypeArray if base_idl_type == None: # Returns Array or Sequence. - base_idl_type = idl_type.inner_name - extended_attributes = attribute.extended_attributes + base_idl_type = idl_type.name - idl_type.add_includes_for_type() - - # [CheckSecurity] - is_check_security_for_node = 'CheckSecurity' in extended_attributes - if is_check_security_for_node: - includes.add('bindings/common/BindingSecurity.h') # [Custom] has_custom_getter = (('Custom' in extended_attributes and extended_attributes['Custom'] in [None, 'Getter']) or @@ -69,128 +69,60 @@ is_call_with_script_state = DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState') - # [CustomElementCallbacks], [Reflect] - is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes - is_reflect = 'Reflect' in extended_attributes - if is_custom_element_callbacks or is_reflect: - includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') - # [RaisesException], [RaisesException=Setter] - is_setter_raises_exception = ( - 'RaisesException' in extended_attributes and - extended_attributes['RaisesException'] in [None, 'Setter']) - # [DartStrictTypeChecking] - has_strict_type_checking = ( - ('DartStrictTypeChecking' in extended_attributes or - 'DartStrictTypeChecking' in interface.extended_attributes) and - idl_type.is_wrapper_type) - - if (base_idl_type == 'EventHandler' and - interface.name in ['Window', 'WorkerGlobalScope'] and - attribute.name == 'onerror'): - includes.add('bindings/core/v8/V8ErrorHandler.h') - is_auto_scope = not 'DartNoAutoScope' in extended_attributes - contents = { - 'access_control_list': access_control_list(attribute), - 'activity_logging_world_list_for_getter': DartUtilities.activity_logging_world_list(attribute, 'Getter'), # [ActivityLogging] - 'activity_logging_world_list_for_setter': DartUtilities.activity_logging_world_list(attribute, 'Setter'), # [ActivityLogging] - 'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'), - 'conditional_string': DartUtilities.conditional_string(attribute), - 'constructor_type': idl_type.constructor_type_name - if is_constructor_attribute(attribute) else None, - 'cpp_name': DartUtilities.cpp_name(attribute), - 'cpp_type': idl_type.cpp_type, - 'deprecate_as': DartUtilities.deprecate_as(attribute), # [DeprecateAs] - 'enum_validation_expression': idl_type.enum_validation_expression, - 'has_custom_getter': has_custom_getter, - 'has_custom_setter': has_custom_setter, - 'has_strict_type_checking': has_strict_type_checking, - 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::ConversionContext::setConversionType - 'is_auto_scope': is_auto_scope, - 'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope), - 'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'CallWith', 'ExecutionContext'), - 'is_call_with_script_state': is_call_with_script_state, - 'is_check_security_for_node': is_check_security_for_node, - 'is_custom_element_callbacks': is_custom_element_callbacks, - 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, - 'is_getter_raises_exception': ( # [RaisesException] - 'RaisesException' in extended_attributes and - extended_attributes['RaisesException'] in [None, 'Getter']), - 'is_partial_interface_member': 'PartialInterfaceImplementedAs' in extended_attributes, - 'is_initialized_by_event_constructor': - 'InitializedByEventConstructor' in extended_attributes, - 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), - 'is_nullable': attribute.idl_type.is_nullable, - 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, - 'is_read_only': attribute.is_read_only, - 'is_reflect': is_reflect, - 'is_replaceable': 'Replaceable' in attribute.extended_attributes, - 'is_setter_call_with_execution_context': DartUtilities.has_extended_attribute_value(attribute, 'SetterCallWith', 'ExecutionContext'), - 'is_setter_raises_exception': is_setter_raises_exception, - 'has_setter_exception_state': ( - is_setter_raises_exception or has_strict_type_checking or - idl_type.is_integer_type), - 'is_static': attribute.is_static, - 'is_url': 'URL' in extended_attributes, - 'is_unforgeable': 'Unforgeable' in extended_attributes, - 'measure_as': DartUtilities.measure_as(attribute), # [MeasureAs] - 'name': attribute.name, - 'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(attribute), # [PerContextEnabled] - 'property_attributes': property_attributes(attribute), - 'put_forwards': 'PutForwards' in extended_attributes, - 'ref_ptr': 'RefPtrWillBeRawPtr' if idl_type.is_will_be_garbage_collected else 'RefPtr', - 'reflect_empty': extended_attributes.get('ReflectEmpty'), - 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), - 'reflect_missing': extended_attributes.get('ReflectMissing'), - 'reflect_only': extended_attributes['ReflectOnly'].split('|') - if 'ReflectOnly' in extended_attributes else None, - 'setter_callback': setter_callback_name(interface, attribute), - 'v8_type': dart_types.v8_type(base_idl_type), - 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] - 'world_suffixes': ['', 'ForMainWorld'] - if 'PerWorldBindings' in extended_attributes - else [''], # [PerWorldBindings] - } - if is_constructor_attribute(attribute): - generate_constructor_getter(interface, attribute, contents) - return contents - if not has_custom_getter: - generate_getter(interface, attribute, contents) - # FIXME: We did not previously support the PutForwards attribute, so I am - # disabling it here for now to get things compiling. - # We may wish to revisit this. - # if ((not attribute.is_read_only or 'PutForwards' in extended_attributes)): + context.update({ + 'activity_logging_world_list_for_getter': DartUtilities.activity_logging_world_list(attribute, 'Getter'), # [ActivityLogging] + 'activity_logging_world_list_for_setter': DartUtilities.activity_logging_world_list(attribute, 'Setter'), # [ActivityLogging] + 'deprecate_as': DartUtilities.deprecate_as(attribute), # [DeprecateAs] + 'has_custom_getter': has_custom_getter, + 'has_custom_setter': has_custom_setter, + 'is_auto_scope': is_auto_scope, # Used internally (outside of templates). + 'is_call_with_script_state': is_call_with_script_state, + 'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope), + 'measure_as': DartUtilities.measure_as(attribute), # [MeasureAs] + 'v8_type': dart_types.v8_type(base_idl_type), + }) + + if v8_attributes.is_constructor_attribute(attribute): + v8_attributes.constructor_getter_context(interface, attribute, context) + return context + if not v8_attributes.has_custom_getter(attribute): + getter_context(interface, attribute, context) if (not attribute.is_read_only): - generate_setter(interface, attribute, contents) + # FIXME: We did not previously support the PutForwards attribute, so I am + # disabling it here for now to get things compiling. + # We may wish to revisit this. + # if (not has_custom_setter(attribute) and + # (not attribute.is_read_only or 'PutForwards' in extended_attributes)): + setter_context(interface, attribute, context) native_entry_getter = \ - DartUtilities.generate_native_entry(interface.name, contents, - attribute.name, 'Getter', - None, [], None) + DartUtilities.generate_native_entry( + interface.name, attribute.name, 'Getter', attribute.is_static, 0) native_entry_setter = \ - DartUtilities.generate_native_entry(interface.name, contents, - attribute.name, 'Setter', - None, ["value"], None) - contents.update({ + DartUtilities.generate_native_entry( + interface.name, attribute.name, 'Setter', attribute.is_static, 1) + context.update({ 'native_entry_getter': native_entry_getter, 'native_entry_setter': native_entry_setter, }) - return contents + return context ################################################################################ # Getter ################################################################################ -def generate_getter(interface, attribute, contents): +def getter_context(interface, attribute, context): + v8_attributes.getter_context(interface, attribute, context) + idl_type = attribute.idl_type base_idl_type = idl_type.base_type extended_attributes = attribute.extended_attributes - name = attribute.name - cpp_value = getter_expression(interface, attribute, contents) + cpp_value = getter_expression(interface, attribute, context) # Normally we can inline the function call into the return statement to # avoid the overhead of using a Ref<> temporary, but for some cases # (nullable types, EventHandler, [CachedAttribute], or if there are @@ -202,8 +134,8 @@ base_idl_type == 'EventHandler' or 'CachedAttribute' in extended_attributes or 'ReflectOnly' in extended_attributes or - contents['is_getter_raises_exception']): - contents['cpp_value_original'] = cpp_value + context['is_getter_raises_exception']): + context['cpp_value_original'] = cpp_value cpp_value = 'result' # EventHandler has special handling if base_idl_type != 'EventHandler' and idl_type.is_interface_type: @@ -215,99 +147,48 @@ script_wrappable='impl', release=release, for_main_world=False, - auto_scope=contents['is_auto_scope']) + auto_scope=context['is_auto_scope']) # TODO(terry): Should be able to eliminate suppress_getter as we move from # IGNORE_MEMBERS to DartSuppress in the IDL. suppress = (suppress_getter(interface.name, attribute.name) or DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Getter')) - contents.update({ + context.update({ 'cpp_value': cpp_value, 'dart_set_return_value': dart_set_return_value, 'is_getter_suppressed': suppress, }) -def getter_expression(interface, attribute, contents): +def getter_expression(interface, attribute, context): + v8_attributes.getter_expression(interface, attribute, context) + arguments = [] - idl_type = attribute.idl_type - this_getter_base_name = getter_base_name(interface, attribute, arguments) + this_getter_base_name = v8_attributes.getter_base_name(interface, attribute, arguments) getter_name = DartUtilities.scoped_name(interface, attribute, this_getter_base_name) - arguments.extend(DartUtilities.call_with_arguments(attribute)) + arguments.extend(DartUtilities.call_with_arguments( + attribute.extended_attributes.get('CallWith'))) if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and not attribute.is_static): # Pass by reference. arguments.append('*receiver') - # TODO(jacobr): refactor has_type_checking_nullable to better match v8. - has_type_checking_nullable = ( - (DartUtilities.has_extended_attribute_value(interface, 'TypeChecking', 'Nullable') or - DartUtilities.has_extended_attribute_value(attribute, 'TypeChecking', 'Nullable')) and - idl_type.is_wrapper_type) - if attribute.idl_type.is_explicit_nullable: arguments.append('isNull') - if contents['is_getter_raises_exception']: + if context['is_getter_raises_exception']: arguments.append('es') return '%s(%s)' % (getter_name, ', '.join(arguments)) -CONTENT_ATTRIBUTE_GETTER_NAMES = { - 'boolean': 'hasAttribute', - 'long': 'getIntegralAttribute', - 'unsigned long': 'getUnsignedIntegralAttribute', -} - - -def getter_base_name(interface, attribute, arguments): - extended_attributes = attribute.extended_attributes - if 'Reflect' not in extended_attributes: - return DartUtilities.uncapitalize(DartUtilities.cpp_name(attribute)) - - content_attribute_name = extended_attributes['Reflect'] or attribute.name.lower() - if content_attribute_name in ['class', 'id', 'name']: - # Special-case for performance optimization. - return 'get%sAttribute' % content_attribute_name.capitalize() - - arguments.append(scoped_content_attribute_name(interface, attribute)) - - base_idl_type = attribute.idl_type.base_type - if base_idl_type in CONTENT_ATTRIBUTE_GETTER_NAMES: - return CONTENT_ATTRIBUTE_GETTER_NAMES[base_idl_type] - if 'URL' in attribute.extended_attributes: - return 'getURLAttribute' - return 'fastGetAttribute' - - -def is_keep_alive_for_gc(interface, attribute): - idl_type = attribute.idl_type - base_idl_type = idl_type.base_type - extended_attributes = attribute.extended_attributes - return ( - # For readonly attributes, for performance reasons we keep the attribute - # wrapper alive while the owner wrapper is alive, because the attribute - # never changes. - (attribute.is_read_only and - idl_type.is_wrapper_type and - # There are some exceptions, however: - not( - # Node lifetime is managed by object grouping. - inherits_interface(interface.name, 'Node') or - inherits_interface(base_idl_type, 'Node') or - # A self-reference is unnecessary. - attribute.name == 'self' or - # FIXME: Remove these hard-coded hacks. - base_idl_type in ['EventTarget', 'Window'] or - base_idl_type.startswith(('HTML', 'SVG'))))) - - ################################################################################ # Setter ################################################################################ -def generate_setter(interface, attribute, contents): +def setter_context(interface, attribute, context): + v8_attributes.setter_context(interface, attribute, context) + def target_attribute(): target_interface_name = attribute.idl_type.base_type target_attribute_name = extended_attributes['PutForwards'] @@ -322,14 +203,13 @@ (target_attribute_name, target_interface_name)) extended_attributes = attribute.extended_attributes - interface_extended_attributes = interface.extended_attributes if 'PutForwards' in extended_attributes: # Use target attribute in place of original attribute attribute = target_attribute() this_cpp_type = 'DartStringAdapter' else: - this_cpp_type = contents['cpp_type'] + this_cpp_type = context['cpp_type'] idl_type = attribute.idl_type @@ -337,24 +217,32 @@ # IGNORE_MEMBERS to DartSuppress in the IDL. suppress = (suppress_setter(interface.name, attribute.name) or DartUtilities.has_extended_attribute_value(attribute, 'DartSuppress', 'Setter')) - contents.update({ + context.update({ + 'has_setter_exception_state': ( + context['is_setter_raises_exception'] or context['has_type_checking_interface'] or + idl_type.is_integer_type), 'is_setter_suppressed': suppress, 'setter_lvalue': dart_types.check_reserved_name(attribute.name), 'cpp_type': this_cpp_type, 'local_cpp_type': idl_type.cpp_type_args(attribute.extended_attributes, raw_type=True), - 'cpp_setter': setter_expression(interface, attribute, contents), 'dart_value_to_local_cpp_value': attribute.idl_type.dart_value_to_local_cpp_value( - interface_extended_attributes, extended_attributes, attribute.name, False, 1, - contents['is_auto_scope']), + extended_attributes, attribute.name, False, + context['has_type_checking_interface'], 1, + context['is_auto_scope']), }) + # setter_expression() depends on context values we set above. + context['cpp_setter'] = setter_expression(interface, attribute, context) -def setter_expression(interface, attribute, contents): + +def setter_expression(interface, attribute, context): extended_attributes = attribute.extended_attributes - arguments = DartUtilities.call_with_arguments(attribute, extended_attributes.get('SetterCallWith')) + arguments = DartUtilities.call_with_arguments( + extended_attributes.get('SetterCallWith') or + extended_attributes.get('CallWith')) - this_setter_base_name = setter_base_name(interface, attribute, arguments) + this_setter_base_name = v8_attributes.setter_base_name(interface, attribute, arguments) setter_name = DartUtilities.scoped_name(interface, attribute, this_setter_base_name) if ('PartialInterfaceImplementedAs' in extended_attributes and @@ -363,7 +251,7 @@ idl_type = attribute.idl_type if idl_type.base_type == 'EventHandler': getter_name = DartUtilities.scoped_name(interface, attribute, DartUtilities.cpp_name(attribute)) - contents['event_handler_getter_expression'] = '%s(%s)' % ( + context['event_handler_getter_expression'] = '%s(%s)' % ( getter_name, ', '.join(arguments)) # FIXME(vsm): Do we need to support this? If so, what's our analogue of # V8EventListenerList? @@ -377,46 +265,12 @@ else: attribute_name = dart_types.check_reserved_name(attribute.name) arguments.append(attribute_name) - if contents['is_setter_raises_exception']: + if context['is_setter_raises_exception']: arguments.append('es') return '%s(%s)' % (setter_name, ', '.join(arguments)) -CONTENT_ATTRIBUTE_SETTER_NAMES = { - 'boolean': 'setBooleanAttribute', - 'long': 'setIntegralAttribute', - 'unsigned long': 'setUnsignedIntegralAttribute', -} - - -def setter_base_name(interface, attribute, arguments): - if 'Reflect' not in attribute.extended_attributes: - return 'set%s' % DartUtilities.capitalize(DartUtilities.cpp_name(attribute)) - arguments.append(scoped_content_attribute_name(interface, attribute)) - - base_idl_type = attribute.idl_type.base_type - if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: - return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] - return 'setAttribute' - - -def scoped_content_attribute_name(interface, attribute): - content_attribute_name = attribute.extended_attributes['Reflect'] or attribute.name.lower() - if interface.name.startswith('SVG'): - # SVG's xmlbase/xmlspace/xmllang need special behavior, i.e. - # it is in XMLNames namespace and the generated attribute has no xml prefix. - if attribute.name.startswith('xml'): - namespace = 'XMLNames' - content_attribute_name = content_attribute_name[3:] - else: - namespace = 'SVGNames' - else: - namespace = 'HTMLNames' - includes.add('core/%s.h' % namespace) - return '%s::%sAttr' % (namespace, content_attribute_name) - - ################################################################################ # Attribute configuration ################################################################################ @@ -427,7 +281,7 @@ extended_attributes = attribute.extended_attributes if (('Replaceable' in extended_attributes and 'PutForwards' not in extended_attributes) or - is_constructor_attribute(attribute)): + v8_attributes.is_constructor_attribute(attribute)): # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constructors return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp_class_name) # FIXME:disabling PutForwards for now since we didn't support it before @@ -437,36 +291,6 @@ return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name) -# [DoNotCheckSecurity], [Unforgeable] -def access_control_list(attribute): - extended_attributes = attribute.extended_attributes - access_control = [] - if 'DoNotCheckSecurity' in extended_attributes: - do_not_check_security = extended_attributes['DoNotCheckSecurity'] - if do_not_check_security == 'Setter': - access_control.append('v8::ALL_CAN_WRITE') - else: - access_control.append('v8::ALL_CAN_READ') - if (not attribute.is_read_only or - 'Replaceable' in extended_attributes): - access_control.append('v8::ALL_CAN_WRITE') - if 'Unforgeable' in extended_attributes: - access_control.append('v8::PROHIBITS_OVERWRITING') - return access_control or ['v8::DEFAULT'] - - -# [NotEnumerable], [Unforgeable] -def property_attributes(attribute): - extended_attributes = attribute.extended_attributes - property_attributes_list = [] - if ('NotEnumerable' in extended_attributes or - is_constructor_attribute(attribute)): - property_attributes_list.append('v8::DontEnum') - if 'Unforgeable' in extended_attributes: - property_attributes_list.append('v8::DontDelete') - return property_attributes_list or ['v8::None'] - - ################################################################################ # Constructors ################################################################################ @@ -474,12 +298,3 @@ idl_types.IdlType.constructor_type_name = property( # FIXME: replace this with a [ConstructorAttribute] extended attribute lambda self: DartUtilities.strip_suffix(self.base_type, 'Constructor')) - - -def is_constructor_attribute(attribute): - # FIXME: replace this with [ConstructorAttribute] extended attribute - return attribute.idl_type.name.endswith('Constructor') - - -def generate_constructor_getter(interface, attribute, contents): - contents['needs_constructor_getter_callback'] = contents['measure_as'] or contents['deprecate_as']
diff --git a/bindings/dart/scripts/dart_callback_interface.py b/bindings/dart/scripts/dart_callback_interface.py index 5120af4..266fb31 100644 --- a/bindings/dart/scripts/dart_callback_interface.py +++ b/bindings/dart/scripts/dart_callback_interface.py
@@ -114,7 +114,9 @@ def generate_arguments_contents(arguments, call_with_this_handle): def generate_argument(argument): - creation_context = '<Dart%s>' % argument.idl_type.base_type + creation_context = '' + if argument.idl_type.native_array_element_type is not None: + creation_context = '<Dart%s>' % argument.idl_type.native_array_element_type return { 'handle': '%sHandle' % argument.name, 'cpp_value_to_dart_value': argument.idl_type.cpp_value_to_dart_value(argument.name,
diff --git a/bindings/dart/scripts/dart_compiler.py b/bindings/dart/scripts/dart_compiler.py index 83457d0..84eb655 100755 --- a/bindings/dart/scripts/dart_compiler.py +++ b/bindings/dart/scripts/dart_compiler.py
@@ -38,7 +38,7 @@ import cPickle as pickle from idl_reader import IdlReader -from utilities import write_file +from utilities import write_file, idl_filename_to_component # TODO(terry): Temporary whitelist of IDL files to skip code generating. e.g., @@ -107,7 +107,9 @@ idl_pickle_filename = os.path.join(self.output_directory, '%s_globals.pickle' % interface_name) definitions = self.reader.read_idl_definitions(idl_filename) - output_code_list = self.code_generator.generate_code(definitions, + component = idl_filename_to_component(idl_filename) + + output_code_list = self.code_generator.generate_code(definitions[component], interface_name, idl_pickle_filename, self.only_if_changed) @@ -120,12 +122,15 @@ for output_code, output_filename in zip(output_code_list, output_filenames): write_file(output_code, output_filename, self.only_if_changed) - def generate_global_and_write(self, global_pickle_directories, output_filenames): - output_code_list = self.code_generator.generate_globals(global_pickle_directories, - self.output_directory) + def generate_global_and_write(self, global_entries, output_filenames): + output_code_list = self.code_generator.generate_globals(global_entries) for output_code, output_filename in zip(output_code_list, output_filenames): write_file(output_code, output_filename, self.only_if_changed) + def generate_dart_blink_and_write(self, global_entries, output_filename): + output_code = self.code_generator.generate_dart_blink(global_entries) + write_file(output_code, output_filename, self.only_if_changed) + @abc.abstractmethod def compile_file(self, idl_filename): pass
diff --git a/bindings/dart/scripts/dart_dictionary.py b/bindings/dart/scripts/dart_dictionary.py new file mode 100644 index 0000000..42a21ba --- /dev/null +++ b/bindings/dart/scripts/dart_dictionary.py
@@ -0,0 +1,149 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generate template contexts of dictionaries for both v8 bindings and +implementation classes that are used by blink's core/modules. +""" + +import operator +from v8_globals import includes +import dart_types +from dart_utilities import DartUtilities + + +DICTIONARY_H_INCLUDES = frozenset([ + 'bindings/core/v8/V8Binding.h', + 'platform/heap/Handle.h', +]) + +DICTIONARY_CPP_INCLUDES = frozenset([ + 'bindings/common/ExceptionState.h', + # FIXME: Remove this, http://crbug.com/321462 + 'bindings/core/v8/Dictionary.h', +]) + + +def setter_name_for_dictionary_member(member): + return 'set%s' % DartUtilities.capitalize(member.name) + + +def has_method_name_for_dictionary_member(member): + return 'has%s' % DartUtilities.capitalize(member.name) + + +def unwrap_nullable_if_needed(idl_type): + if idl_type.is_nullable: + return idl_type.inner_type + return idl_type + + +# Context for Dart bindings + +def dictionary_context(dictionary): + includes.clear() + includes.update(DICTIONARY_CPP_INCLUDES) + return { + 'cpp_class': DartUtilities.cpp_name(dictionary), + 'header_includes': set(DICTIONARY_H_INCLUDES), + 'members': [member_context(member) + for member in sorted(dictionary.members, + key=operator.attrgetter('name'))], + 'dart_class': dart_types.dart_type(dictionary.name), + + } + + +def member_context(member): + idl_type = member.idl_type + idl_type.add_includes_for_type() + idl_type = unwrap_nullable_if_needed(idl_type) + + def default_values(): + if not member.default_value: + return None, None + if member.default_value.is_null: + return None, 'v8::Null(isolate)' + cpp_default_value = str(member.default_value) + v8_default_value = idl_type.cpp_value_to_v8_value( + cpp_value=cpp_default_value, isolate='isolate', + creation_context='creationContext') + return cpp_default_value, v8_default_value + + cpp_default_value, dart_default_value = default_values() + + dart_enum_expression = idl_type.enum_validation_expression + if dart_enum_expression: + dart_enum_expression = dart_enum_expression.format(param_name='string') + + return { + 'cpp_default_value': cpp_default_value, + 'cpp_type': idl_type.cpp_type, + 'cpp_value_to_dart_value': idl_type.cpp_value_to_dart_value( + cpp_value='impl->%s()' % member.name, + creation_context='creationContext', + extended_attributes=member.extended_attributes), + 'enum_validation_expression': dart_enum_expression, + 'has_method_name': has_method_name_for_dictionary_member(member), + 'is_object': idl_type.name == 'Object', + 'name': member.name, + 'setter_name': setter_name_for_dictionary_member(member), + 'dart_default_value': dart_default_value, + } + + +# Context for implementation classes + +def dictionary_impl_context(dictionary, interfaces_info): + includes.clear() + header_includes = set(['platform/heap/Handle.h']) + return { + 'header_includes': header_includes, + 'cpp_class': DartUtilities.cpp_name(dictionary), + 'members': [member_impl_context(member, interfaces_info, + header_includes) + for member in dictionary.members], + } + + +def member_impl_context(member, interfaces_info, header_includes): + idl_type = unwrap_nullable_if_needed(member.idl_type) + is_object = idl_type.name == 'Object' + + def getter_expression(): + if idl_type.impl_should_use_nullable_container: + return 'm_%s.get()' % member.name + return 'm_%s' % member.name + + def has_method_expression(): + if idl_type.impl_should_use_nullable_container or idl_type.is_enum or idl_type.is_string_type: + return '!m_%s.isNull()' % member.name + elif is_object: + return '!(m_{0}.isEmpty() || m_{0}.isNull() || m_{0}.isUndefined())'.format(member.name) + else: + return 'm_%s' % member.name + + def member_cpp_type(): + member_cpp_type = idl_type.cpp_type_args(used_in_cpp_sequence=True) + if idl_type.impl_should_use_nullable_container: + return dart_types.cpp_template_type('Nullable', member_cpp_type) + return member_cpp_type + + cpp_default_value = None + if member.default_value and not member.default_value.is_null: + cpp_default_value = str(member.default_value) + + header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) + return { + 'cpp_default_value': cpp_default_value, + 'getter_expression': getter_expression(), + 'has_method_expression': has_method_expression(), + 'has_method_name': has_method_name_for_dictionary_member(member), + 'is_object': is_object, + 'is_traceable': (idl_type.is_garbage_collected or + idl_type.is_will_be_garbage_collected), + 'member_cpp_type': member_cpp_type(), + 'name': member.name, + 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), + 'setter_name': setter_name_for_dictionary_member(member), + }
diff --git a/bindings/dart/scripts/dart_interface.py b/bindings/dart/scripts/dart_interface.py index c6a5702..1ab889b 100644 --- a/bindings/dart/scripts/dart_interface.py +++ b/bindings/dart/scripts/dart_interface.py
@@ -1,4 +1,5 @@ # Copyright (C) 2013 Google Inc. All rights reserved. +# coding=utf-8 # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -32,6 +33,8 @@ """ from collections import defaultdict +import itertools +from operator import itemgetter import idl_types from idl_types import IdlType, inherits_interface, IdlArrayOrSequenceType, IdlArrayType @@ -40,6 +43,8 @@ import dart_types from dart_utilities import DartUtilities from v8_globals import includes +import v8_attributes +import v8_interface INTERFACE_H_INCLUDES = frozenset([ @@ -396,22 +401,12 @@ return False -def add_native_entries(interface, constructors, is_custom): - for constructor in constructors: - types = None - if not is_custom: - types = [arg['preprocessed_type'] - for arg in constructor['arguments']] - argument_names = [arg['name'] for arg in constructor['arguments']] - native_entry = \ - DartUtilities.generate_native_entry(interface.name, constructor, - None, 'Constructor', None, - argument_names, types) - constructor.update({'native_entry': native_entry}) +# TODO(terry): Rename genenerate_interface to interface_context. +def interface_context(interface): + context = v8_interface.interface_context(interface) - -def generate_interface(interface): includes.clear() + includes.update(INTERFACE_CPP_INCLUDES) header_includes = set(INTERFACE_H_INCLUDES) @@ -420,10 +415,6 @@ header_includes.update(dart_types.includes_for_interface(parent_interface)) extended_attributes = interface.extended_attributes - is_audio_buffer = inherits_interface(interface.name, 'AudioBuffer') - if is_audio_buffer: - includes.add('modules/webaudio/AudioBuffer.h') - is_document = inherits_interface(interface.name, 'Document') if is_document: # FIXME(vsm): We probably need bindings/dart/DartController and @@ -438,30 +429,6 @@ if inherits_interface(interface.name, 'EventTarget'): includes.update(['bindings/core/dart/DartEventListener.h']) - # [ActiveDOMObject] - is_active_dom_object = 'ActiveDOMObject' in extended_attributes - - # [CheckSecurity] - is_check_security = 'CheckSecurity' in extended_attributes - if is_check_security: - includes.add('bindings/common/BindingSecurity.h') - - # [DependentLifetime] - is_dependent_lifetime = 'DependentLifetime' in extended_attributes - - # [MeasureAs] -# TODO(terry): Remove Me? -# is_measure_as = 'MeasureAs' in extended_attributes -# if is_measure_as: -# includes.add('core/frame/UseCounter.h') - - # [SetWrapperReferenceFrom] - reachable_node_function = extended_attributes.get('SetWrapperReferenceFrom') - if reachable_node_function: - # FIXME(vsm): We may need bindings/dart/DartGCController.h instead. - includes.update(['bindings/core/v8/V8GCController.h', - 'core/dom/Element.h']) - # [SetWrapperReferenceTo] set_wrapper_reference_to_list = [{ 'name': argument.name, @@ -476,127 +443,81 @@ for set_wrapper_reference_to in set_wrapper_reference_to_list: set_wrapper_reference_to['idl_type'].add_includes_for_type() - # [SpecialWrapFor] - if 'SpecialWrapFor' in extended_attributes: - special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') - else: - special_wrap_for = [] - for special_wrap_interface in special_wrap_for: - dart_types.add_includes_for_interface(special_wrap_interface) - - # [Custom=Wrap], [SetWrapperReferenceFrom] - has_visit_dom_wrapper = ( - DartUtilities.has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or - reachable_node_function or - set_wrapper_reference_to_list) - - this_gc_type = DartUtilities.gc_type(interface) - - template_contents = { + context.update({ 'conditional_string': DartUtilities.conditional_string(interface), # [Conditional] 'cpp_class': DartUtilities.cpp_name(interface), - 'gc_type': this_gc_type, - 'has_custom_legacy_call_as_function': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] - 'has_custom_to_v8': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'ToV8'), # [Custom=ToV8] - 'has_custom_wrap': DartUtilities.has_extended_attribute_value(interface, 'Custom', 'Wrap'), # [Custom=Wrap] - 'has_visit_dom_wrapper': has_visit_dom_wrapper, 'header_includes': header_includes, - 'interface_name': interface.name, - 'is_active_dom_object': is_active_dom_object, - 'is_audio_buffer': is_audio_buffer, - 'is_check_security': is_check_security, - 'is_dependent_lifetime': is_dependent_lifetime, - 'is_document': is_document, - 'is_event_target': inherits_interface(interface.name, 'EventTarget'), - 'is_exception': interface.is_exception, - 'is_garbage_collected': this_gc_type == 'GarbageCollectedObject', - 'is_will_be_garbage_collected': this_gc_type == 'WillBeGarbageCollectedObject', - 'is_node': inherits_interface(interface.name, 'Node'), + 'is_garbage_collected': context['gc_type'] == 'GarbageCollectedObject', + 'is_will_be_garbage_collected': context['gc_type'] == 'WillBeGarbageCollectedObject', 'measure_as': DartUtilities.measure_as(interface), # [MeasureAs] - 'parent_interface': parent_interface, 'pass_cpp_type': dart_types.cpp_template_type( - dart_types.cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), + dart_types.cpp_ptr_type('PassRefPtr', 'RawPtr', context['gc_type']), DartUtilities.cpp_name(interface)), - 'reachable_node_function': reachable_node_function, 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(interface), # [RuntimeEnabled] - 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, - 'special_wrap_for': special_wrap_for, + 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, 'dart_class': dart_types.dart_type(interface.name), 'v8_class': DartUtilities.v8_class_name(interface), - 'wrapper_configuration': 'WrapperConfiguration::Dependent' - if (has_visit_dom_wrapper or - is_active_dom_object or - is_dependent_lifetime) - else 'WrapperConfiguration::Independent', - } + }) # Constructors - constructors = [generate_constructor(interface, constructor) + constructors = [constructor_context(interface, constructor) for constructor in interface.constructors # FIXME: shouldn't put named constructors with constructors # (currently needed for Perl compatibility) # Handle named constructors separately if constructor.name == 'Constructor'] - generate_constructor_overloads(constructors) + if len(constructors) > 1: + context.update({'constructor_overloads': overloads_context(constructors)}) # [CustomConstructor] - custom_constructors = [generate_custom_constructor(interface, constructor) + custom_constructors = [custom_constructor_context(interface, constructor) for constructor in interface.custom_constructors] - # [EventConstructor] - has_event_constructor = 'EventConstructor' in extended_attributes - any_type_attributes = [attribute for attribute in interface.attributes - if attribute.idl_type.name == 'Any'] - if has_event_constructor: - includes.add('bindings/core/v8/Dictionary.h') - if any_type_attributes: - includes.add('bindings/core/v8/SerializedScriptValue.h') - # [NamedConstructor] named_constructor = generate_named_constructor(interface) - add_native_entries(interface, constructors, bool(custom_constructors)) - add_native_entries(interface, custom_constructors, bool(custom_constructors)) + generate_method_native_entries(interface, constructors, 'Constructor') + generate_method_native_entries(interface, custom_constructors, 'Constructor') if named_constructor: - add_native_entries(interface, [named_constructor], bool(custom_constructors)) + generate_method_native_entries(interface, [named_constructor], + 'Constructor') + event_constructor = None + if context['has_event_constructor']: + event_constructor = { + 'native_entries': [ + DartUtilities.generate_native_entry( + interface.name, None, 'Constructor', False, 2)], + } - if (constructors or custom_constructors or has_event_constructor or + if (context['constructors'] or custom_constructors or context['has_event_constructor'] or named_constructor): includes.add('core/frame/LocalDOMWindow.h') - template_contents.update({ - 'any_type_attributes': any_type_attributes, + context.update({ 'constructors': constructors, 'custom_constructors': custom_constructors, + 'event_constructor': event_constructor, 'has_custom_constructor': bool(custom_constructors), - 'has_event_constructor': has_event_constructor, 'interface_length': - interface_length(interface, constructors + custom_constructors), + v8_interface.interface_length(interface, constructors + custom_constructors), 'is_constructor_call_with_document': DartUtilities.has_extended_attribute_value( interface, 'ConstructorCallWith', 'Document'), # [ConstructorCallWith=Document] 'is_constructor_call_with_execution_context': DartUtilities.has_extended_attribute_value( interface, 'ConstructorCallWith', 'ExecutionContext'), # [ConstructorCallWith=ExeuctionContext] - 'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor', # [RaisesException=Constructor] 'named_constructor': named_constructor, }) - # Constants - template_contents.update({ - 'constants': [generate_constant(constant) for constant in interface.constants], - 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, - }) - # Attributes - attributes = [dart_attributes.generate_attribute(interface, attribute) + attributes = [dart_attributes.attribute_context(interface, attribute) for attribute in interface.attributes # Skip attributes in the IGNORE_MEMBERS list or if an # extended attribute is in the IGNORE_EXTENDED_ATTRIBUTES. if (not _suppress_attribute(interface.name, attribute.name) and - not dart_attributes.is_constructor_attribute(attribute) and + not v8_attributes.is_constructor_attribute(attribute) and not _suppress_extended_attributes(attribute.extended_attributes) and not ('DartSuppress' in attribute.extended_attributes and attribute.extended_attributes.get('DartSuppress') == None))] - template_contents.update({ + context.update({ 'attributes': attributes, 'has_accessors': any(attribute['is_expose_js_accessors'] for attribute in attributes), 'has_attribute_configuration': any( @@ -611,17 +532,19 @@ }) # Methods - methods = [dart_methods.generate_method(interface, method) + methods = [dart_methods.method_context(interface, method) for method in interface.operations # Skip anonymous special operations (methods name empty). # Skip methods in our IGNORE_MEMBERS list. # Skip methods w/ extended attributes in IGNORE_EXTENDED_ATTRIBUTES list. if (method.name and + # detect unnamed getters from v8_interface. + method.name != 'anonymousNamedGetter' and # TODO(terry): Eventual eliminate the IGNORE_MEMBERS in favor of DartSupress. not _suppress_method(interface.name, method.name) and not _suppress_extended_attributes(method.extended_attributes) and not 'DartSuppress' in method.extended_attributes)] - generate_overloads(methods) + compute_method_overloads_context(methods) for method in methods: method['do_generate_method_configuration'] = ( method['do_not_check_signature'] and @@ -629,9 +552,9 @@ # For overloaded methods, only generate one accessor ('overload_index' not in method or method['overload_index'] == 1)) - generate_method_native_entries(interface, methods) + generate_method_native_entries(interface, methods, 'Method') - template_contents.update({ + context.update({ 'has_origin_safe_method_setter': any( method['is_check_security_for_frame'] and not method['is_read_only'] for method in methods), @@ -640,256 +563,346 @@ 'methods': methods, }) - native_entries = generate_native_entries(interface, constructors, - custom_constructors, attributes, - methods, named_constructor) - - template_contents.update({ + context.update({ 'indexed_property_getter': indexed_property_getter(interface), 'indexed_property_setter': indexed_property_setter(interface), - 'indexed_property_deleter': indexed_property_deleter(interface), + 'indexed_property_deleter': v8_interface.indexed_property_deleter(interface), 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, 'named_property_getter': named_property_getter(interface), 'named_property_setter': named_property_setter(interface), - 'named_property_deleter': named_property_deleter(interface), + 'named_property_deleter': v8_interface.named_property_deleter(interface), + }) + + generate_native_entries_for_specials(interface, context) + + native_entries = generate_interface_native_entries(context) + + context.update({ 'native_entries': native_entries, }) - return template_contents + return context -def generate_native_entries(interface, constructors, custom_constructors, - attributes, methods, named_constructor): - entries = [] - for constructor in constructors: - entries.append(constructor['native_entry']) - for constructor in custom_constructors: - entries.append(constructor['native_entry']) - if named_constructor: - entries.append(named_constructor['native_entry']) +def generate_interface_native_entries(context): + entries = {} + + def add(ne): + entries[ne['blink_entry']] = ne + + def addAll(nes): + for ne in nes: + add(ne) + + for constructor in context['constructors']: + addAll(constructor['native_entries']) + for constructor in context['custom_constructors']: + addAll(constructor['native_entries']) + if context['named_constructor']: + addAll(context['named_constructor']['native_entries']) + if context['event_constructor']: + addAll(context['event_constructor']['native_entries']) + for method in context['methods']: + addAll(method['native_entries']) + for attribute in context['attributes']: + add(attribute['native_entry_getter']) + if not attribute['is_read_only'] or attribute['put_forwards']: + add(attribute['native_entry_setter']) + if context['indexed_property_getter']: + addAll(context['indexed_property_getter']['native_entries']) + if context['indexed_property_setter']: + addAll(context['indexed_property_setter']['native_entries']) + if context['indexed_property_deleter']: + addAll(context['indexed_property_deleter']['native_entries']) + if context['named_property_getter']: + addAll(context['named_property_getter']['native_entries']) + if context['named_property_setter']: + addAll(context['named_property_setter']['native_entries']) + if context['named_property_deleter']: + addAll(context['named_property_deleter']['native_entries']) + return list(entries.values()) + + +def generate_method_native_entry(interface, method, count, kind): + name = method.get('name') + is_static = bool(method.get('is_static')) + native_entry = \ + DartUtilities.generate_native_entry(interface.name, name, + kind, is_static, count) + return native_entry + + +def generate_method_native_entries(interface, methods, kind): for method in methods: - entries.extend(method['native_entries']) - for attribute in attributes: - entries.append(attribute['native_entry_getter']) - entries.append(attribute['native_entry_setter']) - return entries + native_entries = [] + arg_count = method['number_of_arguments'] + min_arg_count = method['number_of_required_arguments'] + lb = min_arg_count - 2 if min_arg_count > 2 else 0 + for x in range(lb, arg_count + 3): + native_entry = \ + generate_method_native_entry(interface, method, x, kind) + native_entries.append(native_entry) - -# [DeprecateAs], [Reflect], [RuntimeEnabled] -def generate_constant(constant): - # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted - # in C++. - if constant.idl_type.name == 'String': - value = '"%s"' % constant.value - else: - value = constant.value - - extended_attributes = constant.extended_attributes - return { - 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), - 'name': constant.name, - # FIXME: use 'reflected_name' as correct 'name' - 'reflected_name': extended_attributes.get('Reflect', constant.name), - 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(constant), - 'value': value, - } + method.update({'native_entries': native_entries}) ################################################################################ # Overloads ################################################################################ -def generate_method_native_entry(interface, method, count, optional_index): - types = None - if not method['is_custom']: - types = [arg['preprocessed_type'] for arg in method['arguments'][0:count]] - if method['is_call_with_script_arguments']: - types.append("object") - argument_names = [arg['name'] for arg in method['arguments'][0:count]] - name = method['name'] - native_entry = \ - DartUtilities.generate_native_entry(interface.name, method, - name, 'Method', - optional_index, - argument_names, types) - return native_entry +def compute_method_overloads_context(methods): + # Regular methods + compute_method_overloads_context_by_type([method for method in methods + if not method['is_static']]) + # Static methods + compute_method_overloads_context_by_type([method for method in methods + if method['is_static']]) -def generate_method_native_entries(interface, methods): - for method in methods: - native_entries = [] - required_arg_count = method['number_of_required_arguments'] - arg_count = method['number_of_arguments'] - if required_arg_count != arg_count: - for x in range(required_arg_count, arg_count + 1): - # This is really silly, but is here for now just to match up - # the existing name generation in the old dart:html scripts - index = arg_count - x + 1 - native_entry = \ - generate_method_native_entry(interface, method, x, index) - native_entries.append(native_entry) - else: - # Eventually, we should probably always generate an unindexed - # native entry, to handle cases like - # addEventListener in which we suppress the optionality, - # and in general to make us more robust against optional changes - native_entry = \ - generate_method_native_entry(interface, method, arg_count, None) - native_entries.append(native_entry) +def compute_method_overloads_context_by_type(methods): + """Computes |method.overload*| template values. - method.update({'native_entries': native_entries}) - -def generate_overloads(methods): - generate_overloads_by_type(methods, is_static=False) # Regular methods - generate_overloads_by_type(methods, is_static=True) - - -def generate_overloads_by_type(methods, is_static): - # Generates |overloads| template values and modifies |methods| in place; - # |is_static| flag used (instead of partitioning list in 2) because need to - # iterate over original list of methods to modify in place - method_counts = defaultdict(lambda: 0) - for method in methods: - if method['is_static'] != is_static: - continue - name = method['name'] - # FIXME(vsm): We don't seem to capture optional param - # overloads here. - method_counts[name] += 1 - - # Filter to only methods that are actually overloaded - overloaded_method_counts = dict((name, count) - for name, count in method_counts.iteritems() - if count > 1) - + Called separately for static and non-static (regular) methods, + as these are overloaded separately. + Modifies |method| in place for |method| in |methods|. + Doesn't change the |methods| list itself (only the values, i.e. individual + methods), so ok to treat these separately. + """ # Add overload information only to overloaded methods, so template code can # easily verify if a function is overloaded - method_overloads = defaultdict(list) - for method in methods: - name = method['name'] - if (method['is_static'] != is_static or - name not in overloaded_method_counts): - continue - # Overload index includes self, so first append, then compute index - method_overloads[name].append(method) - method.update({ - 'overload_index': len(method_overloads[name]), - 'overload_resolution_expression': overload_resolution_expression(method), - }) - # FIXME(vsm): Looks like we only handle optional parameters if - # the method is already overloaded. For a non-overloaded method - # with optional parameters, we never get here. - - # Resolution function is generated after last overloaded function; - # package necessary information into |method.overloads| for that method. - for method in methods: - if (method['is_static'] != is_static or - 'overload_index' not in method): - continue - name = method['name'] - if method['overload_index'] != overloaded_method_counts[name]: - continue - overloads = method_overloads[name] - minimum_number_of_required_arguments = min( - overload['number_of_required_arguments'] - for overload in overloads) - method['overloads'] = { - 'has_exception_state': bool(minimum_number_of_required_arguments), - 'methods': overloads, - 'minimum_number_of_required_arguments': minimum_number_of_required_arguments, - 'name': name, - } + for name, overloads in v8_interface.method_overloads_by_name(methods): + # Resolution function is generated after last overloaded function; + # package necessary information into |method.overloads| for that method. + overloads[-1]['overloads'] = overloads_context(overloads) + overloads[-1]['overloads']['name'] = name -def overload_resolution_expression(method): - # Expression is an OR of ANDs: each term in the OR corresponds to a - # possible argument count for a given method, with type checks. - # FIXME: Blink's overload resolution algorithm is incorrect, per: - # Implement WebIDL overload resolution algorithm. - # https://code.google.com/p/chromium/issues/detail?id=293561 +def overloads_context(overloads): + """Returns |overloads| template values for a single name. + + Sets |method.overload_index| in place for |method| in |overloads| + and returns dict of overall overload template values. + """ + assert len(overloads) > 1 # only apply to overloaded names + for index, method in enumerate(overloads, 1): + method['overload_index'] = index + + effective_overloads_by_length = v8_interface.effective_overload_set_by_length(overloads) + lengths = [length for length, _ in effective_overloads_by_length] + name = overloads[0].get('name', '<constructor>') + + # Check and fail if all overloads with the shortest acceptable arguments + # list are runtime enabled, since we would otherwise set 'length' on the + # function object to an incorrect value when none of those overloads were + # actually enabled at runtime. The exception is if all overloads are + # controlled by the same runtime enabled feature, in which case there would + # be no function object at all if it is not enabled. + shortest_overloads = effective_overloads_by_length[0][1] + if (all(method.get('runtime_enabled_function') + for method, _, _ in shortest_overloads) and + not v8_interface.common_value(overloads, 'runtime_enabled_function')): + raise ValueError('Function.length of %s depends on runtime enabled features' % name) + + return { + 'deprecate_all_as': v8_interface.common_value(overloads, 'deprecate_as'), # [DeprecateAs] + 'exposed_test_all': v8_interface.common_value(overloads, 'exposed_test'), # [Exposed] + 'length_tests_methods': length_tests_methods(effective_overloads_by_length), + # 1. Let maxarg be the length of the longest type list of the + # entries in S. + 'maxarg': lengths[-1], + 'measure_all_as': v8_interface.common_value(overloads, 'measure_as'), # [MeasureAs] + 'minarg': lengths[0], + 'per_context_enabled_function_all': v8_interface.common_value(overloads, 'per_context_enabled_function'), # [PerContextEnabled] + 'runtime_enabled_function_all': v8_interface.common_value(overloads, 'runtime_enabled_function'), # [RuntimeEnabled] + 'valid_arities': lengths + # Only need to report valid arities if there is a gap in the + # sequence of possible lengths, otherwise invalid length means + # "not enough arguments". + if lengths[-1] - lengths[0] != len(lengths) - 1 else None, + } + + +def length_tests_methods(effective_overloads_by_length): + """Returns sorted list of resolution tests and associated methods, by length. + + This builds the main data structure for the overload resolution loop. + For a given argument length, bindings test argument at distinguishing + argument index, in order given by spec: if it is compatible with + (optionality or) type required by an overloaded method, resolve to that + method. + + Returns: + [(length, [(test, method)])] + """ + return [(length, list(resolution_tests_methods(effective_overloads))) + for length, effective_overloads in effective_overloads_by_length] + + +DART_CHECK_TYPE = { + 'ArrayBufferView': 'Dart_IsTypedData({cpp_value})', + 'ArrayBuffer': 'Dart_IsByteBuffer({cpp_value})', + 'Uint8Array': 'DartUtilities::isUint8Array({cpp_value})', + 'Uint8ClampedArray': 'DartUtilities::isUint8ClampedArray({cpp_value})', +} + + +def resolution_tests_methods(effective_overloads): + """Yields resolution test and associated method, in resolution order, for effective overloads of a given length. + + This is the heart of the resolution algorithm. + http://heycam.github.io/webidl/#dfn-overload-resolution-algorithm + + Note that a given method can be listed multiple times, with different tests! + This is to handle implicit type conversion. + + Returns: + [(test, method)] + """ + methods = [effective_overload[0] + for effective_overload in effective_overloads] + if len(methods) == 1: + # If only one method with a given length, no test needed + yield 'true', methods[0] + return + + # 6. If there is more than one entry in S, then set d to be the + # distinguishing argument index for the entries of S. + index = v8_interface.distinguishing_argument_index(effective_overloads) + # (7-9 are for handling |undefined| values for optional arguments before + # the distinguishing argument (as "missing"), so you can specify only some + # optional arguments. We don't support this, so we skip these steps.) + # 10. If i = d, then: + # (d is the distinguishing argument index) + # 1. Let V be argi. + # Note: This is the argument that will be used to resolve which + # overload is selected. + cpp_value = 'Dart_GetNativeArgument(args, %s + argOffset)' % index + + # Extract argument and IDL type to simplify accessing these in each loop. + arguments = [method['arguments'][index] for method in methods] + arguments_methods = zip(arguments, methods) + idl_types = [argument['idl_type_object'] for argument in arguments] + idl_types_methods = zip(idl_types, methods) + + # We can't do a single loop through all methods or simply sort them, because + # a method may be listed in multiple steps of the resolution algorithm, and + # which test to apply differs depending on the step. # - # Currently if distinguishing non-primitive type from primitive type, - # (e.g., sequence<DOMString> from DOMString or Dictionary from double) - # the method with a non-primitive type argument must appear *first* in the - # IDL file, since we're not adding a check to primitive types. - # FIXME: Once fixed, check IDLs, as usually want methods with primitive - # types to appear first (style-wise). - # - # Properly: - # 1. Compute effective overload set. - # 2. First check type list length. - # 3. If multiple entries for given length, compute distinguishing argument - # index and have check for that type. - arguments = method['arguments'] - overload_checks = [overload_check_expression(method, index) - # check *omitting* optional arguments at |index| and up: - # index 0 => argument_count 0 (no arguments) - # index 1 => argument_count 1 (index 0 argument only) - for index, argument in enumerate(arguments) - if argument['is_optional']] - # FIXME: this is wrong if a method has optional arguments and a variadic - # one, though there are not yet any examples of this - if not method['is_variadic']: - # Includes all optional arguments (len = last index + 1) - overload_checks.append(overload_check_expression(method, len(arguments))) - return ' || '.join('(%s)' % check for check in overload_checks) + # Instead, we need to go through all methods at each step, either finding + # first match (if only one test is allowed) or filtering to matches (if + # multiple tests are allowed), and generating an appropriate tests. + # 2. If V is undefined, and there is an entry in S whose list of + # optionality values has "optional" at index i, then remove from S all + # other entries. + try: + method = next(method for argument, method in arguments_methods + if argument['is_optional']) + test = 'Dart_IsNull(%s)' % cpp_value + yield test, method + except StopIteration: + pass -def overload_check_expression(method, argument_count): - overload_checks = ['info.Length() == %s' % argument_count] - arguments = method['arguments'][:argument_count] - overload_checks.extend(overload_check_argument(index, argument) - for index, argument in - enumerate(arguments)) - return ' && '.join('(%s)' % check for check in overload_checks if check) + # 3. Otherwise: if V is null or undefined, and there is an entry in S that + # has one of the following types at position i of its type list, + # - a nullable type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_nullable) + test = 'Dart_IsNull(%s)' % cpp_value + yield test, method + except StopIteration: + pass + # 4. Otherwise: if V is a platform object - but not a platform array + # object - and there is an entry in S that has one of the following + # types at position i of its type list, + # - an interface type that V implements + # (Unlike most of these tests, this can return multiple methods, since we + # test if it implements an interface. Thus we need a for loop, not a next.) + # (We distinguish wrapper types from built-in interface types.) + for idl_type, method in ((idl_type, method) + for idl_type, method in idl_types_methods + if idl_type.is_wrapper_type): + fmtstr = 'Dart{idl_type}::hasInstance({cpp_value})' + if idl_type.base_type in DART_CHECK_TYPE: + fmtstr = DART_CHECK_TYPE[idl_type.base_type] + test = fmtstr.format(idl_type=idl_type.base_type, cpp_value=cpp_value) + yield test, method -def overload_check_argument(index, argument): - def null_or_optional_check(): - # If undefined is passed for an optional argument, the argument should - # be treated as missing; otherwise undefined is not allowed. + # 8. Otherwise: if V is any kind of object except for a native Date object, + # a native RegExp object, and there is an entry in S that has one of the + # following types at position i of its type list, + # - an array type + # - a sequence type + # ... + # - a dictionary + try: + # FIXME: IDL dictionary not implemented, so use Blink Dictionary + # http://crbug.com/321462 + idl_type, method = next((idl_type, method) + for idl_type, method in idl_types_methods + if (idl_type.native_array_element_type or + idl_type.name == 'Dictionary')) + if idl_type.native_array_element_type: + # (We test for Array instead of generic Object to type-check.) + # FIXME: test for Object during resolution, then have type check for + # Array in overloaded method: http://crbug.com/262383 + test = 'Dart_IsList(%s)' % cpp_value + else: + # FIXME: should be '{1}->IsObject() && !{1}->IsDate() && !{1}->IsRegExp()'.format(cpp_value) + # FIXME: the IsDate and IsRegExp checks can be skipped if we've + # already generated tests for them. + test = 'Dart_IsInstance(%s)' % cpp_value + yield test, method + except StopIteration: + pass - # FIXME(vsm): We need Dart specific checks here. - if idl_type.is_nullable: - if argument['is_optional']: - return 'isUndefinedOrNull(%s)' - return '%s->IsNull()' - if argument['is_optional']: - return '%s->IsUndefined()' - return None + # (Check for exact type matches before performing automatic type conversion; + # only needed if distinguishing between primitive types.) + if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1: + # (Only needed if match in step 11, otherwise redundant.) + if any(idl_type.is_string_type or idl_type.is_enum + for idl_type in idl_types): + # 10. Otherwise: if V is a Number value, and there is an entry in S + # that has one of the following types at position i of its type + # list, + # - a numeric type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_numeric_type) + test = 'Dart_IsNumber(%s)' % cpp_value + yield test, method + except StopIteration: + pass - cpp_value = 'info[%s]' % index - idl_type = argument['idl_type_object'] - # FIXME(vsm): We need Dart specific checks for the rest of this method. - # FIXME: proper type checking, sharing code with attributes and methods - # FIXME(terry): DartStrictTypeChecking no longer supported; TypeChecking is - # new extended attribute. - if idl_type.name == 'String' and argument['is_strict_type_checking']: - return ' || '.join(['isUndefinedOrNull(%s)' % cpp_value, - '%s->IsString()' % cpp_value, - '%s->IsObject()' % cpp_value]) - if idl_type.native_array_element_type: - return '%s->IsArray()' % cpp_value - if idl_type.is_callback_interface: - return ' || '.join(['%s->IsNull()' % cpp_value, - '%s->IsFunction()' % cpp_value]) - if idl_type.is_wrapper_type: - type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.format(idl_type=idl_type.base_type, cpp_value=cpp_value) - if idl_type.is_nullable: - type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) - return type_check - if idl_type.is_interface_type: - # Non-wrapper types are just objects: we don't distinguish type - # We only allow undefined for non-wrapper types (notably Dictionary), - # as we need it for optional Dictionary arguments, but we don't want to - # change behavior of existing bindings for other types. - type_check = '%s->IsObject()' % cpp_value - added_check_template = null_or_optional_check() - if added_check_template: - type_check = ' || '.join([added_check_template % cpp_value, - type_check]) - return type_check - return None + # (Perform automatic type conversion, in order. If any of these match, + # that's the end, and no other tests are needed.) To keep this code simple, + # we rely on the C++ compiler's dead code elimination to deal with the + # redundancy if both cases below trigger. + + # 11. Otherwise: if there is an entry in S that has one of the following + # types at position i of its type list, + # - DOMString + # - ByteString + # - ScalarValueString [a DOMString typedef, per definition.] + # - an enumeration type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_string_type or idl_type.is_enum) + yield 'true', method + except StopIteration: + pass + + # 12. Otherwise: if there is an entry in S that has one of the following + # types at position i of its type list, + # - a numeric type + try: + method = next(method for idl_type, method in idl_types_methods + if idl_type.is_numeric_type) + yield 'true', method + except StopIteration: + pass ################################################################################ @@ -897,15 +910,17 @@ ################################################################################ # [Constructor] -def generate_custom_constructor(interface, constructor): +def custom_constructor_context(interface, constructor): return { 'arguments': [custom_constructor_argument(argument, index) for index, argument in enumerate(constructor.arguments)], 'auto_scope': 'true', 'is_auto_scope': True, + 'is_call_with_script_arguments': False, + 'is_custom': True, 'number_of_arguments': len(constructor.arguments), 'number_of_required_arguments': - number_of_required_arguments(constructor), + v8_interface.number_of_required_arguments(constructor), } @@ -920,96 +935,30 @@ # [Constructor] -def generate_constructor(interface, constructor): +def constructor_context(interface, constructor): return { - 'argument_list': constructor_argument_list(interface, constructor), - # TODO(terry): Use dart_methods.generate_argument instead constructor_argument. - 'arguments': [constructor_argument(interface, argument, index) + 'arguments': [dart_methods.argument_context(interface, constructor, argument, index) for index, argument in enumerate(constructor.arguments)], + 'auto_scope': 'true', + 'cpp_value': dart_methods.cpp_value( + interface, constructor, len(constructor.arguments)), 'has_exception_state': # [RaisesException=Constructor] interface.extended_attributes.get('RaisesException') == 'Constructor' or any(argument for argument in constructor.arguments if argument.idl_type.name == 'SerializedScriptValue' or argument.idl_type.is_integer_type), - 'is_constructor': True, - 'auto_scope': 'true', 'is_auto_scope': True, + 'is_call_with_script_arguments': False, + 'is_constructor': True, + 'is_custom': False, 'is_variadic': False, # Required for overload resolution 'number_of_required_arguments': - number_of_required_arguments(constructor), + v8_interface.number_of_required_arguments(constructor), 'number_of_arguments': len(constructor.arguments), } -def constructor_argument_list(interface, constructor): - # FIXME: unify with dart_methods.cpp_argument. - - def cpp_argument(argument): - argument_name = dart_types.check_reserved_name(argument.name) - idl_type = argument.idl_type - # FIXMEDART: there has to be a cleaner way to check for arraylike - # types such as Uint8ClampedArray. - if isinstance(idl_type, IdlArrayType) or idl_type.preprocessed_type.is_typed_array_type: - return '%s.get()' % argument_name - - return argument_name - - arguments = [] - # [ConstructorCallWith=ExecutionContext] - if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'ExecutionContext'): - arguments.append('context') - # [ConstructorCallWith=Document] - if DartUtilities.has_extended_attribute_value(interface, 'ConstructorCallWith', 'Document'): - arguments.append('document') - - arguments.extend([cpp_argument(argument) for argument in constructor.arguments]) - - # [RaisesException=Constructor] - if interface.extended_attributes.get('RaisesException') == 'Constructor': - arguments.append('es') - - return arguments - - -# TODO(terry): Eliminate this function use dart_methods.generate_argument instead -# for all constructor arguments. -def constructor_argument(interface, argument, index): - idl_type = argument.idl_type - default_value = str(argument.default_value) if argument.default_value else None - - argument_content = { - 'cpp_type': idl_type.cpp_type_args(), - 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, raw_type=True), - # FIXME: check that the default value's type is compatible with the argument's - 'default_value': default_value, - # FIXME: remove once [Default] removed and just use argument.default_value - 'has_default': 'Default' in argument.extended_attributes or default_value, - 'idl_type_object': idl_type, - 'preprocessed_type': str(idl_type.preprocessed_type), - # Dictionary is special-cased, but arrays and sequences shouldn't be - 'idl_type': idl_type.native_array_element_type, - 'index': index, - 'is_array_or_sequence_type': not not idl_type.native_array_element_type, - 'is_optional': argument.is_optional, - 'is_strict_type_checking': False, # Required for overload resolution - 'name': argument.name, - 'dart_value_to_local_cpp_value': dart_methods.dart_value_to_local_cpp_value(interface, argument, index), - } - return argument_content - - -def generate_constructor_overloads(constructors): - if len(constructors) <= 1: - return - for overload_index, constructor in enumerate(constructors): - constructor.update({ - 'overload_index': overload_index + 1, - 'overload_resolution_expression': - overload_resolution_expression(constructor), - }) - - # [NamedConstructor] def generate_named_constructor(interface): extended_attributes = interface.extended_attributes @@ -1019,28 +968,13 @@ # included in constructors (and only name stored in extended attribute) # for Perl compatibility idl_constructor = interface.constructors[0] - constructor = generate_constructor(interface, idl_constructor) + constructor = constructor_context(interface, idl_constructor) # FIXME(vsm): We drop the name. We don't use this in Dart APIs right now. # We probably need to encode this somehow to deal with conflicts. # constructor['name'] = extended_attributes['NamedConstructor'] return constructor -def number_of_required_arguments(constructor): - return len([argument for argument in constructor.arguments - if not (argument.is_optional and not (('Default' in argument.extended_attributes) or argument.default_value))]) - - -def interface_length(interface, constructors): - # Docs: http://heycam.github.io/webidl/#es-interface-call - if 'EventConstructor' in interface.extended_attributes: - return 1 - if not constructors: - return 0 - return min(constructor['number_of_required_arguments'] - for constructor in constructors) - - ################################################################################ # Special operations (methods) # http://heycam.github.io/webidl/#idl-special-operations @@ -1058,6 +992,8 @@ return '!result' return '' + context = v8_interface.property_getter(getter, []) + idl_type = getter.idl_type extended_attributes = getter.extended_attributes is_raises_exception = 'RaisesException' in extended_attributes @@ -1069,22 +1005,14 @@ cpp_arguments.append('es') union_arguments = idl_type.union_arguments if union_arguments: - cpp_arguments.extend(union_arguments) + cpp_arguments.extend([member_argument['cpp_value'] + for member_argument in union_arguments]) cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) - return { + context.update({ 'cpp_type': idl_type.cpp_type, 'cpp_value': cpp_value, - 'is_custom': - 'Custom' in extended_attributes and - (not extended_attributes['Custom'] or - DartUtilities.has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), - 'is_custom_property_enumerator': DartUtilities.has_extended_attribute_value( - getter, 'Custom', 'PropertyEnumerator'), - 'is_custom_property_query': DartUtilities.has_extended_attribute_value( - getter, 'Custom', 'PropertyQuery'), - 'is_enumerable': 'NotEnumerable' not in extended_attributes, 'is_null_expression': is_null_expression(idl_type), 'is_raises_exception': is_raises_exception, 'name': DartUtilities.cpp_name(getter), @@ -1092,41 +1020,23 @@ 'dart_set_return_value': idl_type.dart_set_return_value('result', extended_attributes=extended_attributes, script_wrappable='receiver', - release=idl_type.release)} + release=idl_type.release)}) + return context -def property_setter(interface, setter): +def property_setter(setter): + context = v8_interface.property_setter(setter) + idl_type = setter.arguments[1].idl_type extended_attributes = setter.extended_attributes - interface_extended_attributes = interface.extended_attributes - is_raises_exception = 'RaisesException' in extended_attributes - return { - 'has_strict_type_checking': - 'DartStrictTypeChecking' in extended_attributes and - idl_type.is_wrapper_type, - 'idl_type': idl_type.base_type, - 'is_custom': 'Custom' in extended_attributes, - 'has_exception_state': is_raises_exception or - idl_type.is_integer_type, - 'is_raises_exception': is_raises_exception, - 'name': DartUtilities.cpp_name(setter), + + context.update({ 'dart_value_to_local_cpp_value': idl_type.dart_value_to_local_cpp_value( - interface_extended_attributes, extended_attributes, 'propertyValue', False), - } + extended_attributes, 'propertyValue', False, + context['has_type_checking_interface']), + }) - -def property_deleter(deleter): - idl_type = deleter.idl_type - if str(idl_type) != 'boolean': - raise Exception( - 'Only deleters with boolean type are allowed, but type is "%s"' % - idl_type) - extended_attributes = deleter.extended_attributes - return { - 'is_custom': 'Custom' in extended_attributes, - 'is_raises_exception': 'RaisesException' in extended_attributes, - 'name': DartUtilities.cpp_name(deleter), - } + return context ################################################################################ @@ -1165,23 +1075,7 @@ except StopIteration: return None - return property_setter(interface, setter) - - -def indexed_property_deleter(interface): - try: - # Find indexed property deleter, if present; has form: - # deleter TYPE [OPTIONAL_IDENTIFIER](unsigned long ARG) - deleter = next( - method - for method in interface.operations - if ('deleter' in method.specials and - len(method.arguments) == 1 and - str(method.arguments[0].idl_type) == 'unsigned long')) - except StopIteration: - return None - - return property_deleter(deleter) + return property_setter(setter) ################################################################################ @@ -1203,6 +1097,7 @@ return None getter.name = getter.name or 'anonymousNamedGetter' + return property_getter(getter, ['propertyName']) @@ -1219,20 +1114,29 @@ except StopIteration: return None - return property_setter(interface, setter) + return property_setter(setter) -def named_property_deleter(interface): - try: - # Find named property deleter, if present; has form: - # deleter TYPE [OPTIONAL_IDENTIFIER](DOMString ARG) - deleter = next( - method - for method in interface.operations - if ('deleter' in method.specials and - len(method.arguments) == 1 and - str(method.arguments[0].idl_type) == 'DOMString')) - except StopIteration: - return None +def generate_native_entries_for_specials(interface, context): + def add(prop, name, arity): + if context[prop]: + if 'native_entries' not in context[prop]: + context[prop].update({'native_entries': []}) + context[prop]['native_entries'].append( + DartUtilities.generate_native_entry( + interface.name, name, 'Method', False, arity)) - return property_deleter(deleter) + pre = ['indexed_property', 'named_property'] + post = [('setter', '__setter__', 2), + ('getter', '__getter__', 1), + ('deleter', '__delete__', 1), + ] + props = [(p1 + "_" + p2, name, arity) + for (p1, (p2, name, arity)) in itertools.product(pre, post)] + for t in props: + add(*t) + + for (p, name, arity) in props: + if context[p]: + if context[p].get('is_custom_property_query'): + add(p, '__propertyQuery__', 1)
diff --git a/bindings/dart/scripts/dart_methods.py b/bindings/dart/scripts/dart_methods.py index 53997fd..b700e89 100644 --- a/bindings/dart/scripts/dart_methods.py +++ b/bindings/dart/scripts/dart_methods.py
@@ -33,51 +33,26 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler """ -from idl_types import IdlTypeBase, IdlType, IdlUnionType, inherits_interface, IdlArrayOrSequenceType, IdlArrayType +from idl_types import inherits_interface import dart_types -from idl_definitions import IdlArgument from dart_utilities import DartUtilities from v8_globals import includes +import v8_methods -def generate_method(interface, method): + +def method_context(interface, method): + context = v8_methods.method_context(interface, method) + arguments = method.arguments extended_attributes = method.extended_attributes idl_type = method.idl_type - is_static = method.is_static - name = method.name - idl_type.add_includes_for_type() +# idl_type.add_includes_for_type() this_cpp_value = cpp_value(interface, method, len(arguments)) - def function_template(): - if is_static: - return 'functionTemplate' - if 'Unforgeable' in extended_attributes: - return 'instanceTemplate' - return 'prototypeTemplate' - - is_call_with_script_arguments = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptArguments') - if is_call_with_script_arguments: - includes.update(['bindings/core/v8/ScriptCallStackFactory.h', - 'core/inspector/ScriptArguments.h']) - is_call_with_script_state = DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ScriptState') - if is_call_with_script_state: + if context['is_call_with_script_state']: includes.add('bindings/core/dart/DartScriptState.h') - is_check_security_for_node = 'CheckSecurity' in extended_attributes - if is_check_security_for_node: - includes.add('bindings/common/BindingSecurity.h') - is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes - if is_custom_element_callbacks: - includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') - - has_event_listener_argument = any( - argument for argument in arguments - if argument.idl_type.name == 'EventListener') - is_check_security_for_frame = ( - 'CheckSecurity' in interface.extended_attributes and - 'DoNotCheckSecurity' not in extended_attributes) - is_raises_exception = 'RaisesException' in extended_attributes if idl_type.union_arguments and len(idl_type.union_arguments) > 0: this_cpp_type = [] @@ -90,136 +65,99 @@ is_auto_scope = not 'DartNoAutoScope' in extended_attributes - number_of_arguments = len(arguments) - - number_of_required_arguments = \ - len([ - argument for argument in arguments - if not ((argument.is_optional and not ('Default' in argument.extended_attributes or argument.default_value)) or - argument.is_variadic)]) - - arguments_data = [generate_argument(interface, method, argument, index) + arguments_data = [argument_context(interface, method, argument, index) for index, argument in enumerate(arguments)] + union_arguments = [] + if idl_type.union_arguments: + union_arguments.extend([union_arg['cpp_value'] + for union_arg in idl_type.union_arguments]) + is_custom = 'Custom' in extended_attributes or 'DartCustom' in extended_attributes - method_data = { + context.update({ 'activity_logging_world_list': DartUtilities.activity_logging_world_list(method), # [ActivityLogging] 'arguments': arguments_data, - 'conditional_string': DartUtilities.conditional_string(method), 'cpp_type': this_cpp_type, 'cpp_value': this_cpp_value, 'dart_name': extended_attributes.get('DartName'), 'deprecate_as': DartUtilities.deprecate_as(method), # [DeprecateAs] - 'do_not_check_signature': not(is_static or + 'do_not_check_signature': not(context['is_static'] or DartUtilities.has_extended_attribute(method, ['DoNotCheckSecurity', 'DoNotCheckSignature', 'NotEnumerable', 'ReadOnly', 'RuntimeEnabled', 'Unforgeable'])), - 'function_template': function_template(), - 'idl_type': idl_type.base_type, - 'has_event_listener_argument': has_event_listener_argument, 'has_exception_state': - has_event_listener_argument or - is_raises_exception or - is_check_security_for_frame or + context['is_raises_exception'] or + context['is_check_security_for_frame'] or any(argument for argument in arguments if argument.idl_type.name == 'SerializedScriptValue' or argument.idl_type.is_integer_type), 'is_auto_scope': is_auto_scope, 'auto_scope': DartUtilities.bool_to_cpp(is_auto_scope), - 'is_call_with_execution_context': DartUtilities.has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'), - 'is_call_with_script_arguments': is_call_with_script_arguments, - 'is_call_with_script_state': is_call_with_script_state, - 'is_check_security_for_frame': is_check_security_for_frame, - 'is_check_security_for_node': is_check_security_for_node, 'is_custom': is_custom, 'is_custom_dart': 'DartCustom' in extended_attributes, 'is_custom_dart_new': DartUtilities.has_extended_attribute_value(method, 'DartCustom', 'New'), - 'is_custom_element_callbacks': is_custom_element_callbacks, - 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, - 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes, - 'is_partial_interface_member': 'PartialInterfaceImplementedAs' in extended_attributes, - 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, - 'is_raises_exception': is_raises_exception, - 'is_read_only': 'ReadOnly' in extended_attributes, - 'is_static': is_static, # FIXME(terry): DartStrictTypeChecking no longer supported; TypeChecking is # new extended attribute. 'is_strict_type_checking': 'DartStrictTypeChecking' in extended_attributes or 'DartStrictTypeChecking' in interface.extended_attributes, - 'is_variadic': arguments and arguments[-1].is_variadic, 'measure_as': DartUtilities.measure_as(method), # [MeasureAs] - 'name': name, - 'number_of_arguments': number_of_arguments, - 'number_of_required_arguments': number_of_required_arguments, - 'number_of_required_or_variadic_arguments': len([ - argument for argument in arguments - if not argument.is_optional]), - 'per_context_enabled_function': DartUtilities.per_context_enabled_function_name(method), # [PerContextEnabled] - 'property_attributes': property_attributes(method), - 'runtime_enabled_function': DartUtilities.runtime_enabled_function_name(method), # [RuntimeEnabled] - 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSignature' in extended_attributes else 'defaultSignature', 'suppressed': (arguments and arguments[-1].is_variadic), # FIXME: implement variadic - 'union_arguments': idl_type.union_arguments, + 'union_arguments': union_arguments, 'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value), - 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''], # [PerWorldBindings] - } - return method_data + }) + return context +def argument_context(interface, method, argument, index): + context = v8_methods.argument_context(interface, method, argument, index) -def generate_argument(interface, method, argument, index): extended_attributes = argument.extended_attributes idl_type = argument.idl_type this_cpp_value = cpp_value(interface, method, index) - is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type - use_heap_vector_type = is_variadic_wrapper_type and idl_type.is_will_be_garbage_collected + use_heap_vector_type = context['is_variadic_wrapper_type'] and idl_type.is_will_be_garbage_collected auto_scope = not 'DartNoAutoScope' in extended_attributes - this_has_default = 'Default' in extended_attributes - arg_index = index + 1 if not method.is_static else index + arg_index = index + 1 if not (method.is_static or method.is_constructor) else index preprocessed_type = str(idl_type.preprocessed_type) + local_cpp_type = idl_type.cpp_type_args(argument.extended_attributes, raw_type=True) + default_value = argument.default_cpp_value + if context['has_default']: + default_value = (argument.default_cpp_value or + dart_types.default_cpp_value_for_cpp_type(idl_type)) # FIXMEDART: handle the drift between preprocessed type names in 1847 and # 1985 dartium builds in a more generic way. if preprocessed_type == 'unrestricted float': preprocessed_type = 'float' if preprocessed_type == 'unrestricted double': preprocessed_type = 'double' - argument_data = { + + dart_enum_expression = idl_type.enum_validation_expression + if dart_enum_expression: + dart_enum_expression = dart_enum_expression.format(param_name=argument.name) + context.update({ 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes, raw_type=True, used_in_cpp_sequence=use_heap_vector_type), 'cpp_value': this_cpp_value, - 'local_cpp_type': idl_type.cpp_type_args(argument.extended_attributes, raw_type=True), + 'local_cpp_type': local_cpp_type, # FIXME: check that the default value's type is compatible with the argument's - 'default_value': str(argument.default_value) if argument.default_value else None, - 'enum_validation_expression': idl_type.enum_validation_expression, - # Ignore 'Default' in extended_attributes not exposed in dart:html. - 'has_default': False, - 'has_event_listener_argument': any( - argument_so_far for argument_so_far in method.arguments[:index] - if argument_so_far.idl_type.name == 'EventListener'), - 'idl_type_object': idl_type, + 'default_value': default_value, + 'enum_validation_expression': dart_enum_expression, 'preprocessed_type': preprocessed_type, - # Dictionary is special-cased, but arrays and sequences shouldn't be - 'idl_type': idl_type.base_type, - 'index': index, 'is_array_or_sequence_type': not not idl_type.native_array_element_type, - 'is_clamp': 'Clamp' in extended_attributes, - 'is_callback_interface': idl_type.is_callback_interface, - 'is_nullable': idl_type.is_nullable, - # Only expose as optional if no default value. - 'is_optional': argument.is_optional and not (this_has_default or argument.default_value), 'is_strict_type_checking': 'DartStrictTypeChecking' in extended_attributes, - 'is_variadic_wrapper_type': is_variadic_wrapper_type, + 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictionary', 'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector', - 'is_wrapper_type': idl_type.is_wrapper_type, - 'name': argument.name, - 'dart_set_return_value_for_main_world': dart_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), + 'dart_set_return_value_for_main_world': dart_set_return_value(interface.name, method, + this_cpp_value, for_main_world=True), 'dart_set_return_value': dart_set_return_value(interface.name, method, this_cpp_value), 'arg_index': arg_index, - 'dart_value_to_local_cpp_value': dart_value_to_local_cpp_value(interface, argument, arg_index, auto_scope), - } - return argument_data + 'dart_value_dictionary_cpp_value': dart_dictionary_value_argument(argument, arg_index), + 'dart_value_to_local_cpp_value': dart_value_to_local_cpp_value(interface, + context['has_type_checking_interface'], + argument, arg_index, auto_scope), + }) + return context ################################################################################ @@ -241,27 +179,43 @@ # EventTarget::removeEventListener return '%s.get()' % argument_name return argument.name - if (idl_type.is_callback_interface or - idl_type.name in ['NodeFilter', 'XPathNSResolver']): + if (idl_type.name in ['NodeFilter', 'NodeFilterOrNull', + 'XPathNSResolver', 'XPathNSResolverOrNull']): # FIXME: remove this special case return '%s.release()' % argument_name + # Need to de-ref the generated dictionary class for create call. + if (idl_type.is_dictionary): + return '*%s' % argument_name return argument_name # Truncate omitted optional arguments arguments = method.arguments[:number_of_arguments] - cpp_arguments = DartUtilities.call_with_arguments(method) + if method.is_constructor: + call_with_values = interface.extended_attributes.get('ConstructorCallWith') + else: + call_with_values = method.extended_attributes.get('CallWith') + cpp_arguments = DartUtilities.call_with_arguments(call_with_values) if ('PartialInterfaceImplementedAs' in method.extended_attributes and not method.is_static): cpp_arguments.append('*receiver') cpp_arguments.extend(cpp_argument(argument) for argument in arguments) - this_union_arguments = method.idl_type.union_arguments + this_union_arguments = method.idl_type and method.idl_type.union_arguments if this_union_arguments: - cpp_arguments.extend(this_union_arguments) + cpp_arguments.extend([member_argument['cpp_value'] + for member_argument in this_union_arguments]) - if 'RaisesException' in method.extended_attributes: + if ('RaisesException' in method.extended_attributes or + (method.is_constructor and + DartUtilities.has_extended_attribute_value(interface, 'RaisesException', 'Constructor'))): cpp_arguments.append('es') - cpp_method_name = DartUtilities.scoped_name(interface, method, DartUtilities.cpp_name(method)) + if method.name == 'Constructor': + base_name = 'create' + elif method.name == 'NamedConstructor': + base_name = 'createForJSConstructor' + else: + base_name = DartUtilities.cpp_name(method) + cpp_method_name = DartUtilities.scoped_name(interface, method, base_name) return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) @@ -276,7 +230,8 @@ def dart_set_return_value(interface_name, method, cpp_value, for_main_world=False): idl_type = method.idl_type extended_attributes = method.extended_attributes - if idl_type.name == 'void': + if not idl_type or idl_type.name == 'void': + # Constructors and void methods don't have a return type return None release = False @@ -301,9 +256,14 @@ auto_scope=auto_scope) -def dart_value_to_local_cpp_value(interface, argument, index, auto_scope=True): +def dart_dictionary_value_argument(argument, index): + idl_type = argument.idl_type + return idl_type.dart_dictionary_to_local_cpp_value(index=index) + + +def dart_value_to_local_cpp_value(interface, has_type_checking_interface, + argument, index, auto_scope=True): extended_attributes = argument.extended_attributes - interface_extended_attributes = interface.extended_attributes idl_type = argument.idl_type name = argument.name # TODO(terry): Variadic arguments are not handled but treated as one argument. @@ -317,51 +277,10 @@ # There is also some logic in systemnative.py to force a null check # for the useCapture argument of those same methods that we may need to # pull over. - null_check = (argument.is_optional and \ - (idl_type.is_callback_interface or idl_type == 'Dictionary')) or \ - (argument.default_value and argument.default_value.is_null) + null_check = ((argument.is_optional and idl_type.is_callback_interface) or + (idl_type.name == 'Dictionary') or + (argument.default_value and argument.default_value.is_null)) return idl_type.dart_value_to_local_cpp_value( - interface_extended_attributes, extended_attributes, name, null_check, + extended_attributes, name, null_check, has_type_checking_interface, index=index, auto_scope=auto_scope) - - -################################################################################ -# Auxiliary functions -################################################################################ - -# [NotEnumerable] -def property_attributes(method): - extended_attributes = method.extended_attributes - property_attributes_list = [] - if 'NotEnumerable' in extended_attributes: - property_attributes_list.append('v8::DontEnum') - if 'ReadOnly' in extended_attributes: - property_attributes_list.append('v8::ReadOnly') - if property_attributes_list: - property_attributes_list.insert(0, 'v8::DontDelete') - return property_attributes_list - - -# FIXMEDART: better align this method with the v8 version. -def union_member_argument_context(idl_type, index): - """Returns a context of union member for argument.""" - return 'result%d' % index - -def union_arguments(idl_type): - return [union_member_argument_context(member_idl_type, index) - for index, member_idl_type - in enumerate(idl_type.member_types)] - - -def argument_default_cpp_value(argument): - if not argument.default_value: - return None - return argument.idl_type.literal_cpp_value(argument.default_value) - - -IdlTypeBase.union_arguments = None -IdlUnionType.union_arguments = property(union_arguments) -IdlArgument.default_cpp_value = property(argument_default_cpp_value) -#IdlType.union_arguments = property(lambda self: None) -#IdlUnionType.union_arguments = property(union_arguments)
diff --git a/bindings/dart/scripts/dart_types.py b/bindings/dart/scripts/dart_types.py index 5078460..7ae64fc 100644 --- a/bindings/dart/scripts/dart_types.py +++ b/bindings/dart/scripts/dart_types.py
@@ -38,9 +38,9 @@ """ import posixpath -from idl_types import IdlTypeBase, IdlType, IdlUnionType, TYPE_NAMES, IdlArrayOrSequenceType +from idl_types import IdlTypeBase, IdlType, IdlUnionType, TYPE_NAMES, IdlArrayOrSequenceType, IdlSequenceType -import dart_attributes # for IdlType.constructor_type_name +import dart_attributes from dart_utilities import DartUtilities from v8_globals import includes @@ -50,11 +50,9 @@ ################################################################################ NON_WRAPPER_TYPES = frozenset([ - 'CompareHow', 'Dictionary', 'EventHandler', 'EventListener', - 'MediaQueryListListener', 'NodeFilter', 'SerializedScriptValue', ]) @@ -105,11 +103,10 @@ 'unsigned short', ]) CPP_SPECIAL_CONVERSION_RULES = { - 'CompareHow': 'Range::CompareHow', 'Date': 'double', 'Dictionary': 'Dictionary', 'EventHandler': 'EventListener*', - 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', + 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', 'Promise': 'ScriptPromise', 'ScriptValue': 'ScriptValue', # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345529 @@ -120,7 +117,7 @@ } -def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_type=False, used_in_cpp_sequence=False): +def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_rvalue_type=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): """Returns C++ type corresponding to IDL type. |idl_type| argument is of type IdlType, while return value is a string @@ -169,8 +166,6 @@ if idl_type.is_typed_array_type and raw_type: return 'RefPtr<%s>' % base_idl_type - if idl_type.is_callback_interface: - return 'OwnPtr<%s>' % base_idl_type if idl_type.is_interface_type: implemented_as_class = idl_type.implemented_as if raw_type: @@ -180,6 +175,11 @@ return cpp_template_type(ptr_type, implemented_as_class) # Default, assume native type is a pointer with same type name as idl type + + # FIXME: How to handle sequence<WebGLShader>? + if base_idl_type is None: + base_idl_type = idl_type.inner_type.element_type.base_type + return base_idl_type + '*' @@ -198,6 +198,8 @@ IdlArrayOrSequenceType.native_array_element_type = property( lambda self: self.element_type) +IdlTypeBase.enum_validation_expression = property(DartUtilities.enum_validation_expression) + def cpp_template_type(template, inner_type): """Returns C++ template specialized to type, with space added if needed.""" @@ -295,7 +297,6 @@ # TODO(terry): Will we need this group header for dart:blink? INCLUDES_FOR_TYPE = { 'object': set(), - 'CompareHow': set(), 'Dictionary': set(['bindings/core/v8/Dictionary.h']), 'EventHandler': set(), 'EventListener': set(), @@ -303,15 +304,15 @@ 'core/dom/ClassCollection.h', 'core/dom/TagCollection.h', 'core/html/HTMLCollection.h', + 'core/html/HTMLDataListOptionsCollection.h', 'core/html/HTMLFormControlsCollection.h', 'core/html/HTMLTableRowsCollection.h']), - 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), 'NodeList': set(['bindings/core/dart/DartNodeList.h', 'core/dom/NameNodeList.h', 'core/dom/NodeList.h', 'core/dom/StaticNodeList.h', 'core/html/LabelsNodeList.h']), - 'Promise': set(), + 'Promise': set(['bindings/core/dart/DartScriptPromise.h']), 'SerializedScriptValue': set(), 'ScriptValue': set(['bindings/core/dart/DartScriptValue.h']), } @@ -405,12 +406,10 @@ 'long long': 'DartUtilities::dartToLongLong(args, {index}, exception)', 'unsigned long long': 'DartUtilities::dartToUnsignedLongLong(args, {index}, exception)', # Interface types - 'CompareHow': 'static_cast<Range::CompareHow>(0) /* FIXME, DART_TO_CPP_VALUE[CompareHow] */', 'Dictionary': 'DartUtilities::dartToDictionary{null_check}(args, {index}, exception)', 'EventTarget': '0 /* FIXME, DART_TO_CPP_VALUE[EventTarget] */', - 'MediaQueryListListener': 'nullptr /* FIXME, DART_TO_CPP_VALUE[MediaQueryListener] */', 'NodeFilter': 'nullptr /* FIXME, DART_TO_CPP_VALUE[NodeFilter] */', - 'Promise': 'nullptr /* FIXME, DART_TO_CPP_VALUE[Promise] */', + 'Promise': 'DartUtilities::dartToScriptPromise{null_check}(args, {index})', 'SerializedScriptValue': 'nullptr /* FIXME, DART_TO_CPP_VALUE[SerializedScriptValue] */', 'ScriptValue': 'DartUtilities::dartToScriptValue{null_check}(args, {index})', # FIXME(vsm): Why don't we have an entry for Window? V8 does. @@ -423,8 +422,28 @@ } -def dart_value_to_cpp_value(idl_type, interface_extended_attributes, extended_attributes, variable_name, - null_check, index, auto_scope=True): +def dart_dictionary_value_argument(idl_type, index): + if idl_type.is_dictionary: + argument_expression_format = 'DartUtilities::dartToDictionaryWithNullCheck(args, {index}, exception)' + return argument_expression_format.format(index=index) + + return None + + +def dart_dictionary_to_local_cpp_value(idl_type, index=None): + """Returns an expression that converts a Dictionary value as a local value.""" + idl_type = idl_type.preprocessed_type + + cpp_value = dart_dictionary_value_argument(idl_type, index) + + return cpp_value + +IdlTypeBase.dart_dictionary_to_local_cpp_value = dart_dictionary_to_local_cpp_value + + +def dart_value_to_cpp_value(idl_type, extended_attributes, variable_name, + null_check, has_type_checking_interface, + index, auto_scope=True): # Composite types native_array_element_type = idl_type.native_array_element_type if native_array_element_type: @@ -453,15 +472,22 @@ cpp_expression_format = ('DartUtilities::dartTo{idl_type}WithNullCheck(args, {index}, exception)') elif idl_type.is_callback_interface: cpp_expression_format = ('Dart{idl_type}::create{null_check}(args, {index}, exception)') + elif idl_type.is_dictionary: + # Value of dictionary is defined in method dart_dictionary_value_argument. + cpp_expression_format = 'Dart{idl_type}::toImpl(dictionary, es)' else: cpp_expression_format = ('Dart{idl_type}::toNative{null_check}(args, {index}, exception)') # We allow the calling context to force a null check to handle # some cases that require calling context info. V8 handles all # of this differently, and we may wish to reconsider this approach - null_check = 'WithNullCheck' \ - if null_check or allow_null(idl_type, interface_extended_attributes, extended_attributes) else '' - return cpp_expression_format.format(null_check=null_check, + check_string = '' + if null_check or allow_null(idl_type, extended_attributes, + has_type_checking_interface): + check_string = 'WithNullCheck' + elif allow_empty(idl_type, extended_attributes): + check_string = 'WithEmptyCheck' + return cpp_expression_format.format(null_check=check_string, arguments=arguments, index=index, idl_type=base_idl_type, @@ -480,7 +506,7 @@ this_cpp_type = None ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_type.gc_type) # FIXME(vsm): We're not using ref_ptr_type.... - expression_format = 'DartUtilities::toNativeVector<{cpp_type} >(args, {index}, {variable_name}, exception)' + expression_format = 'DartUtilities::toNativeVector<{native_array_element_type} >(args, {index}, {variable_name}, exception)' add_includes_for_type(native_array_element_type) else: ref_ptr_type = None @@ -492,14 +518,17 @@ variable_name=variable_name) return expression -def dart_value_to_local_cpp_value(idl_type, interface_extended_attributes, extended_attributes, - variable_name, null_check, index=None, auto_scope=True): + +def dart_value_to_local_cpp_value(idl_type, extended_attributes, variable_name, + null_check, has_type_checking_interface, + index=None, auto_scope=True): """Returns an expression that converts a Dart value to a C++ value as a local value.""" idl_type = idl_type.preprocessed_type cpp_value = dart_value_to_cpp_value( - idl_type, interface_extended_attributes, extended_attributes, - variable_name, null_check, index, auto_scope) + idl_type, extended_attributes, variable_name, + null_check, has_type_checking_interface, + index, auto_scope) return cpp_value @@ -532,7 +561,8 @@ """Returns IDL type and value, with preliminary type conversions applied.""" idl_type = idl_type.preprocessed_type if idl_type.name == 'Promise': - idl_type = IdlType('ScriptValue') + idl_type = IdlType('ScriptPromise') + # FIXME(vsm): V8 maps 'long long' and 'unsigned long long' to double # as they are not representable in ECMAScript. Should we do the same? @@ -559,6 +589,11 @@ # Composite types native_array_element_type = idl_type.native_array_element_type + + # FIXME: Work around sequence behaving like an array. + if (not native_array_element_type) and type(idl_type.inner_type) is IdlSequenceType: + native_array_element_type = idl_type.inner_type.native_array_element_type + if native_array_element_type: if native_array_element_type.is_interface_type: add_includes_for_type(native_array_element_type) @@ -571,7 +606,9 @@ return 'int' if base_idl_type in CPP_UNSIGNED_TYPES or base_idl_type == 'unsigned long long': return 'unsigned' - if base_idl_type == 'DOMString': + if idl_type.is_string_type: + if idl_type.is_nullable: + return 'StringOrNull' if 'TreatReturnedNullStringAs' not in extended_attributes: return 'DOMString' treat_returned_null_string_as = extended_attributes['TreatReturnedNullStringAs'] @@ -625,6 +662,7 @@ 'array': 'Dart_SetReturnValue(args, {cpp_value})', 'Date': 'Dart_SetReturnValue(args, {cpp_value})', 'EventHandler': DART_FIX_ME, + 'ScriptPromise': 'Dart_SetReturnValue(args, {cpp_value})', 'ScriptValue': 'Dart_SetReturnValue(args, {cpp_value})', 'SerializedScriptValue': DART_FIX_ME, # DOMWrapper @@ -657,7 +695,7 @@ idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes) this_dart_conversion_type = idl_type.dart_conversion_type(extended_attributes) # SetReturn-specific overrides - if this_dart_conversion_type in ['Date', 'EventHandler', 'ScriptValue', 'SerializedScriptValue', 'array']: + if this_dart_conversion_type in ['Date', 'EventHandler', 'ScriptPromise', 'ScriptValue', 'SerializedScriptValue', 'array']: # Convert value to Dart and then use general Dart_SetReturnValue # FIXME(vsm): Why do we differ from V8 here? It doesn't have a # creation_context. @@ -696,7 +734,6 @@ release: can be either False (False for all member types) or a sequence (list or tuple) of booleans (if specified individually). """ - return [ # FIXME(vsm): Why do we use 'result' instead of cpp_value as V8? member_type.dart_set_return_value('result' + str(i), @@ -734,6 +771,7 @@ # Special cases 'EventHandler': '-----OOPS TO DART-EVENT---', # We need to generate the NullCheck version in some cases. + 'ScriptPromise': 'DartUtilities::scriptPromiseToDart({cpp_value})', 'ScriptValue': 'DartUtilities::scriptValueToDart({cpp_value})', 'SerializedScriptValue': 'DartUtilities::serializedScriptValueToDart({cpp_value})', # General @@ -755,6 +793,75 @@ IdlTypeBase.cpp_value_to_dart_value = cpp_value_to_dart_value +# FIXME(leafp) This is horrible, we should do better, but currently this is hard to do +# in a nice way. Best solution might be to extend DartStringAdapter to accomodate +# initialization from constant strings, but better to do that once we're stable +# on the bots so we can track any performance regression +CPP_LITERAL_TO_DART_VALUE = { + 'DOMString': {'nullptr': 'DartStringAdapter(DartStringPeer::nullString())', + 'String("")': 'DartStringAdapter(DartStringPeer::emptyString())', + '*': 'DartUtilities::dartToString(DartUtilities::stringToDart({cpp_literal}), exception)'}, + 'ScalarValueString': {'nullptr': 'DartStringAdapter(DartStringPeer::nullString())', + 'String("")': 'DartStringAdapter(DartStringPeer::emptyString())', + '*': 'DartUtilities::dartToScalarValueString(DartUtilities::stringToDart({cpp_literal}), exception)'}, +} + + +def literal_cpp_value(idl_type, idl_literal): + """Converts an expression that is a valid C++ literal for this type.""" + # FIXME: add validation that idl_type and idl_literal are compatible + literal_value = str(idl_literal) + base_type = idl_type.preprocessed_type.base_type + if base_type in CPP_UNSIGNED_TYPES: + return literal_value + 'u' + if base_type in CPP_LITERAL_TO_DART_VALUE: + if literal_value in CPP_LITERAL_TO_DART_VALUE[base_type]: + format_string = CPP_LITERAL_TO_DART_VALUE[base_type][literal_value] + else: + format_string = CPP_LITERAL_TO_DART_VALUE[base_type]['*'] + return format_string.format(cpp_literal=literal_value) + return literal_value + +IdlType.literal_cpp_value = literal_cpp_value + + +CPP_DEFAULT_VALUE_FOR_CPP_TYPE = { + 'DOMString': 'DartStringAdapter(DartStringPeer::emptyString())', + 'ByteString': 'DartStringAdapter(DartStringPeer::emptyString())', + 'ScalarValueString': 'DartStringAdapter(DartStringPeer::emptyString())', + 'boolean': 'false', + 'float': '0.0f', + 'unrestricted float': '0.0f', + 'double': '0.0', + 'unrestricted double': '0.0', + 'byte': '0', + 'octet': '0', + 'short': '0', + 'unsigned short': '0', + 'long': '0', + 'unsigned long': '0', + 'long long': '0', + 'unsigned long long': '0', + 'Dictionary': 'Dictionary()', + 'ScriptValue': 'DartUtilities::dartToScriptValueWithNullCheck(Dart_Null())', + 'MediaQueryListListener': 'nullptr', + 'NodeFilter': 'nullptr', + 'SerializedScriptValue': 'nullptr', + 'XPathNSResolver': 'nullptr', +} + + +def default_cpp_value_for_cpp_type(idl_type): + idl_type = idl_type.preprocessed_type + add_includes_for_type(idl_type) + base_idl_type = idl_type.base_type + if base_idl_type in CPP_DEFAULT_VALUE_FOR_CPP_TYPE: + return CPP_DEFAULT_VALUE_FOR_CPP_TYPE[base_idl_type] + if base_idl_type in NON_WRAPPER_TYPES: + return 'nullptr' + format_str = 'Dart{idl_type}::toNativeWithNullCheck(Dart_Null(), exception)' + return format_str.format(idl_type=idl_type) + # Override idl_type.name to not suffix orNull to the name, in Dart we always # test for null e.g., @@ -779,19 +886,8 @@ IdlUnionType.name = property(dart_name) -def typechecked_interface(extended_attributes): - return ('TypeChecking' in extended_attributes and\ - DartUtilities.extended_attribute_value_contains(extended_attributes['TypeChecking'], 'Interface')) - - -def typechecked_argument(idl_type, interface_extended_attributes, extended_attributes): - return (idl_type.is_wrapper_type and - (typechecked_interface(interface_extended_attributes) or - (typechecked_interface(extended_attributes)))) - - # If True use the WithNullCheck version when converting. -def allow_null(idl_type, interface_extended_attributes, extended_attributes): +def allow_null(idl_type, extended_attributes, has_type_checking_interface): if idl_type.base_type in ('DOMString', 'ByteString', 'ScalarValueString'): # This logic is in cpp_types in v8_types.py, since they handle # this using the V8StringResource type. We handle it here @@ -811,11 +907,25 @@ return False else: # This logic is implemented in the methods.cpp template in V8 - if (idl_type.is_nullable or - (not typechecked_argument(idl_type, interface_extended_attributes, extended_attributes))): + if (idl_type.is_nullable or not has_type_checking_interface): return True if extended_attributes.get('Default') == 'Undefined': return True return False + + +# If True use the WithEmptyCheck version when converting. +def allow_empty(idl_type, extended_attributes): + if idl_type.base_type in ('DOMString', 'ByteString', 'ScalarValueString'): + # This logic is in cpp_types in v8_types.py, since they handle + # this using the V8StringResource type. We handle it here + if (extended_attributes.get('TreatNullAs') == 'EmptyString' or + extended_attributes.get('TreatUndefinedAs') == 'EmptyString'): + return True + + if extended_attributes.get('Default') == 'EmptyString': + return True + + return False
diff --git a/bindings/dart/scripts/dart_utilities.py b/bindings/dart/scripts/dart_utilities.py index 4f888d6..c9f4fa5 100644 --- a/bindings/dart/scripts/dart_utilities.py +++ b/bindings/dart/scripts/dart_utilities.py
@@ -44,6 +44,14 @@ import v8_utilities +def _enum_validation_expression(idl_type): + # FIXME: Add IdlEnumType, move property to derived type, and remove this check + if not idl_type.is_enum: + return None + return ' || '.join(['((String){param_name}) == "%s"' % enum_value + for enum_value in idl_type.enum_values]) + + def _scoped_name(interface, definition, base_name): # partial interfaces are implemented as separate classes, with their members # implemented as static member functions @@ -90,6 +98,7 @@ 'ScriptArguments': 'scriptArguments.release()', 'ActiveWindow': 'DartUtilities::callingDomWindowForCurrentIsolate()', 'FirstWindow': 'DartUtilities::enteredDomWindowForCurrentIsolate()', + 'Document': 'document', } # List because key order matters, as we want arguments in deterministic order @@ -99,12 +108,11 @@ 'ScriptArguments', 'ActiveWindow', 'FirstWindow', + 'Document', ] -def _call_with_arguments(member, call_with_values=None): - # Optional parameter so setter can override with [SetterCallWith] - call_with_values = call_with_values or member.extended_attributes.get('CallWith') +def _call_with_arguments(call_with_values): if not call_with_values: return [] return [_CALL_WITH_ARGUMENTS[value] @@ -132,36 +140,36 @@ return extended_attributes['MeasureAs'] -def _generate_native_entry(interface_name, thing, name, kind, - optional_index, args, types): - index = thing.get('overload_index') or optional_index - is_static = bool(thing.get('is_static')) - tag = "" +def _generate_native_entry(interface_name, name, kind, is_static, arity): + + def mkPublic(s): + if s.startswith("_") or s.startswith("$"): + return "$" + s + return s + + arity_str = "" if kind == 'Getter': - tag = "%s_Getter" % name - blink_entry = tag + suffix = "_Getter" elif kind == 'Setter': - tag = "%s_Setter" % name - blink_entry = tag + suffix = "_Setter" elif kind == 'Constructor': - tag = "constructorCallback" - blink_entry = tag - if index is not None: - blink_entry = "_create_%s%s" % (index, blink_entry) + name = "constructor" + suffix = "Callback" + arity_str = "_" + str(arity) elif kind == 'Method': - tag = "%s_Callback" % name - if index is None: - blink_entry = tag - else: - blink_entry = "_%s_%d_Callback" % (name, index) - components = [interface_name, tag] - if types is not None: - components.extend(types) - native_entry = "_".join(components) + suffix = "_Callback" + arity_str = "_" + str(arity) + + tag = "%s%s" % (name, suffix) + blink_entry = mkPublic(tag + arity_str) + native_entry = "_".join([interface_name, tag]) + + argument_names = ['__arg_%d' % i for i in range(0, arity)] if not is_static and kind != 'Constructor': - args.insert(0, "mthis") - return {'blink_entry': "$" + blink_entry, - 'argument_names': args, + argument_names.insert(0, "mthis") + + return {'blink_entry': blink_entry, + 'argument_names': argument_names, 'resolver_string': native_entry} ################################################################################ @@ -184,6 +192,7 @@ DartUtilities.cpp_name = v8_utilities.cpp_name DartUtilities.deprecate_as = _deprecate_as DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribute_value_contains +DartUtilities.enum_validation_expression = _enum_validation_expression DartUtilities.gc_type = v8_utilities.gc_type DartUtilities.generate_native_entry = _generate_native_entry DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute
diff --git a/bindings/dart/scripts/idl_files.py b/bindings/dart/scripts/idl_files.py index 8a15e54..cbb4157 100644 --- a/bindings/dart/scripts/idl_files.py +++ b/bindings/dart/scripts/idl_files.py
@@ -1,5 +1,6 @@ -# TODO(terry): Temporary file. Process will be driven by GYP not this file. -# List of IDL files from Source/core/core.gypi and Source/modules/modules.gypi +# Testing file for use to debug IDL parsing and code gen in Eclipse. +# Update list of IDL files from Source/core/core.gypi and +# Source/modules/modules.gypi import os @@ -15,450 +16,460 @@ # This list is copied from Source/core/core.gypi 'core_idl_files' # Core IDL files bindings (.dart, .cpp and .h files) will be generated core_idl_files = [ - 'animation/Animation.idl', - 'animation/AnimationEffect.idl', - 'animation/AnimationPlayer.idl', - 'animation/AnimationNode.idl', - 'animation/AnimationTimeline.idl', - 'animation/Timing.idl', - 'clipboard/DataTransfer.idl', - 'clipboard/DataTransferItem.idl', - 'clipboard/DataTransferItemList.idl', - 'css/CSS.idl', - 'css/CSSCharsetRule.idl', - 'css/CSSFontFaceLoadEvent.idl', - 'css/CSSFontFaceRule.idl', - 'css/CSSImportRule.idl', - 'css/CSSKeyframeRule.idl', - 'css/CSSKeyframesRule.idl', - 'css/CSSMediaRule.idl', - 'css/CSSPageRule.idl', - 'css/CSSPrimitiveValue.idl', - 'css/CSSRule.idl', - 'css/CSSRuleList.idl', - 'css/CSSStyleDeclaration.idl', - 'css/CSSStyleRule.idl', - 'css/CSSStyleSheet.idl', - 'css/CSSSupportsRule.idl', - 'css/CSSUnknownRule.idl', - 'css/CSSValue.idl', - 'css/CSSValueList.idl', - 'css/CSSViewportRule.idl', - 'css/Counter.idl', - 'css/FontFace.idl', - 'css/FontFaceSet.idl', - 'css/FontFaceSetForEachCallback.idl', - 'css/MediaList.idl', - 'css/MediaQueryList.idl', - 'css/RGBColor.idl', - 'css/Rect.idl', - 'css/StyleMedia.idl', - 'css/StyleSheet.idl', - 'css/StyleSheetList.idl', - 'css/WebKitCSSFilterRule.idl', - 'css/WebKitCSSFilterValue.idl', - 'css/WebKitCSSMatrix.idl', - 'css/WebKitCSSTransformValue.idl', - 'dom/Attr.idl', - 'dom/CDATASection.idl', - 'dom/CharacterData.idl', - 'dom/ClientRect.idl', - 'dom/ClientRectList.idl', - 'dom/Comment.idl', - 'dom/DOMError.idl', - 'dom/DOMException.idl', - 'dom/DOMImplementation.idl', - 'dom/DOMSettableTokenList.idl', - 'dom/DOMStringList.idl', - 'dom/DOMStringMap.idl', - 'dom/DOMTokenList.idl', - 'dom/Document.idl', - 'dom/DocumentFragment.idl', - 'dom/DocumentType.idl', - 'dom/Element.idl', - 'dom/MessageChannel.idl', - 'dom/MessagePort.idl', - 'dom/MutationObserver.idl', - 'dom/MutationRecord.idl', - 'dom/NamedNodeMap.idl', - 'dom/Node.idl', - 'dom/NodeFilter.idl', - 'dom/NodeIterator.idl', - 'dom/NodeList.idl', - 'dom/Notation.idl', - 'dom/ProcessingInstruction.idl', - 'dom/Range.idl', - 'dom/RequestAnimationFrameCallback.idl', - 'dom/StringCallback.idl', - 'dom/Text.idl', - 'dom/Touch.idl', - 'dom/TouchList.idl', - 'dom/TreeWalker.idl', - 'dom/URL.idl', - 'dom/XMLDocument.idl', - 'dom/shadow/ShadowRoot.idl', - 'events/AnimationPlayerEvent.idl', - 'events/ApplicationCacheErrorEvent.idl', - 'events/AutocompleteErrorEvent.idl', - 'events/BeforeUnloadEvent.idl', - 'events/CompositionEvent.idl', - 'events/CustomEvent.idl', - 'events/ErrorEvent.idl', - 'events/Event.idl', - 'events/EventTarget.idl', - 'events/FocusEvent.idl', - 'events/HashChangeEvent.idl', - 'events/KeyboardEvent.idl', - 'events/MessageEvent.idl', - 'events/MouseEvent.idl', - 'events/MutationEvent.idl', - 'events/OverflowEvent.idl', - 'events/PageTransitionEvent.idl', - 'events/PopStateEvent.idl', - 'events/ProgressEvent.idl', - 'events/ResourceProgressEvent.idl', - 'events/SecurityPolicyViolationEvent.idl', - 'events/TextEvent.idl', - 'events/TouchEvent.idl', - 'events/TransitionEvent.idl', - 'events/UIEvent.idl', - 'events/WebKitAnimationEvent.idl', - 'events/WheelEvent.idl', - 'fileapi/Blob.idl', - 'fileapi/File.idl', - 'fileapi/FileError.idl', - 'fileapi/FileList.idl', - 'fileapi/FileReader.idl', - 'fileapi/FileReaderSync.idl', - 'fileapi/Stream.idl', - 'frame/BarProp.idl', - 'frame/Console.idl', - 'frame/ConsoleBase.idl', - 'frame/History.idl', - 'frame/ImageBitmap.idl', - 'frame/Location.idl', - 'frame/Navigator.idl', - 'frame/Screen.idl', - 'frame/WebKitPoint.idl', - 'frame/Window.idl', - 'html/FormData.idl', - 'html/HTMLAllCollection.idl', - 'html/HTMLAnchorElement.idl', - 'html/HTMLAppletElement.idl', - 'html/HTMLAreaElement.idl', - 'html/HTMLAudioElement.idl', - 'html/HTMLBRElement.idl', - 'html/HTMLBaseElement.idl', - 'html/HTMLBodyElement.idl', - 'html/HTMLButtonElement.idl', - 'html/HTMLCanvasElement.idl', - 'html/HTMLCollection.idl', - 'html/HTMLContentElement.idl', - 'html/HTMLDListElement.idl', - 'html/HTMLDataListElement.idl', - 'html/HTMLDetailsElement.idl', - 'html/HTMLDialogElement.idl', - 'html/HTMLDirectoryElement.idl', - 'html/HTMLDivElement.idl', - 'html/HTMLDocument.idl', - 'html/HTMLElement.idl', - 'html/HTMLEmbedElement.idl', - 'html/HTMLFieldSetElement.idl', - 'html/HTMLFontElement.idl', - 'html/HTMLFormControlsCollection.idl', - 'html/HTMLFormElement.idl', - 'html/HTMLFrameElement.idl', - 'html/HTMLFrameSetElement.idl', - 'html/HTMLHRElement.idl', - 'html/HTMLHeadElement.idl', - 'html/HTMLHeadingElement.idl', - 'html/HTMLHtmlElement.idl', - 'html/HTMLIFrameElement.idl', - 'html/HTMLImageElement.idl', - 'html/HTMLInputElement.idl', - 'html/HTMLKeygenElement.idl', - 'html/HTMLLIElement.idl', - 'html/HTMLLabelElement.idl', - 'html/HTMLLegendElement.idl', - 'html/HTMLLinkElement.idl', - 'html/HTMLMapElement.idl', - 'html/HTMLMarqueeElement.idl', - 'html/HTMLMediaElement.idl', - 'html/HTMLMenuElement.idl', - 'html/HTMLMetaElement.idl', - 'html/HTMLMeterElement.idl', - 'html/HTMLModElement.idl', - 'html/HTMLOListElement.idl', - 'html/HTMLObjectElement.idl', - 'html/HTMLOptGroupElement.idl', - 'html/HTMLOptionElement.idl', - 'html/HTMLOptionsCollection.idl', - 'html/HTMLOutputElement.idl', - 'html/HTMLParagraphElement.idl', - 'html/HTMLParamElement.idl', - 'html/HTMLPictureElement.idl', - 'html/HTMLPreElement.idl', - 'html/HTMLProgressElement.idl', - 'html/HTMLQuoteElement.idl', - 'html/HTMLScriptElement.idl', - 'html/HTMLSelectElement.idl', - 'html/HTMLShadowElement.idl', - 'html/HTMLSourceElement.idl', - 'html/HTMLSpanElement.idl', - 'html/HTMLStyleElement.idl', - 'html/HTMLTableCaptionElement.idl', - 'html/HTMLTableCellElement.idl', - 'html/HTMLTableColElement.idl', - 'html/HTMLTableElement.idl', - 'html/HTMLTableRowElement.idl', - 'html/HTMLTableSectionElement.idl', - 'html/HTMLTemplateElement.idl', - 'html/HTMLTextAreaElement.idl', - 'html/HTMLTitleElement.idl', - 'html/HTMLTrackElement.idl', - 'html/HTMLUListElement.idl', - 'html/HTMLUnknownElement.idl', - 'html/HTMLVideoElement.idl', - 'html/ImageData.idl', - 'html/MediaController.idl', - 'html/MediaError.idl', - 'html/MediaKeyError.idl', - 'html/MediaKeyEvent.idl', - 'html/RadioNodeList.idl', - 'html/TextMetrics.idl', - 'html/TimeRanges.idl', - 'html/ValidityState.idl', - 'html/VoidCallback.idl', - 'html/canvas/ANGLEInstancedArrays.idl', - 'html/canvas/Canvas2DContextAttributes.idl', - 'html/canvas/CanvasGradient.idl', - 'html/canvas/CanvasPattern.idl', - 'html/canvas/CanvasRenderingContext2D.idl', - 'html/canvas/EXTBlendMinMax.idl', - 'html/canvas/EXTFragDepth.idl', - 'html/canvas/EXTShaderTextureLOD.idl', - 'html/canvas/EXTTextureFilterAnisotropic.idl', - 'html/canvas/OESElementIndexUint.idl', - 'html/canvas/OESStandardDerivatives.idl', - 'html/canvas/OESTextureFloat.idl', - 'html/canvas/OESTextureFloatLinear.idl', - 'html/canvas/OESTextureHalfFloat.idl', - 'html/canvas/OESTextureHalfFloatLinear.idl', - 'html/canvas/OESVertexArrayObject.idl', - 'html/canvas/Path2D.idl', - 'html/canvas/WebGLActiveInfo.idl', - 'html/canvas/WebGLBuffer.idl', - 'html/canvas/WebGLCompressedTextureATC.idl', - 'html/canvas/WebGLCompressedTextureETC1.idl', - 'html/canvas/WebGLCompressedTexturePVRTC.idl', - 'html/canvas/WebGLCompressedTextureS3TC.idl', - 'html/canvas/WebGLContextAttributes.idl', - 'html/canvas/WebGLContextEvent.idl', - 'html/canvas/WebGLDebugRendererInfo.idl', - 'html/canvas/WebGLDebugShaders.idl', - 'html/canvas/WebGLDepthTexture.idl', - 'html/canvas/WebGLDrawBuffers.idl', - 'html/canvas/WebGLFramebuffer.idl', - 'html/canvas/WebGLLoseContext.idl', - 'html/canvas/WebGLProgram.idl', - 'html/canvas/WebGLRenderbuffer.idl', - 'html/canvas/WebGLRenderingContext.idl', - 'html/canvas/WebGLShader.idl', - 'html/canvas/WebGLShaderPrecisionFormat.idl', - 'html/canvas/WebGLTexture.idl', - 'html/canvas/WebGLUniformLocation.idl', - 'html/canvas/WebGLVertexArrayObjectOES.idl', - 'html/ime/InputMethodContext.idl', - 'html/track/AudioTrack.idl', - 'html/track/AudioTrackList.idl', - 'html/track/TextTrack.idl', - 'html/track/TextTrackCue.idl', - 'html/track/TextTrackCueList.idl', - 'html/track/TextTrackList.idl', - 'html/track/TrackEvent.idl', - 'html/track/VideoTrack.idl', - 'html/track/VideoTrackList.idl', - 'html/track/vtt/VTTCue.idl', - 'html/track/vtt/VTTRegion.idl', - 'html/track/vtt/VTTRegionList.idl', - 'inspector/InjectedScriptHost.idl', - 'inspector/InspectorFrontendHost.idl', - 'inspector/InspectorOverlayHost.idl', - 'inspector/JavaScriptCallFrame.idl', - 'loader/appcache/ApplicationCache.idl', - 'page/EventSource.idl', - 'page/PagePopupController.idl', - 'page/Selection.idl', - 'plugins/MimeType.idl', - 'plugins/MimeTypeArray.idl', - 'plugins/Plugin.idl', - 'plugins/PluginArray.idl', - 'storage/Storage.idl', - 'storage/StorageEvent.idl', - 'svg/SVGAElement.idl', - 'svg/SVGAltGlyphDefElement.idl', - 'svg/SVGAltGlyphElement.idl', - 'svg/SVGAltGlyphItemElement.idl', - 'svg/SVGAngle.idl', - 'svg/SVGAnimateElement.idl', - 'svg/SVGAnimateMotionElement.idl', - 'svg/SVGAnimateTransformElement.idl', - 'svg/SVGAnimatedAngle.idl', - 'svg/SVGAnimatedBoolean.idl', - 'svg/SVGAnimatedEnumeration.idl', - 'svg/SVGAnimatedInteger.idl', - 'svg/SVGAnimatedLength.idl', - 'svg/SVGAnimatedLengthList.idl', - 'svg/SVGAnimatedNumber.idl', - 'svg/SVGAnimatedNumberList.idl', - 'svg/SVGAnimatedPreserveAspectRatio.idl', - 'svg/SVGAnimatedRect.idl', - 'svg/SVGAnimatedString.idl', - 'svg/SVGAnimatedTransformList.idl', - 'svg/SVGAnimationElement.idl', - 'svg/SVGCircleElement.idl', - 'svg/SVGClipPathElement.idl', - 'svg/SVGComponentTransferFunctionElement.idl', - 'svg/SVGCursorElement.idl', - 'svg/SVGDefsElement.idl', - 'svg/SVGDescElement.idl', - 'svg/SVGDiscardElement.idl', - 'svg/SVGElement.idl', - 'svg/SVGEllipseElement.idl', - 'svg/SVGFEBlendElement.idl', - 'svg/SVGFEColorMatrixElement.idl', - 'svg/SVGFEComponentTransferElement.idl', - 'svg/SVGFECompositeElement.idl', - 'svg/SVGFEConvolveMatrixElement.idl', - 'svg/SVGFEDiffuseLightingElement.idl', - 'svg/SVGFEDisplacementMapElement.idl', - 'svg/SVGFEDistantLightElement.idl', - 'svg/SVGFEDropShadowElement.idl', - 'svg/SVGFEFloodElement.idl', - 'svg/SVGFEFuncAElement.idl', - 'svg/SVGFEFuncBElement.idl', - 'svg/SVGFEFuncGElement.idl', - 'svg/SVGFEFuncRElement.idl', - 'svg/SVGFEGaussianBlurElement.idl', - 'svg/SVGFEImageElement.idl', - 'svg/SVGFEMergeElement.idl', - 'svg/SVGFEMergeNodeElement.idl', - 'svg/SVGFEMorphologyElement.idl', - 'svg/SVGFEOffsetElement.idl', - 'svg/SVGFEPointLightElement.idl', - 'svg/SVGFESpecularLightingElement.idl', - 'svg/SVGFESpotLightElement.idl', - 'svg/SVGFETileElement.idl', - 'svg/SVGFETurbulenceElement.idl', - 'svg/SVGFilterElement.idl', - 'svg/SVGFontElement.idl', - 'svg/SVGFontFaceElement.idl', - 'svg/SVGFontFaceFormatElement.idl', - 'svg/SVGFontFaceNameElement.idl', - 'svg/SVGFontFaceSrcElement.idl', - 'svg/SVGFontFaceUriElement.idl', - 'svg/SVGForeignObjectElement.idl', - 'svg/SVGGElement.idl', - 'svg/SVGGeometryElement.idl', - 'svg/SVGGlyphElement.idl', - 'svg/SVGGlyphRefElement.idl', - 'svg/SVGGradientElement.idl', - 'svg/SVGGraphicsElement.idl', - 'svg/SVGHKernElement.idl', - 'svg/SVGImageElement.idl', - 'svg/SVGLength.idl', - 'svg/SVGLengthList.idl', - 'svg/SVGLineElement.idl', - 'svg/SVGLinearGradientElement.idl', - 'svg/SVGMPathElement.idl', - 'svg/SVGMarkerElement.idl', - 'svg/SVGMaskElement.idl', - 'svg/SVGMatrix.idl', - 'svg/SVGMetadataElement.idl', - 'svg/SVGMissingGlyphElement.idl', - 'svg/SVGNumber.idl', - 'svg/SVGNumberList.idl', - 'svg/SVGPathElement.idl', - 'svg/SVGPathSeg.idl', - 'svg/SVGPathSegArcAbs.idl', - 'svg/SVGPathSegArcRel.idl', - 'svg/SVGPathSegClosePath.idl', - 'svg/SVGPathSegCurvetoCubicAbs.idl', - 'svg/SVGPathSegCurvetoCubicRel.idl', - 'svg/SVGPathSegCurvetoCubicSmoothAbs.idl', - 'svg/SVGPathSegCurvetoCubicSmoothRel.idl', - 'svg/SVGPathSegCurvetoQuadraticAbs.idl', - 'svg/SVGPathSegCurvetoQuadraticRel.idl', - 'svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl', - 'svg/SVGPathSegCurvetoQuadraticSmoothRel.idl', - 'svg/SVGPathSegLinetoAbs.idl', - 'svg/SVGPathSegLinetoHorizontalAbs.idl', - 'svg/SVGPathSegLinetoHorizontalRel.idl', - 'svg/SVGPathSegLinetoRel.idl', - 'svg/SVGPathSegLinetoVerticalAbs.idl', - 'svg/SVGPathSegLinetoVerticalRel.idl', - 'svg/SVGPathSegList.idl', - 'svg/SVGPathSegMovetoAbs.idl', - 'svg/SVGPathSegMovetoRel.idl', - 'svg/SVGPatternElement.idl', - 'svg/SVGPoint.idl', - 'svg/SVGPointList.idl', - 'svg/SVGPolygonElement.idl', - 'svg/SVGPolylineElement.idl', - 'svg/SVGPreserveAspectRatio.idl', - 'svg/SVGRadialGradientElement.idl', - 'svg/SVGRect.idl', - 'svg/SVGRectElement.idl', - 'svg/SVGRenderingIntent.idl', - 'svg/SVGSVGElement.idl', - 'svg/SVGScriptElement.idl', - 'svg/SVGSetElement.idl', - 'svg/SVGStopElement.idl', - 'svg/SVGStringList.idl', - 'svg/SVGStyleElement.idl', - 'svg/SVGSwitchElement.idl', - 'svg/SVGSymbolElement.idl', - 'svg/SVGTSpanElement.idl', - 'svg/SVGTextContentElement.idl', - 'svg/SVGTextElement.idl', - 'svg/SVGTextPathElement.idl', - 'svg/SVGTextPositioningElement.idl', - 'svg/SVGTitleElement.idl', - 'svg/SVGTransform.idl', - 'svg/SVGTransformList.idl', - 'svg/SVGUnitTypes.idl', - 'svg/SVGUseElement.idl', - 'svg/SVGVKernElement.idl', - 'svg/SVGViewElement.idl', - 'svg/SVGViewSpec.idl', - 'svg/SVGZoomEvent.idl', - 'timing/MemoryInfo.idl', - 'timing/Performance.idl', - 'timing/PerformanceEntry.idl', - 'timing/PerformanceMark.idl', - 'timing/PerformanceMeasure.idl', - 'timing/PerformanceNavigation.idl', - 'timing/PerformanceResourceTiming.idl', - 'timing/PerformanceTiming.idl', - 'workers/DedicatedWorkerGlobalScope.idl', - 'workers/SharedWorker.idl', - 'workers/SharedWorkerGlobalScope.idl', - 'workers/Worker.idl', - 'workers/WorkerConsole.idl', - 'workers/WorkerGlobalScope.idl', - 'workers/WorkerLocation.idl', - 'workers/WorkerNavigator.idl', - 'xml/DOMParser.idl', - 'xml/XMLHttpRequest.idl', - 'xml/XMLHttpRequestEventTarget.idl', - 'xml/XMLHttpRequestProgressEvent.idl', - 'xml/XMLHttpRequestUpload.idl', - 'xml/XMLSerializer.idl', - 'xml/XPathEvaluator.idl', - 'xml/XPathExpression.idl', - 'xml/XPathNSResolver.idl', - 'xml/XPathResult.idl', - 'xml/XSLTProcessor.idl', + 'animation/Animation.idl', + 'animation/AnimationEffect.idl', + 'animation/AnimationPlayer.idl', + 'animation/AnimationNode.idl', + 'animation/AnimationTimeline.idl', + 'animation/Timing.idl', + 'clipboard/DataTransfer.idl', + 'clipboard/DataTransferItem.idl', + 'clipboard/DataTransferItemList.idl', + 'css/CSS.idl', + 'css/CSSCharsetRule.idl', + 'css/CSSFontFaceRule.idl', + 'css/CSSImportRule.idl', + 'css/CSSKeyframeRule.idl', + 'css/CSSKeyframesRule.idl', + 'css/CSSMediaRule.idl', + 'css/CSSPageRule.idl', + 'css/CSSPrimitiveValue.idl', + 'css/CSSRule.idl', + 'css/CSSRuleList.idl', + 'css/CSSStyleDeclaration.idl', + 'css/CSSStyleRule.idl', + 'css/CSSStyleSheet.idl', + 'css/CSSSupportsRule.idl', + 'css/CSSUnknownRule.idl', + 'css/CSSValue.idl', + 'css/CSSValueList.idl', + 'css/CSSViewportRule.idl', + 'css/Counter.idl', + 'css/FontFace.idl', + 'css/FontFaceSet.idl', + 'css/FontFaceSetForEachCallback.idl', + 'css/FontFaceSetLoadEvent.idl', + 'css/MediaList.idl', + 'css/MediaQueryList.idl', + 'css/MediaQueryListEvent.idl', + 'css/RGBColor.idl', + 'css/Rect.idl', + 'css/StyleMedia.idl', + 'css/StyleSheet.idl', + 'css/StyleSheetList.idl', + 'css/WebKitCSSFilterRule.idl', + 'css/WebKitCSSFilterValue.idl', + 'css/WebKitCSSMatrix.idl', + 'css/WebKitCSSTransformValue.idl', + 'dom/Attr.idl', + 'dom/CDATASection.idl', + 'dom/CharacterData.idl', + 'dom/ClientRect.idl', + 'dom/ClientRectList.idl', + 'dom/Comment.idl', + 'dom/DOMError.idl', + 'dom/DOMException.idl', + 'dom/DOMImplementation.idl', + 'dom/DOMMatrix.idl', + 'dom/DOMMatrixReadOnly.idl', + 'dom/DOMPoint.idl', + 'dom/DOMPointReadOnly.idl', + 'dom/DOMRect.idl', + 'dom/DOMRectReadOnly.idl', + 'dom/DOMSettableTokenList.idl', + 'dom/DOMStringList.idl', + 'dom/DOMStringMap.idl', + 'dom/DOMTokenList.idl', + 'dom/Document.idl', + 'dom/DocumentFragment.idl', + 'dom/DocumentType.idl', + 'dom/Element.idl', + 'dom/Iterator.idl', + 'dom/MessageChannel.idl', + 'dom/MessagePort.idl', + 'dom/MutationObserver.idl', + 'dom/MutationRecord.idl', + 'dom/NamedNodeMap.idl', + 'dom/Node.idl', + 'dom/NodeFilter.idl', + 'dom/NodeIterator.idl', + 'dom/NodeList.idl', + 'dom/ProcessingInstruction.idl', + 'dom/Range.idl', + 'dom/RequestAnimationFrameCallback.idl', + 'dom/StringCallback.idl', + 'dom/Text.idl', + 'dom/Touch.idl', + 'dom/TouchList.idl', + 'dom/TreeWalker.idl', + 'dom/URL.idl', + 'dom/XMLDocument.idl', + 'dom/shadow/ShadowRoot.idl', + 'editing/Selection.idl', + 'events/AnimationPlayerEvent.idl', + 'events/ApplicationCacheErrorEvent.idl', + 'events/AutocompleteErrorEvent.idl', + 'events/BeforeUnloadEvent.idl', + 'events/CompositionEvent.idl', + 'events/CustomEvent.idl', + 'events/ErrorEvent.idl', + 'events/Event.idl', + 'events/EventTarget.idl', + 'events/FocusEvent.idl', + 'events/HashChangeEvent.idl', + 'events/KeyboardEvent.idl', + 'events/MessageEvent.idl', + 'events/MouseEvent.idl', + 'events/MutationEvent.idl', + 'events/OverflowEvent.idl', + 'events/PageTransitionEvent.idl', + 'events/PopStateEvent.idl', + 'events/ProgressEvent.idl', + 'events/RelatedEvent.idl', + 'events/ResourceProgressEvent.idl', + 'events/SecurityPolicyViolationEvent.idl', + 'events/TextEvent.idl', + 'events/TouchEvent.idl', + 'events/TransitionEvent.idl', + 'events/UIEvent.idl', + 'events/WebKitAnimationEvent.idl', + 'events/WheelEvent.idl', + 'fileapi/Blob.idl', + 'fileapi/File.idl', + 'fileapi/FileError.idl', + 'fileapi/FileList.idl', + 'fileapi/FileReader.idl', + 'fileapi/FileReaderSync.idl', + 'frame/BarProp.idl', + 'frame/Console.idl', + 'frame/ConsoleBase.idl', + 'frame/History.idl', + 'frame/ImageBitmap.idl', + 'frame/Location.idl', + 'frame/Navigator.idl', + 'frame/Screen.idl', + 'frame/Window.idl', + 'html/FormData.idl', + 'html/HTMLAllCollection.idl', + 'html/HTMLAnchorElement.idl', + 'html/HTMLAppletElement.idl', + 'html/HTMLAreaElement.idl', + 'html/HTMLAudioElement.idl', + 'html/HTMLBRElement.idl', + 'html/HTMLBaseElement.idl', + 'html/HTMLBodyElement.idl', + 'html/HTMLButtonElement.idl', + 'html/HTMLCanvasElement.idl', + 'html/HTMLCollection.idl', + 'html/HTMLContentElement.idl', + 'html/HTMLDListElement.idl', + 'html/HTMLDataListElement.idl', + 'html/HTMLDetailsElement.idl', + 'html/HTMLDialogElement.idl', + 'html/HTMLDirectoryElement.idl', + 'html/HTMLDivElement.idl', + 'html/HTMLDocument.idl', + 'html/HTMLElement.idl', + 'html/HTMLEmbedElement.idl', + 'html/HTMLFieldSetElement.idl', + 'html/HTMLFontElement.idl', + 'html/HTMLFormControlsCollection.idl', + 'html/HTMLFormElement.idl', + 'html/HTMLFrameElement.idl', + 'html/HTMLFrameSetElement.idl', + 'html/HTMLHRElement.idl', + 'html/HTMLHeadElement.idl', + 'html/HTMLHeadingElement.idl', + 'html/HTMLHtmlElement.idl', + 'html/HTMLIFrameElement.idl', + 'html/HTMLImageElement.idl', + 'html/HTMLInputElement.idl', + 'html/HTMLKeygenElement.idl', + 'html/HTMLLIElement.idl', + 'html/HTMLLabelElement.idl', + 'html/HTMLLegendElement.idl', + 'html/HTMLLinkElement.idl', + 'html/HTMLMapElement.idl', + 'html/HTMLMarqueeElement.idl', + 'html/HTMLMediaElement.idl', + 'html/HTMLMenuElement.idl', + 'html/HTMLMenuItemElement.idl', + 'html/HTMLMetaElement.idl', + 'html/HTMLMeterElement.idl', + 'html/HTMLModElement.idl', + 'html/HTMLOListElement.idl', + 'html/HTMLObjectElement.idl', + 'html/HTMLOptGroupElement.idl', + 'html/HTMLOptionElement.idl', + 'html/HTMLOptionsCollection.idl', + 'html/HTMLOutputElement.idl', + 'html/HTMLParagraphElement.idl', + 'html/HTMLParamElement.idl', + 'html/HTMLPictureElement.idl', + 'html/HTMLPreElement.idl', + 'html/HTMLProgressElement.idl', + 'html/HTMLQuoteElement.idl', + 'html/HTMLScriptElement.idl', + 'html/HTMLSelectElement.idl', + 'html/HTMLShadowElement.idl', + 'html/HTMLSourceElement.idl', + 'html/HTMLSpanElement.idl', + 'html/HTMLStyleElement.idl', + 'html/HTMLTableCaptionElement.idl', + 'html/HTMLTableCellElement.idl', + 'html/HTMLTableColElement.idl', + 'html/HTMLTableElement.idl', + 'html/HTMLTableRowElement.idl', + 'html/HTMLTableSectionElement.idl', + 'html/HTMLTemplateElement.idl', + 'html/HTMLTextAreaElement.idl', + 'html/HTMLTitleElement.idl', + 'html/HTMLTrackElement.idl', + 'html/HTMLUListElement.idl', + 'html/HTMLUnknownElement.idl', + 'html/HTMLVideoElement.idl', + 'html/ImageData.idl', + 'html/MediaController.idl', + 'html/MediaError.idl', + 'html/MediaKeyError.idl', + 'html/MediaKeyEvent.idl', + 'html/RadioNodeList.idl', + 'html/TextMetrics.idl', + 'html/TimeRanges.idl', + 'html/ValidityState.idl', + 'html/VoidCallback.idl', + 'html/canvas/ANGLEInstancedArrays.idl', + 'html/canvas/Canvas2DContextAttributes.idl', + 'html/canvas/CanvasGradient.idl', + 'html/canvas/CanvasPattern.idl', + 'html/canvas/CanvasRenderingContext2D.idl', + 'html/canvas/EXTBlendMinMax.idl', + 'html/canvas/EXTFragDepth.idl', + 'html/canvas/EXTShaderTextureLOD.idl', + 'html/canvas/EXTTextureFilterAnisotropic.idl', + 'html/canvas/OESElementIndexUint.idl', + 'html/canvas/OESStandardDerivatives.idl', + 'html/canvas/OESTextureFloat.idl', + 'html/canvas/OESTextureFloatLinear.idl', + 'html/canvas/OESTextureHalfFloat.idl', + 'html/canvas/OESTextureHalfFloatLinear.idl', + 'html/canvas/OESVertexArrayObject.idl', + 'html/canvas/Path2D.idl', + 'html/canvas/WebGLActiveInfo.idl', + 'html/canvas/WebGLBuffer.idl', + 'html/canvas/WebGLCompressedTextureATC.idl', + 'html/canvas/WebGLCompressedTextureETC1.idl', + 'html/canvas/WebGLCompressedTexturePVRTC.idl', + 'html/canvas/WebGLCompressedTextureS3TC.idl', + 'html/canvas/WebGLContextAttributes.idl', + 'html/canvas/WebGLContextEvent.idl', + 'html/canvas/WebGLDebugRendererInfo.idl', + 'html/canvas/WebGLDebugShaders.idl', + 'html/canvas/WebGLDepthTexture.idl', + 'html/canvas/WebGLDrawBuffers.idl', + 'html/canvas/WebGLFramebuffer.idl', + 'html/canvas/WebGLLoseContext.idl', + 'html/canvas/WebGLProgram.idl', + 'html/canvas/WebGLRenderbuffer.idl', + 'html/canvas/WebGLRenderingContext.idl', + 'html/canvas/WebGLShader.idl', + 'html/canvas/WebGLShaderPrecisionFormat.idl', + 'html/canvas/WebGLTexture.idl', + 'html/canvas/WebGLUniformLocation.idl', + 'html/canvas/WebGLVertexArrayObjectOES.idl', + 'html/ime/InputMethodContext.idl', + 'html/shadow/PluginPlaceholderElement.idl', + 'html/track/AudioTrack.idl', + 'html/track/AudioTrackList.idl', + 'html/track/TextTrack.idl', + 'html/track/TextTrackCue.idl', + 'html/track/TextTrackCueList.idl', + 'html/track/TextTrackList.idl', + 'html/track/TrackEvent.idl', + 'html/track/VideoTrack.idl', + 'html/track/VideoTrackList.idl', + 'html/track/vtt/VTTCue.idl', + 'html/track/vtt/VTTRegion.idl', + 'html/track/vtt/VTTRegionList.idl', + 'inspector/InjectedScriptHost.idl', + 'inspector/InspectorFrontendHost.idl', + 'inspector/InspectorOverlayHost.idl', + 'inspector/JavaScriptCallFrame.idl', + 'loader/appcache/ApplicationCache.idl', + 'page/EventSource.idl', + 'page/PagePopupController.idl', + 'plugins/MimeType.idl', + 'plugins/MimeTypeArray.idl', + 'plugins/Plugin.idl', + 'plugins/PluginArray.idl', + 'storage/Storage.idl', + 'storage/StorageEvent.idl', + 'streams/ReadableStream.idl', + 'streams/Stream.idl', + 'svg/SVGAElement.idl', + 'svg/SVGAltGlyphDefElement.idl', + 'svg/SVGAltGlyphElement.idl', + 'svg/SVGAltGlyphItemElement.idl', + 'svg/SVGAngle.idl', + 'svg/SVGAnimateElement.idl', + 'svg/SVGAnimateMotionElement.idl', + 'svg/SVGAnimateTransformElement.idl', + 'svg/SVGAnimatedAngle.idl', + 'svg/SVGAnimatedBoolean.idl', + 'svg/SVGAnimatedEnumeration.idl', + 'svg/SVGAnimatedInteger.idl', + 'svg/SVGAnimatedLength.idl', + 'svg/SVGAnimatedLengthList.idl', + 'svg/SVGAnimatedNumber.idl', + 'svg/SVGAnimatedNumberList.idl', + 'svg/SVGAnimatedPreserveAspectRatio.idl', + 'svg/SVGAnimatedRect.idl', + 'svg/SVGAnimatedString.idl', + 'svg/SVGAnimatedTransformList.idl', + 'svg/SVGAnimationElement.idl', + 'svg/SVGCircleElement.idl', + 'svg/SVGClipPathElement.idl', + 'svg/SVGComponentTransferFunctionElement.idl', + 'svg/SVGCursorElement.idl', + 'svg/SVGDefsElement.idl', + 'svg/SVGDescElement.idl', + 'svg/SVGDiscardElement.idl', + 'svg/SVGElement.idl', + 'svg/SVGEllipseElement.idl', + 'svg/SVGFEBlendElement.idl', + 'svg/SVGFEColorMatrixElement.idl', + 'svg/SVGFEComponentTransferElement.idl', + 'svg/SVGFECompositeElement.idl', + 'svg/SVGFEConvolveMatrixElement.idl', + 'svg/SVGFEDiffuseLightingElement.idl', + 'svg/SVGFEDisplacementMapElement.idl', + 'svg/SVGFEDistantLightElement.idl', + 'svg/SVGFEDropShadowElement.idl', + 'svg/SVGFEFloodElement.idl', + 'svg/SVGFEFuncAElement.idl', + 'svg/SVGFEFuncBElement.idl', + 'svg/SVGFEFuncGElement.idl', + 'svg/SVGFEFuncRElement.idl', + 'svg/SVGFEGaussianBlurElement.idl', + 'svg/SVGFEImageElement.idl', + 'svg/SVGFEMergeElement.idl', + 'svg/SVGFEMergeNodeElement.idl', + 'svg/SVGFEMorphologyElement.idl', + 'svg/SVGFEOffsetElement.idl', + 'svg/SVGFEPointLightElement.idl', + 'svg/SVGFESpecularLightingElement.idl', + 'svg/SVGFESpotLightElement.idl', + 'svg/SVGFETileElement.idl', + 'svg/SVGFETurbulenceElement.idl', + 'svg/SVGFilterElement.idl', + 'svg/SVGFontElement.idl', + 'svg/SVGFontFaceElement.idl', + 'svg/SVGFontFaceFormatElement.idl', + 'svg/SVGFontFaceNameElement.idl', + 'svg/SVGFontFaceSrcElement.idl', + 'svg/SVGFontFaceUriElement.idl', + 'svg/SVGForeignObjectElement.idl', + 'svg/SVGGElement.idl', + 'svg/SVGGeometryElement.idl', + 'svg/SVGGlyphElement.idl', + 'svg/SVGGlyphRefElement.idl', + 'svg/SVGGradientElement.idl', + 'svg/SVGGraphicsElement.idl', + 'svg/SVGHKernElement.idl', + 'svg/SVGImageElement.idl', + 'svg/SVGLength.idl', + 'svg/SVGLengthList.idl', + 'svg/SVGLineElement.idl', + 'svg/SVGLinearGradientElement.idl', + 'svg/SVGMPathElement.idl', + 'svg/SVGMarkerElement.idl', + 'svg/SVGMaskElement.idl', + 'svg/SVGMatrix.idl', + 'svg/SVGMetadataElement.idl', + 'svg/SVGMissingGlyphElement.idl', + 'svg/SVGNumber.idl', + 'svg/SVGNumberList.idl', + 'svg/SVGPathElement.idl', + 'svg/SVGPathSeg.idl', + 'svg/SVGPathSegArcAbs.idl', + 'svg/SVGPathSegArcRel.idl', + 'svg/SVGPathSegClosePath.idl', + 'svg/SVGPathSegCurvetoCubicAbs.idl', + 'svg/SVGPathSegCurvetoCubicRel.idl', + 'svg/SVGPathSegCurvetoCubicSmoothAbs.idl', + 'svg/SVGPathSegCurvetoCubicSmoothRel.idl', + 'svg/SVGPathSegCurvetoQuadraticAbs.idl', + 'svg/SVGPathSegCurvetoQuadraticRel.idl', + 'svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl', + 'svg/SVGPathSegCurvetoQuadraticSmoothRel.idl', + 'svg/SVGPathSegLinetoAbs.idl', + 'svg/SVGPathSegLinetoHorizontalAbs.idl', + 'svg/SVGPathSegLinetoHorizontalRel.idl', + 'svg/SVGPathSegLinetoRel.idl', + 'svg/SVGPathSegLinetoVerticalAbs.idl', + 'svg/SVGPathSegLinetoVerticalRel.idl', + 'svg/SVGPathSegList.idl', + 'svg/SVGPathSegMovetoAbs.idl', + 'svg/SVGPathSegMovetoRel.idl', + 'svg/SVGPatternElement.idl', + 'svg/SVGPoint.idl', + 'svg/SVGPointList.idl', + 'svg/SVGPolygonElement.idl', + 'svg/SVGPolylineElement.idl', + 'svg/SVGPreserveAspectRatio.idl', + 'svg/SVGRadialGradientElement.idl', + 'svg/SVGRect.idl', + 'svg/SVGRectElement.idl', + 'svg/SVGRenderingIntent.idl', + 'svg/SVGSVGElement.idl', + 'svg/SVGScriptElement.idl', + 'svg/SVGSetElement.idl', + 'svg/SVGStopElement.idl', + 'svg/SVGStringList.idl', + 'svg/SVGStyleElement.idl', + 'svg/SVGSwitchElement.idl', + 'svg/SVGSymbolElement.idl', + 'svg/SVGTSpanElement.idl', + 'svg/SVGTextContentElement.idl', + 'svg/SVGTextElement.idl', + 'svg/SVGTextPathElement.idl', + 'svg/SVGTextPositioningElement.idl', + 'svg/SVGTitleElement.idl', + 'svg/SVGTransform.idl', + 'svg/SVGTransformList.idl', + 'svg/SVGUnitTypes.idl', + 'svg/SVGUseElement.idl', + 'svg/SVGVKernElement.idl', + 'svg/SVGViewElement.idl', + 'svg/SVGViewSpec.idl', + 'svg/SVGZoomEvent.idl', + 'timing/MemoryInfo.idl', + 'timing/Performance.idl', + 'timing/PerformanceEntry.idl', + 'timing/PerformanceMark.idl', + 'timing/PerformanceMeasure.idl', + 'timing/PerformanceNavigation.idl', + 'timing/PerformanceResourceTiming.idl', + 'timing/PerformanceTiming.idl', + 'workers/DedicatedWorkerGlobalScope.idl', + 'workers/SharedWorker.idl', + 'workers/SharedWorkerGlobalScope.idl', + 'workers/Worker.idl', + 'workers/WorkerConsole.idl', + 'workers/WorkerGlobalScope.idl', + 'workers/WorkerLocation.idl', + 'workers/WorkerNavigator.idl', + 'xml/DOMParser.idl', + 'xml/XMLHttpRequest.idl', + 'xml/XMLHttpRequestEventTarget.idl', + 'xml/XMLHttpRequestProgressEvent.idl', + 'xml/XMLHttpRequestUpload.idl', + 'xml/XMLSerializer.idl', + 'xml/XPathEvaluator.idl', + 'xml/XPathExpression.idl', + 'xml/XPathNSResolver.idl', + 'xml/XPathResult.idl', + 'xml/XSLTProcessor.idl', ] @@ -469,35 +480,40 @@ # This list is copied from Source/core/core.gypi 'core_dependency_idl_files' # 'partial interface' or target (right side of) 'implements' core_dependency_idl_files = [ - 'animation/DocumentAnimation.idl', - 'animation/ElementAnimation.idl', - 'css/DocumentFontFaceSet.idl', - 'dom/ChildNode.idl', - 'dom/DocumentFullscreen.idl', - 'dom/GlobalEventHandlers.idl', - 'dom/ParentNode.idl', - 'dom/URLUtils.idl', - 'dom/URLUtilsReadOnly.idl', - 'events/EventListener.idl', - 'events/NavigatorEvents.idl', - 'frame/NavigatorCPU.idl', - 'frame/NavigatorID.idl', - 'frame/NavigatorLanguage.idl', - 'frame/NavigatorOnLine.idl', - 'frame/WindowBase64.idl', - 'frame/WindowEventHandlers.idl', - 'frame/WindowTimers.idl', - 'html/canvas/CanvasPathMethods.idl', - 'html/canvas/WebGLRenderingContextBase.idl', - 'page/WindowPagePopup.idl', - 'svg/SVGDocument.idl', - 'svg/SVGFilterPrimitiveStandardAttributes.idl', - 'svg/SVGFitToViewBox.idl', - 'svg/SVGTests.idl', - 'svg/SVGURIReference.idl', - 'svg/SVGZoomAndPan.idl', - 'workers/AbstractWorker.idl', - 'xml/DocumentXPathEvaluator.idl', + 'animation/DocumentAnimation.idl', + 'animation/ElementAnimation.idl', + 'css/DocumentFontFaceSet.idl', + 'dom/ChildNode.idl', + 'dom/DocumentFullscreen.idl', + 'dom/ElementFullscreen.idl', + 'dom/GlobalEventHandlers.idl', + 'dom/ParentNode.idl', + 'dom/URLUtils.idl', + 'dom/URLUtilsReadOnly.idl', + 'events/EventListener.idl', + 'events/NavigatorEvents.idl', + 'frame/NavigatorCPU.idl', + 'frame/NavigatorID.idl', + 'frame/NavigatorLanguage.idl', + 'frame/NavigatorOnLine.idl', + 'frame/WindowBase64.idl', + 'frame/WindowEventHandlers.idl', + 'frame/WindowTimers.idl', + 'html/canvas/CanvasPathMethods.idl', + 'html/canvas/MouseEventHitRegion.idl', + 'html/canvas/WebGLRenderingContextBase.idl', + 'imagebitmap/ImageBitmapFactories.idl', + 'imagebitmap/WindowImageBitmapFactories.idl', + 'page/WindowPagePopup.idl', + 'svg/SVGDocument.idl', + 'svg/SVGFilterPrimitiveStandardAttributes.idl', + 'svg/SVGFitToViewBox.idl', + 'svg/SVGTests.idl', + 'svg/SVGURIReference.idl', + 'svg/SVGZoomAndPan.idl', + 'workers/AbstractWorker.idl', + 'xml/DocumentXMLTreeViewer.idl', + 'xml/DocumentXPathEvaluator.idl', ] @@ -508,186 +524,193 @@ # This list is copied from Source/modules/modules.gypi 'modules_idl_files' # Modules IDL files bindings (.dart, .cpp and .h files) will be generated modules_idl_files = [ - 'battery/BatteryManager.idl', - 'crypto/AesKeyAlgorithm.idl', - 'crypto/Crypto.idl', - 'crypto/HmacKeyAlgorithm.idl', - 'crypto/Key.idl', - 'crypto/KeyAlgorithm.idl', - 'crypto/RsaHashedKeyAlgorithm.idl', - 'crypto/RsaKeyAlgorithm.idl', - 'crypto/SubtleCrypto.idl', - 'device_light/DeviceLightEvent.idl', - 'device_orientation/DeviceAcceleration.idl', - 'device_orientation/DeviceMotionEvent.idl', - 'device_orientation/DeviceOrientationEvent.idl', - 'device_orientation/DeviceRotationRate.idl', - 'encoding/TextDecoder.idl', - 'encoding/TextEncoder.idl', - 'encryptedmedia/MediaKeyMessageEvent.idl', - 'encryptedmedia/MediaKeyNeededEvent.idl', - 'encryptedmedia/MediaKeySession.idl', - 'encryptedmedia/MediaKeys.idl', - 'filesystem/DOMFileSystem.idl', - 'filesystem/DOMFileSystemSync.idl', - 'filesystem/DirectoryEntry.idl', - 'filesystem/DirectoryEntrySync.idl', - 'filesystem/DirectoryReader.idl', - 'filesystem/DirectoryReaderSync.idl', - 'filesystem/EntriesCallback.idl', - 'filesystem/Entry.idl', - 'filesystem/EntryCallback.idl', - 'filesystem/EntrySync.idl', - 'filesystem/ErrorCallback.idl', - 'filesystem/FileCallback.idl', - 'filesystem/FileEntry.idl', - 'filesystem/FileEntrySync.idl', - 'filesystem/FileSystemCallback.idl', - 'filesystem/FileWriter.idl', - 'filesystem/FileWriterCallback.idl', - 'filesystem/FileWriterSync.idl', - 'filesystem/Metadata.idl', - 'filesystem/MetadataCallback.idl', - 'gamepad/Gamepad.idl', - 'gamepad/GamepadButton.idl', - 'gamepad/GamepadEvent.idl', - 'gamepad/GamepadList.idl', - 'gamepad/WebKitGamepad.idl', - 'gamepad/WebKitGamepadList.idl', - 'geolocation/Coordinates.idl', - 'geolocation/Geolocation.idl', - 'geolocation/Geoposition.idl', - 'geolocation/PositionCallback.idl', - 'geolocation/PositionError.idl', - 'geolocation/PositionErrorCallback.idl', - 'indexeddb/IDBCursor.idl', - 'indexeddb/IDBCursorWithValue.idl', - 'indexeddb/IDBDatabase.idl', - 'indexeddb/IDBFactory.idl', - 'indexeddb/IDBIndex.idl', - 'indexeddb/IDBKeyRange.idl', - 'indexeddb/IDBObjectStore.idl', - 'indexeddb/IDBOpenDBRequest.idl', - 'indexeddb/IDBRequest.idl', - 'indexeddb/IDBTransaction.idl', - 'indexeddb/IDBVersionChangeEvent.idl', - 'mediasource/MediaSource.idl', - 'mediasource/SourceBuffer.idl', - 'mediasource/SourceBufferList.idl', - 'mediasource/VideoPlaybackQuality.idl', - 'mediastream/MediaDeviceInfo.idl', - 'mediastream/MediaDeviceInfoCallback.idl', - 'mediastream/MediaStream.idl', - 'mediastream/MediaStreamEvent.idl', - 'mediastream/MediaStreamTrack.idl', - 'mediastream/MediaStreamTrackEvent.idl', - 'mediastream/MediaStreamTrackSourcesCallback.idl', - 'mediastream/NavigatorUserMediaError.idl', - 'mediastream/NavigatorUserMediaErrorCallback.idl', - 'mediastream/NavigatorUserMediaSuccessCallback.idl', - 'mediastream/RTCDTMFSender.idl', - 'mediastream/RTCDTMFToneChangeEvent.idl', - 'mediastream/RTCDataChannel.idl', - 'mediastream/RTCDataChannelEvent.idl', - 'mediastream/RTCErrorCallback.idl', - 'mediastream/RTCIceCandidate.idl', - 'mediastream/RTCIceCandidateEvent.idl', - 'mediastream/RTCPeerConnection.idl', - 'mediastream/RTCSessionDescription.idl', - 'mediastream/RTCSessionDescriptionCallback.idl', - 'mediastream/RTCStatsCallback.idl', - 'mediastream/RTCStatsReport.idl', - 'mediastream/RTCStatsResponse.idl', - 'mediastream/SourceInfo.idl', - 'netinfo/NetworkInformation.idl', - 'notifications/Notification.idl', - 'notifications/NotificationPermissionCallback.idl', - 'performance/WorkerPerformance.idl', - 'push_messaging/PushEvent.idl', - 'push_messaging/PushManager.idl', - 'push_messaging/PushRegistration.idl', - 'quota/DeprecatedStorageInfo.idl', - 'quota/DeprecatedStorageQuota.idl', - 'quota/StorageErrorCallback.idl', - 'quota/StorageInfo.idl', - 'quota/StorageQuota.idl', - 'quota/StorageQuotaCallback.idl', - 'quota/StorageUsageCallback.idl', - 'serviceworkers/Client.idl', - 'serviceworkers/FetchEvent.idl', - 'serviceworkers/HeaderMap.idl', - 'serviceworkers/HeaderMapForEachCallback.idl', - 'serviceworkers/InstallEvent.idl', - 'serviceworkers/InstallPhaseEvent.idl', - 'serviceworkers/Request.idl', - 'serviceworkers/Response.idl', - 'serviceworkers/ServiceWorker.idl', - 'serviceworkers/ServiceWorkerClients.idl', - 'serviceworkers/ServiceWorkerContainer.idl', - 'serviceworkers/ServiceWorkerGlobalScope.idl', - 'speech/SpeechGrammar.idl', - 'speech/SpeechGrammarList.idl', - 'speech/SpeechRecognition.idl', - 'speech/SpeechRecognitionAlternative.idl', - 'speech/SpeechRecognitionError.idl', - 'speech/SpeechRecognitionEvent.idl', - 'speech/SpeechRecognitionResult.idl', - 'speech/SpeechRecognitionResultList.idl', - 'speech/SpeechSynthesis.idl', - 'speech/SpeechSynthesisEvent.idl', - 'speech/SpeechSynthesisUtterance.idl', - 'speech/SpeechSynthesisVoice.idl', - 'webaudio/AnalyserNode.idl', - 'webaudio/AudioBuffer.idl', - 'webaudio/AudioBufferCallback.idl', - 'webaudio/AudioBufferSourceNode.idl', - 'webaudio/AudioContext.idl', - 'webaudio/AudioDestinationNode.idl', - 'webaudio/AudioListener.idl', - 'webaudio/AudioNode.idl', - 'webaudio/AudioParam.idl', - 'webaudio/AudioProcessingEvent.idl', - 'webaudio/AudioSourceNode.idl', - 'webaudio/BiquadFilterNode.idl', - 'webaudio/ChannelMergerNode.idl', - 'webaudio/ChannelSplitterNode.idl', - 'webaudio/ConvolverNode.idl', - 'webaudio/DelayNode.idl', - 'webaudio/DynamicsCompressorNode.idl', - 'webaudio/GainNode.idl', - 'webaudio/MediaElementAudioSourceNode.idl', - 'webaudio/MediaStreamAudioDestinationNode.idl', - 'webaudio/MediaStreamAudioSourceNode.idl', - 'webaudio/OfflineAudioCompletionEvent.idl', - 'webaudio/OfflineAudioContext.idl', - 'webaudio/OscillatorNode.idl', - 'webaudio/PannerNode.idl', - 'webaudio/PeriodicWave.idl', - 'webaudio/ScriptProcessorNode.idl', - 'webaudio/WaveShaperNode.idl', - 'webdatabase/Database.idl', - 'webdatabase/DatabaseCallback.idl', - 'webdatabase/DatabaseSync.idl', - 'webdatabase/SQLError.idl', - 'webdatabase/SQLResultSet.idl', - 'webdatabase/SQLResultSetRowList.idl', - 'webdatabase/SQLStatementCallback.idl', - 'webdatabase/SQLStatementErrorCallback.idl', - 'webdatabase/SQLTransaction.idl', - 'webdatabase/SQLTransactionCallback.idl', - 'webdatabase/SQLTransactionErrorCallback.idl', - 'webdatabase/SQLTransactionSync.idl', - 'webdatabase/SQLTransactionSyncCallback.idl', - 'webmidi/MIDIAccess.idl', - 'webmidi/MIDIConnectionEvent.idl', - 'webmidi/MIDIErrorCallback.idl', - 'webmidi/MIDIInput.idl', - 'webmidi/MIDIMessageEvent.idl', - 'webmidi/MIDIOutput.idl', - 'webmidi/MIDIPort.idl', - 'webmidi/MIDISuccessCallback.idl', - 'websockets/CloseEvent.idl', - 'websockets/WebSocket.idl', + 'battery/BatteryManager.idl', + 'credentialmanager/Credential.idl', + 'credentialmanager/CredentialsContainer.idl', + 'credentialmanager/FederatedCredential.idl', + 'credentialmanager/LocalCredential.idl', + 'crypto/Crypto.idl', + 'crypto/CryptoKey.idl', + 'crypto/SubtleCrypto.idl', + 'device_light/DeviceLightEvent.idl', + 'device_orientation/DeviceAcceleration.idl', + 'device_orientation/DeviceMotionEvent.idl', + 'device_orientation/DeviceOrientationEvent.idl', + 'device_orientation/DeviceRotationRate.idl', + 'encoding/TextDecoder.idl', + 'encoding/TextEncoder.idl', + 'encryptedmedia/MediaKeyMessageEvent.idl', + 'encryptedmedia/MediaKeyNeededEvent.idl', + 'encryptedmedia/MediaKeySession.idl', + 'encryptedmedia/MediaKeys.idl', + 'filesystem/DOMFileSystem.idl', + 'filesystem/DOMFileSystemSync.idl', + 'filesystem/DirectoryEntry.idl', + 'filesystem/DirectoryEntrySync.idl', + 'filesystem/DirectoryReader.idl', + 'filesystem/DirectoryReaderSync.idl', + 'filesystem/EntriesCallback.idl', + 'filesystem/Entry.idl', + 'filesystem/EntryCallback.idl', + 'filesystem/EntrySync.idl', + 'filesystem/ErrorCallback.idl', + 'filesystem/FileCallback.idl', + 'filesystem/FileEntry.idl', + 'filesystem/FileEntrySync.idl', + 'filesystem/FileSystemCallback.idl', + 'filesystem/FileWriter.idl', + 'filesystem/FileWriterCallback.idl', + 'filesystem/FileWriterSync.idl', + 'filesystem/Metadata.idl', + 'filesystem/MetadataCallback.idl', + 'gamepad/Gamepad.idl', + 'gamepad/GamepadButton.idl', + 'gamepad/GamepadEvent.idl', + 'gamepad/GamepadList.idl', + 'gamepad/WebKitGamepad.idl', + 'gamepad/WebKitGamepadList.idl', + 'geofencing/CircularGeofencingRegion.idl', + 'geofencing/Geofencing.idl', + 'geofencing/GeofencingRegion.idl', + 'geolocation/Coordinates.idl', + 'geolocation/Geolocation.idl', + 'geolocation/Geoposition.idl', + 'geolocation/PositionCallback.idl', + 'geolocation/PositionError.idl', + 'geolocation/PositionErrorCallback.idl', + 'indexeddb/IDBCursor.idl', + 'indexeddb/IDBCursorWithValue.idl', + 'indexeddb/IDBDatabase.idl', + 'indexeddb/IDBFactory.idl', + 'indexeddb/IDBIndex.idl', + 'indexeddb/IDBKeyRange.idl', + 'indexeddb/IDBObjectStore.idl', + 'indexeddb/IDBOpenDBRequest.idl', + 'indexeddb/IDBRequest.idl', + 'indexeddb/IDBTransaction.idl', + 'indexeddb/IDBVersionChangeEvent.idl', + 'mediasource/MediaSource.idl', + 'mediasource/SourceBuffer.idl', + 'mediasource/SourceBufferList.idl', + 'mediasource/VideoPlaybackQuality.idl', + 'mediastream/MediaDeviceInfo.idl', + 'mediastream/MediaDeviceInfoCallback.idl', + 'mediastream/MediaStream.idl', + 'mediastream/MediaStreamEvent.idl', + 'mediastream/MediaStreamTrack.idl', + 'mediastream/MediaStreamTrackEvent.idl', + 'mediastream/MediaStreamTrackSourcesCallback.idl', + 'mediastream/NavigatorUserMediaError.idl', + 'mediastream/NavigatorUserMediaErrorCallback.idl', + 'mediastream/NavigatorUserMediaSuccessCallback.idl', + 'mediastream/RTCDTMFSender.idl', + 'mediastream/RTCDTMFToneChangeEvent.idl', + 'mediastream/RTCDataChannel.idl', + 'mediastream/RTCDataChannelEvent.idl', + 'mediastream/RTCErrorCallback.idl', + 'mediastream/RTCIceCandidate.idl', + 'mediastream/RTCIceCandidateEvent.idl', + 'mediastream/RTCPeerConnection.idl', + 'mediastream/RTCSessionDescription.idl', + 'mediastream/RTCSessionDescriptionCallback.idl', + 'mediastream/RTCStatsCallback.idl', + 'mediastream/RTCStatsReport.idl', + 'mediastream/RTCStatsResponse.idl', + 'mediastream/SourceInfo.idl', + 'netinfo/NetworkInformation.idl', + 'notifications/Notification.idl', + 'notifications/NotificationPermissionCallback.idl', + 'performance/WorkerPerformance.idl', + 'presentation/Presentation.idl', + 'push_messaging/PushEvent.idl', + 'push_messaging/PushManager.idl', + 'push_messaging/PushRegistration.idl', + 'quota/DeprecatedStorageInfo.idl', + 'quota/DeprecatedStorageQuota.idl', + 'quota/StorageErrorCallback.idl', + 'quota/StorageInfo.idl', + 'quota/StorageQuota.idl', + 'quota/StorageQuotaCallback.idl', + 'quota/StorageUsageCallback.idl', + 'screen_orientation/ScreenOrientation.idl', + 'serviceworkers/Body.idl', + 'serviceworkers/Cache.idl', + 'serviceworkers/CacheStorage.idl', + 'serviceworkers/ExtendableEvent.idl', + 'serviceworkers/FetchEvent.idl', + 'serviceworkers/Headers.idl', + 'serviceworkers/HeadersForEachCallback.idl', + 'serviceworkers/InstallEvent.idl', + 'serviceworkers/Request.idl', + 'serviceworkers/Response.idl', + 'serviceworkers/ServiceWorker.idl', + 'serviceworkers/ServiceWorkerClient.idl', + 'serviceworkers/ServiceWorkerClients.idl', + 'serviceworkers/ServiceWorkerContainer.idl', + 'serviceworkers/ServiceWorkerGlobalScope.idl', + 'serviceworkers/ServiceWorkerRegistration.idl', + 'speech/SpeechGrammar.idl', + 'speech/SpeechGrammarList.idl', + 'speech/SpeechRecognition.idl', + 'speech/SpeechRecognitionAlternative.idl', + 'speech/SpeechRecognitionError.idl', + 'speech/SpeechRecognitionEvent.idl', + 'speech/SpeechRecognitionResult.idl', + 'speech/SpeechRecognitionResultList.idl', + 'speech/SpeechSynthesis.idl', + 'speech/SpeechSynthesisEvent.idl', + 'speech/SpeechSynthesisUtterance.idl', + 'speech/SpeechSynthesisVoice.idl', + 'webaudio/AnalyserNode.idl', + 'webaudio/AudioBuffer.idl', + 'webaudio/AudioBufferCallback.idl', + 'webaudio/AudioBufferSourceNode.idl', + 'webaudio/AudioContext.idl', + 'webaudio/AudioDestinationNode.idl', + 'webaudio/AudioListener.idl', + 'webaudio/AudioNode.idl', + 'webaudio/AudioParam.idl', + 'webaudio/AudioProcessingEvent.idl', + 'webaudio/AudioSourceNode.idl', + 'webaudio/BiquadFilterNode.idl', + 'webaudio/ChannelMergerNode.idl', + 'webaudio/ChannelSplitterNode.idl', + 'webaudio/ConvolverNode.idl', + 'webaudio/DelayNode.idl', + 'webaudio/DynamicsCompressorNode.idl', + 'webaudio/GainNode.idl', + 'webaudio/MediaElementAudioSourceNode.idl', + 'webaudio/MediaStreamAudioDestinationNode.idl', + 'webaudio/MediaStreamAudioSourceNode.idl', + 'webaudio/OfflineAudioCompletionEvent.idl', + 'webaudio/OfflineAudioContext.idl', + 'webaudio/OscillatorNode.idl', + 'webaudio/PannerNode.idl', + 'webaudio/PeriodicWave.idl', + 'webaudio/ScriptProcessorNode.idl', + 'webaudio/WaveShaperNode.idl', + 'webdatabase/Database.idl', + 'webdatabase/DatabaseCallback.idl', + 'webdatabase/SQLError.idl', + 'webdatabase/SQLResultSet.idl', + 'webdatabase/SQLResultSetRowList.idl', + 'webdatabase/SQLStatementCallback.idl', + 'webdatabase/SQLStatementErrorCallback.idl', + 'webdatabase/SQLTransaction.idl', + 'webdatabase/SQLTransactionCallback.idl', + 'webdatabase/SQLTransactionErrorCallback.idl', + 'webmidi/MIDIAccess.idl', + 'webmidi/MIDIConnectionEvent.idl', + 'webmidi/MIDIErrorCallback.idl', + 'webmidi/MIDIInput.idl', + 'webmidi/MIDIInputMap.idl', + 'webmidi/MIDIMessageEvent.idl', + 'webmidi/MIDIOutput.idl', + 'webmidi/MIDIOutputMap.idl', + 'webmidi/MIDIPort.idl', + 'webmidi/MIDISuccessCallback.idl', + 'websockets/CloseEvent.idl', + 'websockets/WebSocket.idl', ] @@ -699,52 +722,79 @@ # 'modules_dependency_idl_files'. # 'partial interface' or target (right side of) 'implements' modules_dependency_idl_files = [ - 'battery/NavigatorBattery.idl', - 'beacon/NavigatorBeacon.idl', - 'crypto/WindowCrypto.idl', - 'crypto/WorkerGlobalScopeCrypto.idl', - 'device_light/WindowDeviceLight.idl', - 'device_orientation/WindowDeviceMotion.idl', - 'device_orientation/WindowDeviceOrientation.idl', - 'donottrack/NavigatorDoNotTrack.idl', - 'encryptedmedia/HTMLMediaElementEncryptedMedia.idl', - 'filesystem/DataTransferItemFileSystem.idl', - 'filesystem/HTMLInputElementFileSystem.idl', - 'filesystem/InspectorFrontendHostFileSystem.idl', - 'filesystem/WindowFileSystem.idl', - 'filesystem/WorkerGlobalScopeFileSystem.idl', - 'gamepad/NavigatorGamepad.idl', - 'geolocation/NavigatorGeolocation.idl', - 'imagebitmap/ImageBitmapFactories.idl', - 'imagebitmap/WindowImageBitmapFactories.idl', - 'indexeddb/WindowIndexedDatabase.idl', - 'indexeddb/WorkerGlobalScopeIndexedDatabase.idl', - 'mediasource/HTMLVideoElementMediaSource.idl', - 'mediasource/URLMediaSource.idl', - 'mediastream/NavigatorMediaStream.idl', - 'mediastream/URLMediaStream.idl', - 'mediastream/WindowMediaStream.idl', - 'navigatorcontentutils/NavigatorContentUtils.idl', - 'netinfo/NavigatorNetworkInformation.idl', - 'netinfo/WorkerNavigatorNetworkInformation.idl', - 'performance/SharedWorkerPerformance.idl', - 'performance/WorkerGlobalScopePerformance.idl', - 'push_messaging/NavigatorPushManager.idl', - 'push_messaging/ServiceWorkerGlobalScopePush.idl', - 'quota/NavigatorStorageQuota.idl', - 'quota/WindowQuota.idl', - 'quota/WorkerNavigatorStorageQuota.idl', - 'screen_orientation/ScreenOrientation.idl', - 'serviceworkers/NavigatorServiceWorker.idl', - 'speech/WindowSpeech.idl', - 'speech/WindowSpeechSynthesis.idl', - 'vibration/NavigatorVibration.idl', - 'webaudio/WindowWebAudio.idl', - 'webdatabase/WindowWebDatabase.idl', - 'webdatabase/WorkerGlobalScopeWebDatabase.idl', - 'webmidi/NavigatorWebMIDI.idl', + 'battery/NavigatorBattery.idl', + 'beacon/NavigatorBeacon.idl', + 'credentialmanager/NavigatorCredentials.idl', + 'crypto/WindowCrypto.idl', + 'crypto/WorkerGlobalScopeCrypto.idl', + 'device_light/WindowDeviceLight.idl', + 'device_orientation/WindowDeviceMotion.idl', + 'device_orientation/WindowDeviceOrientation.idl', + 'donottrack/NavigatorDoNotTrack.idl', + 'encryptedmedia/HTMLMediaElementEncryptedMedia.idl', + 'filesystem/DataTransferItemFileSystem.idl', + 'filesystem/HTMLInputElementFileSystem.idl', + 'filesystem/InspectorFrontendHostFileSystem.idl', + 'filesystem/WindowFileSystem.idl', + 'filesystem/WorkerGlobalScopeFileSystem.idl', + 'gamepad/NavigatorGamepad.idl', + 'geofencing/NavigatorGeofencing.idl', + 'geofencing/WorkerNavigatorGeofencing.idl', + 'geolocation/NavigatorGeolocation.idl', + 'indexeddb/WindowIndexedDatabase.idl', + 'indexeddb/WorkerGlobalScopeIndexedDatabase.idl', + 'mediasource/HTMLVideoElementMediaSource.idl', + 'mediasource/URLMediaSource.idl', + 'mediastream/NavigatorMediaStream.idl', + 'mediastream/URLMediaStream.idl', + 'mediastream/WindowMediaStream.idl', + 'navigatorcontentutils/NavigatorContentUtils.idl', + 'netinfo/NavigatorNetworkInformation.idl', + 'netinfo/WorkerNavigatorNetworkInformation.idl', + 'performance/SharedWorkerPerformance.idl', + 'performance/WorkerGlobalScopePerformance.idl', + 'presentation/NavigatorPresentation.idl', + 'push_messaging/NavigatorPushManager.idl', + 'push_messaging/ServiceWorkerGlobalScopePush.idl', + 'quota/NavigatorStorageQuota.idl', + 'quota/WindowQuota.idl', + 'quota/WorkerNavigatorStorageQuota.idl', + 'screen_orientation/ScreenScreenOrientation.idl', + 'serviceworkers/NavigatorServiceWorker.idl', + 'speech/WindowSpeech.idl', + 'speech/WindowSpeechSynthesis.idl', + 'vibration/NavigatorVibration.idl', + 'webaudio/WindowWebAudio.idl', + 'webdatabase/WindowWebDatabase.idl', + 'webmidi/NavigatorWebMIDI.idl', ] - def full_path_modules_dependency_idl_files(): return full_path(['Source', 'modules'], modules_dependency_idl_files) + + +core_dictionary_idl_files = [ + 'css/FontFaceDescriptors.idl', + 'dom/DOMPointInit.idl', + 'dom/MutationObserverInit.idl', + 'frame/ScrollOptions.idl', + 'html/canvas/HitRegionOptions.idl', + 'page/EventSourceInit.idl', +] +def full_path_core_dictionary_idl_files(): + return full_path(['Source', 'core'], core_dictionary_idl_files) + + +modules_dictionary_idl_files = [ + 'encoding/TextDecodeOptions.idl', + 'encoding/TextDecoderOptions.idl', + 'indexeddb/IDBIndexParameters.idl', + 'notifications/NotificationOptions.idl', + 'serviceworkers/QueryParams.idl', + 'serviceworkers/RegistrationOptionList.idl', + 'serviceworkers/ServiceWorkerClientQueryParams.idl', + 'webmidi/MIDIOptions.idl', +] + +def full_path_modules_dictionary_idl_files(): + return full_path(['Source', 'modules'], modules_dictionary_idl_files)
diff --git a/bindings/dart/scripts/test/main.py b/bindings/dart/scripts/test/main.py index db3c00a..659fd86 100755 --- a/bindings/dart/scripts/test/main.py +++ b/bindings/dart/scripts/test/main.py
@@ -39,7 +39,12 @@ from compiler import IdlCompilerDart # TODO(terry): Temporary solution list of IDLs to parse and IDL as dependencies. -from idl_files import full_path_core_idl_files, full_path_core_dependency_idl_files, full_path_modules_idl_files, full_path_modules_dependency_idl_files +from idl_files import full_path_core_idl_files,\ + full_path_core_dependency_idl_files,\ + full_path_modules_idl_files,\ + full_path_modules_dependency_idl_files,\ + full_path_core_dictionary_idl_files,\ + full_path_modules_dictionary_idl_files #from dart_tests import run_dart_tests @@ -191,14 +196,17 @@ core_dependency_idls = full_path_core_dependency_idl_files() modules_idls = full_path_modules_idl_files() modules_dependency_idls = full_path_modules_dependency_idl_files() + core_dictionary_idls = full_path_core_dictionary_idl_files() + modules_dictionary_idls = full_path_modules_dictionary_idl_files() all_interfaces = core_idls + modules_idls all_dependencies = core_dependency_idls + modules_dependency_idls - all_files = all_interfaces + all_dependencies + all_dictionaries = core_dictionary_idls + modules_dictionary_idls + all_files = all_interfaces + all_dependencies + all_dictionaries # 2-stage computation: individual, then overall for idl_filename in all_files: - compute_info_individual(idl_filename, 'dart') + compute_info_individual(idl_filename) info_individuals = [info_individual()] compute_interfaces_info_overall(info_individuals) @@ -214,7 +222,7 @@ print 'Output directory %s created' % build.output_directory # Compile IDLs - for filename in all_interfaces: + for filename in (all_dictionaries + all_interfaces): if not filename.endswith('.idl'): continue if build.generate_from_idl(filename):
diff --git a/bindings/scripts/aggregate_generated_bindings.py b/bindings/scripts/aggregate_generated_bindings.py index 98bbaa9..050c93a 100755 --- a/bindings/scripts/aggregate_generated_bindings.py +++ b/bindings/scripts/aggregate_generated_bindings.py
@@ -51,16 +51,15 @@ import errno import os import re -import subprocess import sys -from utilities import idl_filename_to_interface_name +from utilities import idl_filename_to_interface_name, read_idl_files_list_from_file # A regexp for finding Conditional attributes in interface definitions. CONDITIONAL_PATTERN = re.compile( r'\[' r'[^\]]*' - r'Conditional=([\_0-9a-zA-Z&|]*)' + r'Conditional=([\_0-9a-zA-Z]*)' r'[^\]]*' r'\]\s*' r'((callback|partial)\s+)?' @@ -101,16 +100,6 @@ """ -def format_conditional(conditional): - """Wraps conditional with ENABLE() and replace '&','|' with '&&','||' if - more than one conditional is specified.""" - def wrap_with_enable(s): - if s in ['|', '&']: - return s * 2 - return 'ENABLE(' + s + ')' - return ' '.join(map(wrap_with_enable, conditional)) - - def extract_conditional(idl_file_path): """Find [Conditional] interface extended attribute.""" with open(idl_file_path) as idl_file: @@ -119,8 +108,7 @@ match = CONDITIONAL_PATTERN.search(idl_contents) if not match: return None - conditional = match.group(1) - return re.split('([|,])', conditional) + return match.group(1) def extract_meta_data(file_paths): @@ -161,7 +149,7 @@ if prev_conditional: output.append('#endif\n') if conditional: - output.append('\n#if %s\n' % format_conditional(conditional)) + output.append('\n#if ENABLE(%s)\n' % conditional) prev_conditional = conditional output.append('#include "bindings/%s/%s/%s%s.cpp"\n' % @@ -182,21 +170,6 @@ f.write(content) -def resolve_cygpath(cygdrive_names): - if not cygdrive_names: - return [] - cmd = ['cygpath', '-f', '-', '-wa'] - process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - idl_file_names = [] - for file_name in cygdrive_names: - process.stdin.write('%s\n' % file_name) - process.stdin.flush() - idl_file_names.append(process.stdout.readline().rstrip()) - process.stdin.close() - process.wait() - return idl_file_names - - def main(args): if len(args) <= 4: raise Exception('Expected at least 5 arguments.') @@ -211,15 +184,7 @@ in_out_break_index = args.index('--') output_file_names = args[in_out_break_index + 1:] - with open(input_file_name) as input_file: - file_names = sorted([os.path.realpath(line.rstrip('\n')) - for line in input_file]) - idl_file_names = [file_name for file_name in file_names - if not file_name.startswith('/cygdrive')] - cygdrive_names = [file_name for file_name in file_names - if file_name.startswith('/cygdrive')] - idl_file_names.extend(resolve_cygpath(cygdrive_names)) - + idl_file_names = read_idl_files_list_from_file(input_file_name) files_meta_data = extract_meta_data(idl_file_names) total_partitions = len(output_file_names) for partition, file_name in enumerate(output_file_names):
diff --git a/bindings/scripts/blink_idl_parser.py b/bindings/scripts/blink_idl_parser.py index 59218a8..592bf91 100644 --- a/bindings/scripts/blink_idl_parser.py +++ b/bindings/scripts/blink_idl_parser.py
@@ -285,14 +285,15 @@ if len(p) > 3: p[0] = ListFromConcat(p[2], p[3]) - # [b51] Add ExtendedAttributeIdentAndOrIdent + # [b51] Add ExtendedAttributeStringLiteral and ExtendedAttributeStringLiteralList def p_ExtendedAttribute(self, p): """ExtendedAttribute : ExtendedAttributeNoArgs | ExtendedAttributeArgList | ExtendedAttributeIdent | ExtendedAttributeIdentList - | ExtendedAttributeStringLiteralList - | ExtendedAttributeNamedArgList""" + | ExtendedAttributeNamedArgList + | ExtendedAttributeStringLiteral + | ExtendedAttributeStringLiteralList""" p[0] = p[1] # [59] @@ -333,44 +334,35 @@ elif len(p) == 3: p[0] = ListFromConcat(self.BuildTrue('NULLABLE'), p[2]) - # [b94] Add support for OR Extended Attribute values "A|B" - def p_ExtendedAttributeIdentList(self, p): - """ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ')' - | identifier '=' identifier '|' IdentOrList""" - if type(p[4]) is list: - value = self.BuildAttribute('VALUE', ','.join(p[4])) - else: - value = self.BuildAttribute('VALUE', p[3] + p[4] + p[5]) + # Blink extension: Add support for string literal Extended Attribute values + def p_ExtendedAttributeStringLiteral(self, p): + """ExtendedAttributeStringLiteral : identifier '=' StringLiteral """ + def unwrap_string(ls): + """Reach in and grab the string literal's "NAME".""" + return ls[1].value + + value = self.BuildAttribute('VALUE', unwrap_string(p[3])) p[0] = self.BuildNamed('ExtAttribute', p, 1, value) - # [b94.1] A|B|C - def p_IdentOrList(self, p): - """IdentOrList : identifier '|' IdentOrList - | identifier""" - if len(p) > 3: - p[0] = p[1] + p[2] + p[3] - else: - p[0] = p[1] - - # Blink extension: Add support for compound Extended Attribute values over string literals ("A"|"B") + # Blink extension: Add support for compound Extended Attribute values over string literals ("A","B") def p_ExtendedAttributeStringLiteralList(self, p): - """ExtendedAttributeStringLiteralList : identifier '=' StringLiteralOrList""" - value = self.BuildAttribute('VALUE', p[3]) + """ExtendedAttributeStringLiteralList : identifier '=' '(' StringLiteralList ')' """ + value = self.BuildAttribute('VALUE', p[4]) p[0] = self.BuildNamed('ExtAttribute', p, 1, value) # Blink extension: one or more string literals. The values aren't propagated as literals, # but their by their value only. - def p_StringLiteralOrList(self, p): - """StringLiteralOrList : StringLiteral '|' StringLiteralOrList - | StringLiteral""" + def p_StringLiteralList(self, p): + """StringLiteralList : StringLiteral ',' StringLiteralList + | StringLiteral""" def unwrap_string(ls): """Reach in and grab the string literal's "NAME".""" return ls[1].value if len(p) > 3: - p[0] = unwrap_string(p[1]) + p[2] + p[3] + p[0] = ListFromConcat(unwrap_string(p[1]), p[3]) else: - p[0] = unwrap_string(p[1]) + p[0] = ListFromConcat(unwrap_string(p[1])) def __init__(self, # common parameters
diff --git a/bindings/scripts/code_generator_v8.py b/bindings/scripts/code_generator_v8.py index 272b611..065873d 100644 --- a/bindings/scripts/code_generator_v8.py +++ b/bindings/scripts/code_generator_v8.py
@@ -78,6 +78,7 @@ import v8_interface import v8_types from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name +from utilities import KNOWN_COMPONENTS def render_template(interface_info, header_template, cpp_template, @@ -95,7 +96,9 @@ return header_text, cpp_text -class CodeGeneratorV8(object): +class CodeGeneratorBase(object): + """Base class for v8 bindings generator and IDL dictionary impl generator""" + def __init__(self, interfaces_info, cache_dir, output_dir): interfaces_info = interfaces_info or {} self.interfaces_info = interfaces_info @@ -103,52 +106,38 @@ self.output_dir = output_dir # Set global type info - idl_types.set_ancestors(dict( - (interface_name, interface_info['ancestors']) - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['ancestors'])) - IdlType.set_callback_interfaces(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['is_callback_interface'])) - IdlType.set_dictionaries(set( - dictionary_name - for dictionary_name, interface_info in interfaces_info.iteritems() - if interface_info['is_dictionary'])) - IdlType.set_implemented_as_interfaces(dict( - (interface_name, interface_info['implemented_as']) - for interface_name, interface_info in interfaces_info.iteritems() - if interface_info['implemented_as'])) - IdlType.set_garbage_collected_types(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if 'GarbageCollected' in interface_info['inherited_extended_attributes'])) - IdlType.set_will_be_garbage_collected_types(set( - interface_name - for interface_name, interface_info in interfaces_info.iteritems() - if 'WillBeGarbageCollected' in interface_info['inherited_extended_attributes'])) - v8_types.set_component_dirs(dict( - (interface_name, interface_info['component_dir']) - for interface_name, interface_info in interfaces_info.iteritems())) + idl_types.set_ancestors(interfaces_info['ancestors']) + IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) + IdlType.set_dictionaries(interfaces_info['dictionaries']) + IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_interfaces']) + IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_interfaces']) + IdlType.set_will_be_garbage_collected_types(interfaces_info['will_be_garbage_collected_interfaces']) + v8_types.set_component_dirs(interfaces_info['component_dirs']) - def output_paths_for_bindings(self, definition_name): + def generate_code(self, definitions, definition_name): + """Returns .h/.cpp code as ((path, content)...).""" + # Set local type info + IdlType.set_callback_functions(definitions.callback_functions.keys()) + IdlType.set_enums((enum.name, enum.values) + for enum in definitions.enumerations.values()) + return self.generate_code_internal(definitions, definition_name) + + def generate_code_internal(self, definitions, definition_name): + # This should be implemented in subclasses. + raise NotImplementedError() + + +class CodeGeneratorV8(CodeGeneratorBase): + def __init__(self, interfaces_info, cache_dir, output_dir): + CodeGeneratorBase.__init__(self, interfaces_info, cache_dir, output_dir) + + def output_paths(self, definition_name): header_path = posixpath.join(self.output_dir, 'V8%s.h' % definition_name) cpp_path = posixpath.join(self.output_dir, 'V8%s.cpp' % definition_name) return header_path, cpp_path - def output_paths_for_impl(self, definition_name): - header_path = posixpath.join(self.output_dir, '%s.h' % definition_name) - cpp_path = posixpath.join(self.output_dir, '%s.cpp' % definition_name) - return header_path, cpp_path - - def generate_code(self, definitions, definition_name): - """Returns .h/.cpp code as (header_text, cpp_text).""" - # Set local type info - IdlType.set_callback_functions(definitions.callback_functions.keys()) - IdlType.set_enums((enum.name, enum.values) - for enum in definitions.enumerations.values()) - + def generate_code_internal(self, definitions, definition_name): if definition_name in definitions.interfaces: return self.generate_interface_code( definitions, definition_name, @@ -182,7 +171,7 @@ template_context['header_includes'].add(interface_info['include_path']) header_text, cpp_text = render_template( interface_info, header_template, cpp_template, template_context) - header_path, cpp_path = self.output_paths_for_bindings(interface_name) + header_path, cpp_path = self.output_paths(interface_name) return ( (header_path, header_text), (cpp_path, cpp_text), @@ -190,37 +179,45 @@ def generate_dictionary_code(self, definitions, dictionary_name, dictionary): - interface_info = self.interfaces_info[dictionary_name] - bindings_results = self.generate_dictionary_bindings( - dictionary_name, interface_info, dictionary) - impl_results = self.generate_dictionary_impl( - dictionary_name, interface_info, dictionary) - return bindings_results + impl_results - - def generate_dictionary_bindings(self, dictionary_name, - interface_info, dictionary): header_template = self.jinja_env.get_template('dictionary_v8.h') cpp_template = self.jinja_env.get_template('dictionary_v8.cpp') template_context = v8_dictionary.dictionary_context(dictionary) + interface_info = self.interfaces_info[dictionary_name] # Add the include for interface itself template_context['header_includes'].add(interface_info['include_path']) header_text, cpp_text = render_template( interface_info, header_template, cpp_template, template_context) - header_path, cpp_path = self.output_paths_for_bindings(dictionary_name) + header_path, cpp_path = self.output_paths(dictionary_name) return ( (header_path, header_text), (cpp_path, cpp_text), ) - def generate_dictionary_impl(self, dictionary_name, - interface_info, dictionary): + +class CodeGeneratorDictionaryImpl(CodeGeneratorBase): + def __init__(self, interfaces_info, cache_dir, output_dir): + CodeGeneratorBase.__init__(self, interfaces_info, cache_dir, output_dir) + + def output_paths(self, definition_name, interface_info): + output_dir = posixpath.join(self.output_dir, + interface_info['relative_dir']) + header_path = posixpath.join(output_dir, '%s.h' % definition_name) + cpp_path = posixpath.join(output_dir, '%s.cpp' % definition_name) + return header_path, cpp_path + + def generate_code_internal(self, definitions, definition_name): + if not definition_name in definitions.dictionaries: + raise ValueError('%s is not an IDL dictionary') + dictionary = definitions.dictionaries[definition_name] + interface_info = self.interfaces_info[definition_name] header_template = self.jinja_env.get_template('dictionary_impl.h') cpp_template = self.jinja_env.get_template('dictionary_impl.cpp') template_context = v8_dictionary.dictionary_impl_context( dictionary, self.interfaces_info) header_text, cpp_text = render_template( interface_info, header_template, cpp_template, template_context) - header_path, cpp_path = self.output_paths_for_impl(dictionary_name) + header_path, cpp_path = self.output_paths( + definition_name, interface_info) return ( (header_path, header_text), (cpp_path, cpp_text),
diff --git a/bindings/scripts/compute_interfaces_info_individual.py b/bindings/scripts/compute_interfaces_info_individual.py index d7b58e1..58f6790 100755 --- a/bindings/scripts/compute_interfaces_info_individual.py +++ b/bindings/scripts/compute_interfaces_info_individual.py
@@ -47,7 +47,7 @@ import posixpath import sys -from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, is_dictionary_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl +from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, idl_filename_to_component, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, is_dictionary_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl module_path = os.path.dirname(__file__) source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) @@ -63,14 +63,11 @@ def parse_options(): usage = 'Usage: %prog [options] [generated1.idl]...' parser = optparse.OptionParser(usage=usage) - parser.add_option('--component-dir', help='component directory') parser.add_option('--idl-files-list', help='file listing IDL files') parser.add_option('--interfaces-info-file', help='output pickle file') parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja') options, args = parser.parse_args() - if options.component_dir is None: - parser.error('Must specify a component directory using --component-dir.') if options.interfaces_info_file is None: parser.error('Must specify an output file using --interfaces-info-file.') if options.idl_files_list is None: @@ -85,21 +82,26 @@ # Computations ################################################################################ +def relative_dir_posix(idl_filename): + """Returns relative path to the directory of idl_file in POSIX format.""" + relative_path_local = os.path.relpath(idl_filename, source_path) + relative_dir_local = os.path.dirname(relative_path_local) + return relative_dir_local.replace(os.path.sep, posixpath.sep) + + def include_path(idl_filename, implemented_as=None): """Returns relative path to header file in POSIX format; used in includes. POSIX format is used for consistency of output, so reference tests are platform-independent. """ - relative_path_local = os.path.relpath(idl_filename, source_path) - relative_dir_local = os.path.dirname(relative_path_local) - relative_dir_posix = relative_dir_local.replace(os.path.sep, posixpath.sep) + relative_dir = relative_dir_posix(idl_filename) # IDL file basename is used even if only a partial interface file idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename)) cpp_class_name = implemented_as or idl_file_basename - return posixpath.join(relative_dir_posix, cpp_class_name + '.h') + return posixpath.join(relative_dir, cpp_class_name + '.h') def add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path=None): @@ -109,13 +111,14 @@ paths_dict['include_paths'].append(this_include_path) -def compute_info_individual(idl_filename, component_dir): +def compute_info_individual(idl_filename): full_path = os.path.realpath(idl_filename) idl_file_contents = get_file_contents(full_path) extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents) implemented_as = extended_attributes.get('ImplementedAs') - this_include_path = include_path(idl_filename, implemented_as) + relative_dir = relative_dir_posix(idl_filename) + this_include_path = None if 'NoImplHeader' in extended_attributes else include_path(idl_filename, implemented_as) # Handle partial interfaces partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents) @@ -133,7 +136,6 @@ left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name) interfaces_info[interface_name] = { - 'component_dir': component_dir, 'extended_attributes': extended_attributes, 'full_path': full_path, 'implemented_as': implemented_as, @@ -153,6 +155,7 @@ # These cause rebuilds of referrers, due to the dependency, so these # should be minimized; currently only targets of [PutForwards]. 'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents), + 'relative_dir': relative_dir, } @@ -182,7 +185,7 @@ # Information is stored in global variables interfaces_info and # partial_interface_files. for idl_filename in idl_files: - compute_info_individual(idl_filename, options.component_dir) + compute_info_individual(idl_filename) write_pickle_file(options.interfaces_info_file, info_individual(),
diff --git a/bindings/scripts/compute_interfaces_info_overall.py b/bindings/scripts/compute_interfaces_info_overall.py index 658ccfa..6e31121 100755 --- a/bindings/scripts/compute_interfaces_info_overall.py +++ b/bindings/scripts/compute_interfaces_info_overall.py
@@ -81,12 +81,13 @@ import optparse import sys -from utilities import read_pickle_files, write_pickle_file +from utilities import idl_filename_to_component, read_pickle_files, write_pickle_file INHERITED_EXTENDED_ATTRIBUTES = set([ 'ActiveDOMObject', 'DependentLifetime', 'GarbageCollected', + 'NotScriptWrappable', 'WillBeGarbageCollected', ]) @@ -159,6 +160,42 @@ }) +def compute_global_type_info(): + ancestors = {} + dictionaries = {} + component_dirs = {} + implemented_as_interfaces = {} + will_be_garbage_collected_interfaces = set() + garbage_collected_interfaces = set() + callback_interfaces = set() + + for interface_name, interface_info in interfaces_info.iteritems(): + component_dirs[interface_name] = idl_filename_to_component(interface_info['full_path']) + + if interface_info['ancestors']: + ancestors[interface_name] = interface_info['ancestors'] + if interface_info['is_callback_interface']: + callback_interfaces.add(interface_name) + if interface_info['is_dictionary']: + dictionaries[interface_name] = interface_info['is_dictionary'] + if interface_info['implemented_as']: + implemented_as_interfaces[interface_name] = interface_info['implemented_as'] + + inherited_extended_attributes = interface_info['inherited_extended_attributes'] + if 'WillBeGarbageCollected' in inherited_extended_attributes: + will_be_garbage_collected_interfaces.add(interface_name) + if 'GarbageCollected' in inherited_extended_attributes: + garbage_collected_interfaces.add(interface_name) + + interfaces_info['ancestors'] = ancestors + interfaces_info['callback_interfaces'] = callback_interfaces + interfaces_info['dictionaries'] = dictionaries + interfaces_info['implemented_as_interfaces'] = implemented_as_interfaces + interfaces_info['garbage_collected_interfaces'] = garbage_collected_interfaces + interfaces_info['will_be_garbage_collected_interfaces'] = will_be_garbage_collected_interfaces + interfaces_info['component_dirs'] = component_dirs + + def compute_interfaces_info_overall(info_individuals): """Compute information about IDL files. @@ -227,10 +264,11 @@ # However, they are needed for legacy implemented interfaces that # are being treated as partial interfaces, until we remove these. # http://crbug.com/360435 - implemented_interfaces_include_paths = [ - implemented_interface_info['include_path'] - for implemented_interface_info in implemented_interfaces_info - if implemented_interface_info['is_legacy_treat_as_partial_interface']] + implemented_interfaces_include_paths = [] + for implemented_interface_info in implemented_interfaces_info: + if (implemented_interface_info['is_legacy_treat_as_partial_interface'] and + implemented_interface_info['include_path']): + implemented_interfaces_include_paths.append(implemented_interface_info['include_path']) interface_info.update({ 'dependencies_full_paths': (partial_interfaces_full_paths + @@ -245,6 +283,10 @@ del interface_info['is_legacy_treat_as_partial_interface'] del interface_info['parent'] + # Compute global_type_info to interfaces_info so that idl_compiler does + # not need to always calculate the info in __init__. + compute_global_type_info() + ################################################################################
diff --git a/bindings/scripts/idl_compiler.py b/bindings/scripts/idl_compiler.py index c74aae7..3721e12 100755 --- a/bindings/scripts/idl_compiler.py +++ b/bindings/scripts/idl_compiler.py
@@ -38,15 +38,17 @@ import cPickle as pickle import sys -from code_generator_v8 import CodeGeneratorV8 +from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8 from idl_reader import IdlReader -from utilities import write_file +from utilities import read_idl_files_list_from_file, write_file, idl_filename_to_component def parse_options(): parser = OptionParser() parser.add_option('--cache-directory', help='cache directory, defaults to output directory') + parser.add_option('--generate-dictionary-impl', + action="store_true", default=False) parser.add_option('--output-directory') parser.add_option('--interfaces-info-file') parser.add_option('--write-file-only-if-changed', type='int') @@ -102,9 +104,10 @@ def compile_and_write(self, idl_filename): interface_name = idl_filename_to_interface_name(idl_filename) + component = idl_filename_to_component(idl_filename) definitions = self.reader.read_idl_definitions(idl_filename) output_code_list = self.code_generator.generate_code( - definitions, interface_name) + definitions[component], interface_name) for output_path, output_code in output_code_list: write_file(output_code, output_path, self.only_if_changed) @@ -124,14 +127,46 @@ self.compile_and_write(idl_filename) -def main(): - options, idl_filename = parse_options() +class IdlCompilerDictionaryImpl(IdlCompiler): + def __init__(self, *args, **kwargs): + IdlCompiler.__init__(self, *args, **kwargs) + self.code_generator = CodeGeneratorDictionaryImpl( + self.interfaces_info, self.cache_directory, self.output_directory) + + def compile_file(self, idl_filename): + self.compile_and_write(idl_filename) + + +def generate_bindings(options, input_filename): idl_compiler = IdlCompilerV8( options.output_directory, cache_directory=options.cache_directory, interfaces_info_filename=options.interfaces_info_file, only_if_changed=options.write_file_only_if_changed) - idl_compiler.compile_file(idl_filename) + idl_compiler.compile_file(input_filename) + + +def generate_dictionary_impl(options, input_filename): + idl_compiler = IdlCompilerDictionaryImpl( + options.output_directory, + cache_directory=options.cache_directory, + interfaces_info_filename=options.interfaces_info_file, + only_if_changed=options.write_file_only_if_changed) + + idl_filenames = read_idl_files_list_from_file(input_filename) + for idl_filename in idl_filenames: + idl_compiler.compile_file(idl_filename) + + +def main(): + options, input_filename = parse_options() + if options.generate_dictionary_impl: + # |input_filename| should be a file which contains a list of IDL + # dictionary paths. + generate_dictionary_impl(options, input_filename) + else: + # |input_filename| should be a path of an IDL file. + generate_bindings(options, input_filename) if __name__ == '__main__':
diff --git a/bindings/scripts/idl_definitions.py b/bindings/scripts/idl_definitions.py index d5dae32..ee7158a 100644 --- a/bindings/scripts/idl_definitions.py +++ b/bindings/scripts/idl_definitions.py
@@ -62,7 +62,7 @@ import abc -from idl_types import IdlType, IdlUnionType, IdlArrayType, IdlSequenceType +from idl_types import IdlType, IdlUnionType, IdlArrayType, IdlSequenceType, IdlNullableType SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER'] STANDARD_TYPEDEFS = { @@ -637,13 +637,14 @@ """ Returns: Dictionary of {ExtAttributeName: ExtAttributeValue}. - Value is usually a string, with three exceptions: + Value is usually a string, with these exceptions: Constructors: value is a list of Arguments nodes, corresponding to possible signatures of the constructor. CustomConstructors: value is a list of Arguments nodes, corresponding to possible signatures of the custom constructor. NamedConstructor: value is a Call node, corresponding to the single signature of the named constructor. + SetWrapperReferenceTo: value is an Arguments node. """ # Primarily just make a dictionary from the children. # The only complexity is handling various types of constructors: @@ -755,23 +756,25 @@ if len(children) < 1 or len(children) > 2: raise ValueError('Type node expects 1 or 2 children (type + optional array []), got %s (multi-dimensional arrays are not supported).' % len(children)) - is_nullable = node.GetProperty('NULLABLE') or False # syntax: T? - type_node_child = children[0] - base_type = type_node_inner_to_type(type_node_child, is_nullable=is_nullable) + base_type = type_node_inner_to_type(children[0]) + + if node.GetProperty('NULLABLE'): + base_type = IdlNullableType(base_type) if len(children) == 2: array_node = children[1] array_node_class = array_node.GetClass() if array_node_class != 'Array': raise ValueError('Expected Array node as TypeSuffix, got %s node.' % array_node_class) - array_is_nullable = array_node.GetProperty('NULLABLE') or False - return IdlArrayType(base_type, is_nullable=array_is_nullable) + array_type = IdlArrayType(base_type) + if array_node.GetProperty('NULLABLE'): + return IdlNullableType(array_type) + return array_type return base_type -def type_node_inner_to_type(node, is_nullable=False): - # FIXME: remove is_nullable once have IdlNullableType +def type_node_inner_to_type(node): node_class = node.GetClass() # Note Type*r*ef, not Typedef, meaning the type is an identifier, thus # either a typedef shorthand (but not a Typedef declaration itself) or an @@ -779,18 +782,17 @@ if node_class in ['PrimitiveType', 'Typeref']: # unrestricted syntax: unrestricted double | unrestricted float is_unrestricted = node.GetProperty('UNRESTRICTED') or False - return IdlType(node.GetName(), is_nullable=is_nullable, is_unrestricted=is_unrestricted) + return IdlType(node.GetName(), is_unrestricted=is_unrestricted) elif node_class == 'Any': - return IdlType('any', is_nullable=is_nullable) + return IdlType('any') elif node_class == 'Sequence': - sequence_is_nullable = node.GetProperty('NULLABLE') or False - return sequence_node_to_type(node, is_nullable=sequence_is_nullable) + return sequence_node_to_type(node) elif node_class == 'UnionType': - return union_type_node_to_idl_union_type(node, is_nullable=is_nullable) + return union_type_node_to_idl_union_type(node) raise ValueError('Unrecognized node class: %s' % node_class) -def sequence_node_to_type(node, is_nullable=False): +def sequence_node_to_type(node): children = node.GetChildren() if len(children) != 1: raise ValueError('Sequence node expects exactly 1 child, got %s' % len(children)) @@ -799,7 +801,10 @@ if sequence_child_class != 'Type': raise ValueError('Unrecognized node class: %s' % sequence_child_class) element_type = type_node_to_type(sequence_child) - return IdlSequenceType(element_type, is_nullable=is_nullable) + sequence_type = IdlSequenceType(element_type) + if node.GetProperty('NULLABLE'): + return IdlNullableType(sequence_type) + return sequence_type def typedef_node_to_type(node): @@ -813,7 +818,7 @@ return type_node_to_type(child) -def union_type_node_to_idl_union_type(node, is_nullable=False): +def union_type_node_to_idl_union_type(node): member_types = [type_node_to_type(member_type_node) for member_type_node in node.GetChildren()] - return IdlUnionType(member_types, is_nullable=is_nullable) + return IdlUnionType(member_types)
diff --git a/bindings/scripts/idl_reader.py b/bindings/scripts/idl_reader.py index 23797a7..7c7f5e5 100644 --- a/bindings/scripts/idl_reader.py +++ b/bindings/scripts/idl_reader.py
@@ -39,12 +39,14 @@ from idl_definitions import IdlDefinitions from idl_validator import EXTENDED_ATTRIBUTES_RELATIVE_PATH, IDLInvalidExtendedAttributeError, IDLExtendedAttributeValidator from interface_dependency_resolver import InterfaceDependencyResolver +from utilities import idl_filename_to_component class IdlReader(object): def __init__(self, interfaces_info=None, outputdir='', multi_interface=False): self.multi_interface = multi_interface self.extended_attribute_validator = IDLExtendedAttributeValidator() + self.interfaces_info = interfaces_info if interfaces_info: self.interface_dependency_resolver = InterfaceDependencyResolver(interfaces_info, self) @@ -54,12 +56,19 @@ self.parser = BlinkIDLParser(outputdir=outputdir) def read_idl_definitions(self, idl_filename): - """Returns an IdlDefinitions object for an IDL file, including all dependencies.""" + """Returns a dictionary whose key is component and value is an IdlDefinitions object for an IDL file, including all dependencies.""" definitions = self.read_idl_file(idl_filename) + component = idl_filename_to_component(idl_filename) + if not self.interface_dependency_resolver: - return definitions - self.interface_dependency_resolver.resolve_dependencies(definitions) - return definitions + return {component: definitions} + + # This definitions should have a dictionary. No need to resolve any + # dependencies. + if not definitions.interfaces: + return {component: definitions} + + return self.interface_dependency_resolver.resolve_dependencies(definitions, component) def read_idl_file(self, idl_filename): """Returns an IdlDefinitions object for an IDL file, without any dependencies.
diff --git a/bindings/scripts/idl_types.py b/bindings/scripts/idl_types.py index d0797a6..7be4b7d 100644 --- a/bindings/scripts/idl_types.py +++ b/bindings/scripts/idl_types.py
@@ -10,6 +10,7 @@ IdlArrayOrSequenceType IdlArrayType IdlSequenceType + IdlNullableType """ from collections import defaultdict @@ -99,86 +100,17 @@ class IdlTypeBase(object): - """Base class for IdlType, IdlUnionType and IdlArrayOrSequenceType.""" - - def __init__(self, is_nullable): - self.base_type = None - self.is_nullable = is_nullable + """Base class for IdlType, IdlUnionType, IdlArrayOrSequenceType and IdlNullableType.""" def __str__(self): - inner_string = self.inner_string - if self.is_nullable: - # FIXME: Dictionary::ConversionContext::setConversionType can't - # handle the '?' in nullable types (passes nullability separately). - # Update that function to handle nullability from the type name, - # simplifying its signature. - # return inner_string + '?' - return inner_string - return inner_string - - @property - def inner_string(self): raise NotImplementedError( - 'inner_string property should be defined in subclasses') + '__str__() should be defined in subclasses') - @property - def is_basic_type(self): - return False - - @property - def is_callback_function(self): - return False - - @property - def is_callback_interface(self): - return False - - @property - def is_dictionary(self): - return False - - @property - def is_enum(self): - return False - - @property - def is_integer_type(self): - return False - - @property - def is_numeric_type(self): - return False - - @property - def is_primitive_type(self): - return False - - @property - def is_interface_type(self): - return False - - @property - def is_string_type(self): - return False - - @property - def is_union_type(self): - return False - - @property - def may_raise_exception_on_conversion(self): - return False - - @property - def name(self): - if self.is_nullable: - return self.inner_name + 'OrNull' - return self.inner_name - - @property - def inner_name(self): - raise NotImplementedError( - 'inner_name property should be defined in subclasses') + def __getattr__(self, name): + # Default undefined attributes to None (analogous to Jinja variables). + # This allows us to not define default properties in the base class, and + # allows us to relay __getattr__ in IdlNullableType to the inner type. + return None def resolve_typedefs(self, typedefs): raise NotImplementedError( @@ -198,15 +130,14 @@ dictionaries = set() enums = {} # name -> values - def __init__(self, base_type, is_nullable=False, is_unrestricted=False): - super(IdlType, self).__init__(is_nullable) + def __init__(self, base_type, is_unrestricted=False): + super(IdlType, self).__init__() if is_unrestricted: self.base_type = 'unrestricted %s' % base_type else: self.base_type = base_type - @property - def inner_string(self): + def __str__(self): return self.base_type @property @@ -263,20 +194,15 @@ @property def is_string_type(self): - return self.inner_name in STRING_TYPES - - @property - def may_raise_exception_on_conversion(self): - return (self.is_integer_type or - self.name in ('ByteString', 'ScalarValueString')) + return self.name in STRING_TYPES @property def is_union_type(self): return isinstance(self, IdlUnionType) @property - def inner_name(self): - """Return type name (or inner type name if nullable) + def name(self): + """Return type name http://heycam.github.io/webidl/#dfn-type-name """ @@ -300,19 +226,9 @@ cls.enums.update(new_enums) def resolve_typedefs(self, typedefs): - # This function either returns |self|, possibly mutated, or leaves this - # object unmodified and returns a different object. - # FIXME: Change to never mutate |self|, and rename typedefs_resolved(). - if self.base_type not in typedefs: - return self - new_type = typedefs[self.base_type] - if type(new_type) != type(self): - # If type changes, need to return a different object, - # since can't change type(self) - return new_type - # If type doesn't change, just mutate self to avoid a new object - self.__init__(new_type.base_type, self.is_nullable or new_type.is_nullable) - return self + # This function either returns |self| or a different object. + # FIXME: Rename typedefs_resolved(). + return typedefs.get(self.base_type, self) ################################################################################ @@ -321,8 +237,8 @@ class IdlUnionType(IdlTypeBase): # http://heycam.github.io/webidl/#idl-union - def __init__(self, member_types, is_nullable=False): - super(IdlUnionType, self).__init__(is_nullable=is_nullable) + def __init__(self, member_types): + super(IdlUnionType, self).__init__() self.member_types = member_types @property @@ -330,7 +246,7 @@ return True @property - def inner_name(self): + def name(self): """Return type name (or inner type name if nullable) http://heycam.github.io/webidl/#dfn-type-name @@ -351,8 +267,8 @@ class IdlArrayOrSequenceType(IdlTypeBase): """Base class for IdlArrayType and IdlSequenceType.""" - def __init__(self, element_type, is_nullable=False): - super(IdlArrayOrSequenceType, self).__init__(is_nullable) + def __init__(self, element_type): + super(IdlArrayOrSequenceType, self).__init__() self.element_type = element_type def resolve_typedefs(self, typedefs): @@ -361,26 +277,60 @@ class IdlArrayType(IdlArrayOrSequenceType): - def __init__(self, element_type, is_nullable=False): - super(IdlArrayType, self).__init__(element_type, is_nullable) + def __init__(self, element_type): + super(IdlArrayType, self).__init__(element_type) - @property - def inner_string(self): + def __str__(self): return '%s[]' % self.element_type @property - def inner_name(self): + def name(self): return self.element_type.name + 'Array' class IdlSequenceType(IdlArrayOrSequenceType): - def __init__(self, element_type, is_nullable=False): - super(IdlSequenceType, self).__init__(element_type, is_nullable) + def __init__(self, element_type): + super(IdlSequenceType, self).__init__(element_type) - @property - def inner_string(self): + def __str__(self): return 'sequence<%s>' % self.element_type @property - def inner_name(self): + def name(self): return self.element_type.name + 'Sequence' + + +################################################################################ +# IdlNullableType +################################################################################ + +class IdlNullableType(IdlTypeBase): + def __init__(self, inner_type): + super(IdlNullableType, self).__init__() + self.inner_type = inner_type + + def __str__(self): + # FIXME: Dictionary::ConversionContext::setConversionType can't + # handle the '?' in nullable types (passes nullability separately). + # Update that function to handle nullability from the type name, + # simplifying its signature. + # return str(self.inner_type) + '?' + return str(self.inner_type) + + def __getattr__(self, name): + return getattr(self.inner_type, name) + + @property + def is_nullable(self): + return True + + @property + def name(self): + # DartFix: Don't handle OrNull all classes generated are same regardless + # of nullable type. + # return self.inner_type.name + 'OrNull' + return self.inner_type.name + + def resolve_typedefs(self, typedefs): + self.inner_type = self.inner_type.resolve_typedefs(typedefs) + return self
diff --git a/bindings/scripts/idl_validator.py b/bindings/scripts/idl_validator.py index 29ccd7d..e75099e 100644 --- a/bindings/scripts/idl_validator.py +++ b/bindings/scripts/idl_validator.py
@@ -77,8 +77,10 @@ return if values_string is None: values = set([None]) + elif isinstance(values_string, list): + values = set(values_string) else: - values = set(re.split('[|,]', values_string)) + values = set([values_string]) invalid_values = values - valid_values if invalid_values: invalid_value = invalid_values.pop()
diff --git a/bindings/scripts/interface_dependency_resolver.py b/bindings/scripts/interface_dependency_resolver.py index ece506a..7bf3b05 100644 --- a/bindings/scripts/interface_dependency_resolver.py +++ b/bindings/scripts/interface_dependency_resolver.py
@@ -63,7 +63,7 @@ self.interfaces_info = interfaces_info self.reader = reader - def resolve_dependencies(self, definitions): + def resolve_dependencies(self, definitions, component): """Resolve dependencies, merging them into IDL definitions of main file. Dependencies consist of 'partial interface' for the same interface as @@ -81,10 +81,27 @@ Args: definitions: IdlDefinitions object, modified in place + component: + string, describing where the above definitions are defined, + 'core' or 'modules'. See KNOWN_COMPONENTS in utilities.py + + Returns: + A dictionary whose key is component and value is IdlDefinitions + object whose dependency is resolved. + + Raises: + Exception: + A given IdlDefinitions object doesn't have any interfaces, + or a given IdlDefinitions object has incorrect referenced + interfaces. """ + # FIXME: we need to resolve dependency when we implement partial + # dictionary. if not definitions.interfaces: - # This definitions should have a dictionary. Nothing to do for it. - return + raise Exception('No need to resolve any dependencies of ' + 'this definition: %s, because this should ' + 'have a dictionary.' % definitions.idl_name) + target_interface = next(definitions.interfaces.itervalues()) interface_name = target_interface.name interface_info = self.interfaces_info[interface_name] @@ -93,18 +110,30 @@ target_interface.extended_attributes.update( interface_info['inherited_extended_attributes']) - merge_interface_dependencies(definitions, - target_interface, - interface_info['dependencies_full_paths'], - self.reader) + resolved_definitions = merge_interface_dependencies( + definitions, + component, + target_interface, + interface_info['dependencies_full_paths'], + self.reader) for referenced_interface_name in interface_info['referenced_interfaces']: referenced_definitions = self.reader.read_idl_definitions( self.interfaces_info[referenced_interface_name]['full_path']) - definitions.update(referenced_definitions) + + if component not in referenced_definitions: + raise Exception('This definitions: %s is defined in %s ' + 'but reference interface:%s is not defined ' + 'in %s' % (definitions.idl_name, + component, + referenced_interface_name, + component)) + + resolved_definitions[component].update(referenced_definitions[component]) + return resolved_definitions -def merge_interface_dependencies(definitions, target_interface, dependency_idl_filenames, reader): +def merge_interface_dependencies(definitions, component, target_interface, dependency_idl_filenames, reader): """Merge dependencies ('partial interface' and 'implements') in dependency_idl_filenames into target_interface. No return: modifies target_interface in place. @@ -112,6 +141,8 @@ # Sort so order consistent, so can compare output from run to run. for dependency_idl_filename in sorted(dependency_idl_filenames): dependency_definitions = reader.read_idl_file(dependency_idl_filename) + # FIXME(crbug.com/358074): should not merge core definitions with + # modules definitions. dependency_interface = next(dependency_definitions.interfaces.itervalues()) dependency_interface_basename, _ = os.path.splitext(os.path.basename(dependency_idl_filename)) @@ -124,6 +155,12 @@ # over one list (and not need to handle 'implements' itself). target_interface.merge(dependency_interface) + # FIXME: Currently, this function just returns one IdlDefinitions + # instance. However, for partial interface modularization, we need to + # make this function return multiple definitions, i.e. + # { 'core': ..., 'modules': ... }. + return {component: definitions} + def transfer_extended_attributes(dependency_interface, dependency_interface_basename): """Transfer extended attributes from dependency interface onto members.
diff --git a/bindings/scripts/utilities.py b/bindings/scripts/utilities.py index 3674765..4d80ca7 100644 --- a/bindings/scripts/utilities.py +++ b/bindings/scripts/utilities.py
@@ -11,6 +11,10 @@ import cPickle as pickle import re import string +import subprocess + + +KNOWN_COMPONENTS = frozenset(['core', 'modules']) class IdlBadFilenameError(Exception): @@ -23,6 +27,16 @@ return os.path.splitext(os.path.basename(idl_filename))[0] +def idl_filename_to_component(idl_filename): + path = os.path.dirname(os.path.realpath(idl_filename)) + while path: + dirname, basename = os.path.split(path) + if basename.lower() in KNOWN_COMPONENTS: + return basename.lower() + path = dirname + raise 'Unknown component type for %s' % idl_filename + + ################################################################################ # Basic file reading/writing ################################################################################ @@ -38,6 +52,34 @@ return [line.rstrip('\n') for line in f] +def resolve_cygpath(cygdrive_names): + if not cygdrive_names: + return [] + cmd = ['cygpath', '-f', '-', '-wa'] + process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + idl_file_names = [] + for file_name in cygdrive_names: + process.stdin.write('%s\n' % file_name) + process.stdin.flush() + idl_file_names.append(process.stdout.readline().rstrip()) + process.stdin.close() + process.wait() + return idl_file_names + + +def read_idl_files_list_from_file(filename): + """Similar to read_file_to_list, but also resolves cygpath.""" + with open(filename) as input_file: + file_names = sorted([os.path.realpath(line.rstrip('\n')) + for line in input_file]) + idl_file_names = [file_name for file_name in file_names + if not file_name.startswith('/cygdrive')] + cygdrive_names = [file_name for file_name in file_names + if file_name.startswith('/cygdrive')] + idl_file_names.extend(resolve_cygpath(cygdrive_names)) + return idl_file_names + + def read_pickle_files(pickle_filenames): for pickle_filename in pickle_filenames: with open(pickle_filename) as pickle_file: @@ -49,6 +91,9 @@ with open(destination_filename) as destination_file: if destination_file.read() == new_text: return + destination_dirname = os.path.dirname(destination_filename) + if not os.path.exists(destination_dirname): + os.makedirs(destination_dirname) with open(destination_filename, 'w') as destination_file: destination_file.write(new_text)
diff --git a/bindings/scripts/v8_attributes.py b/bindings/scripts/v8_attributes.py index bb61ef9..2a09c88 100644 --- a/bindings/scripts/v8_attributes.py +++ b/bindings/scripts/v8_attributes.py
@@ -38,7 +38,9 @@ from v8_globals import includes, interfaces import v8_types import v8_utilities -from v8_utilities import capitalize, cpp_name, has_extended_attribute, has_extended_attribute_value, scoped_name, strip_suffix, uncapitalize +from v8_utilities import (capitalize, cpp_name, has_extended_attribute, + has_extended_attribute_value, scoped_name, strip_suffix, + uncapitalize, extended_attribute_value_as_list) def attribute_context(interface, attribute): @@ -56,7 +58,7 @@ is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes is_reflect = 'Reflect' in extended_attributes if is_custom_element_callbacks or is_reflect: - includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + includes.add('core/dom/custom/CustomElementProcessingStack.h') # [PerWorldBindings] if 'PerWorldBindings' in extended_attributes: assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name) @@ -84,7 +86,6 @@ 'access_control_list': access_control_list(attribute), 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_world_list(attribute, 'Getter'), # [ActivityLogging] 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_world_list(attribute, 'Setter'), # [ActivityLogging] - 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in extended_attributes, # [ActivityLogging] 'activity_logging_world_check': v8_utilities.activity_logging_world_check(attribute), # [ActivityLogging] 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 'cached_attribute_validation_method': extended_attributes.get('CachedAttribute'), @@ -135,8 +136,7 @@ 'reflect_empty': extended_attributes.get('ReflectEmpty'), 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 'reflect_missing': extended_attributes.get('ReflectMissing'), - 'reflect_only': extended_attributes['ReflectOnly'].split('|') - if 'ReflectOnly' in extended_attributes else None, + 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly'), 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] 'setter_callback': setter_callback_name(interface, attribute), 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), @@ -176,7 +176,8 @@ release = False if 'ImplementedInPrivateScript' in extended_attributes: if (not idl_type.is_wrapper_type and - not idl_type.is_basic_type): + not idl_type.is_basic_type and + not idl_type.is_enum): raise Exception('Private scripts supports only primitive types and DOM wrappers.') context['cpp_value_original'] = cpp_value @@ -187,7 +188,6 @@ elif (idl_type.is_explicit_nullable or base_idl_type == 'EventHandler' or 'CachedAttribute' in extended_attributes or - 'LogPreviousValue' in extended_attributes or 'ReflectOnly' in extended_attributes or context['is_keep_alive_for_gc'] or context['is_getter_raises_exception']): @@ -327,7 +327,7 @@ 'has_setter_exception_state': is_setter_raises_exception or has_type_checking_interface or context['has_type_checking_unrestricted'] or - idl_type.may_raise_exception_on_conversion, + idl_type.v8_conversion_needs_exception_state, 'has_type_checking_interface': has_type_checking_interface, 'is_setter_call_with_execution_context': v8_utilities.has_extended_attribute_value( attribute, 'SetterCallWith', 'ExecutionContext'),
diff --git a/bindings/scripts/v8_dictionary.py b/bindings/scripts/v8_dictionary.py index 6dc772f..a5be6c8 100644 --- a/bindings/scripts/v8_dictionary.py +++ b/bindings/scripts/v8_dictionary.py
@@ -6,7 +6,6 @@ implementation classes that are used by blink's core/modules. """ -import copy import operator from v8_globals import includes import v8_types @@ -19,6 +18,7 @@ ]) DICTIONARY_CPP_INCLUDES = frozenset([ + 'bindings/common/ExceptionState.h', # FIXME: Remove this, http://crbug.com/321462 'bindings/core/v8/Dictionary.h', ]) @@ -32,6 +32,12 @@ return 'has%s' % v8_utilities.capitalize(member.name) +def unwrap_nullable_if_needed(idl_type): + if idl_type.is_nullable: + return idl_type.inner_type + return idl_type + + # Context for V8 bindings def dictionary_context(dictionary): @@ -50,14 +56,7 @@ def member_context(member): idl_type = member.idl_type idl_type.add_includes_for_type() - - def idl_type_for_default_value(): - copied_type = copy.copy(idl_type) - # IdlType for default values shouldn't be nullable. Otherwise, - # it will generate meaningless expression like - # 'String("default value").isNull() ? ...'. - copied_type.is_nullable = False - return copied_type + idl_type = unwrap_nullable_if_needed(idl_type) def default_values(): if not member.default_value: @@ -65,7 +64,7 @@ if member.default_value.is_null: return None, 'v8::Null(isolate)' cpp_default_value = str(member.default_value) - v8_default_value = idl_type_for_default_value().cpp_value_to_v8_value( + v8_default_value = idl_type.cpp_value_to_v8_value( cpp_value=cpp_default_value, isolate='isolate', creation_context='creationContext') return cpp_default_value, v8_default_value @@ -79,7 +78,9 @@ cpp_value='impl->%s()' % member.name, isolate='isolate', creation_context='creationContext', extended_attributes=member.extended_attributes), + 'enum_validation_expression': idl_type.enum_validation_expression, 'has_method_name': has_method_name_for_dictionary_member(member), + 'is_object': idl_type.name == 'Object', 'name': member.name, 'setter_name': setter_name_for_dictionary_member(member), 'v8_default_value': v8_default_value, @@ -101,7 +102,8 @@ def member_impl_context(member, interfaces_info, header_includes): - idl_type = member.idl_type + idl_type = unwrap_nullable_if_needed(member.idl_type) + is_object = idl_type.name == 'Object' def getter_expression(): if idl_type.impl_should_use_nullable_container: @@ -109,9 +111,10 @@ return 'm_%s' % member.name def has_method_expression(): - if (idl_type.impl_should_use_nullable_container or - idl_type.is_string_type): + if idl_type.impl_should_use_nullable_container or idl_type.is_enum or idl_type.is_string_type: return '!m_%s.isNull()' % member.name + elif is_object: + return '!(m_{0}.isEmpty() || m_{0}.isNull() || m_{0}.isUndefined())'.format(member.name) else: return 'm_%s' % member.name @@ -121,11 +124,17 @@ return v8_types.cpp_template_type('Nullable', member_cpp_type) return member_cpp_type + cpp_default_value = None + if member.default_value and not member.default_value.is_null: + cpp_default_value = str(member.default_value) + header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) return { + 'cpp_default_value': cpp_default_value, 'getter_expression': getter_expression(), 'has_method_expression': has_method_expression(), 'has_method_name': has_method_name_for_dictionary_member(member), + 'is_object': is_object, 'is_traceable': (idl_type.is_garbage_collected or idl_type.is_will_be_garbage_collected), 'member_cpp_type': member_cpp_type(),
diff --git a/bindings/scripts/v8_interface.py b/bindings/scripts/v8_interface.py index 2980628..bf63e61 100644 --- a/bindings/scripts/v8_interface.py +++ b/bindings/scripts/v8_interface.py
@@ -46,7 +46,9 @@ import v8_types from v8_types import cpp_ptr_type, cpp_template_type import v8_utilities -from v8_utilities import capitalize, conditional_string, cpp_name, gc_type, has_extended_attribute_value, runtime_enabled_function_name +from v8_utilities import (capitalize, conditional_string, cpp_name, gc_type, + has_extended_attribute_value, runtime_enabled_function_name, + extended_attribute_value_as_list) INTERFACE_H_INCLUDES = frozenset([ @@ -101,6 +103,17 @@ # [DependentLifetime] is_dependent_lifetime = 'DependentLifetime' in extended_attributes + # [Iterable] + iterator_method = None + if 'Iterable' in extended_attributes: + iterator_operation = IdlOperation(interface.idl_name) + iterator_operation.name = 'iterator' + iterator_operation.idl_type = IdlType('Iterator') + iterator_operation.extended_attributes['RaisesException'] = None + iterator_operation.extended_attributes['CallWith'] = 'ScriptState' + iterator_method = v8_methods.method_context(interface, + iterator_operation) + # [MeasureAs] is_measure_as = 'MeasureAs' in extended_attributes if is_measure_as: @@ -126,9 +139,12 @@ for set_wrapper_reference_to in set_wrapper_reference_to_list: set_wrapper_reference_to['idl_type'].add_includes_for_type() + # [NotScriptWrappable] + is_script_wrappable = 'NotScriptWrappable' not in extended_attributes + # [SpecialWrapFor] if 'SpecialWrapFor' in extended_attributes: - special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') + special_wrap_for = extended_attribute_value_as_list(interface, 'SpecialWrapFor') else: special_wrap_for = [] for special_wrap_interface in special_wrap_for: @@ -142,10 +158,16 @@ this_gc_type = gc_type(interface) + wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Node') else 'ObjectClassId') + context = { 'conditional_string': conditional_string(interface), # [Conditional] 'cpp_class': cpp_name(interface), 'gc_type': this_gc_type, + # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 + 'has_access_check_callbacks': (is_check_security and + interface.name != 'Window' and + interface.name != 'EventTarget'), 'has_custom_legacy_call_as_function': has_extended_attribute_value(interface, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'ToV8'), # [Custom=ToV8] 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wrap'), # [Custom=Wrap] @@ -160,6 +182,13 @@ 'is_event_target': inherits_interface(interface.name, 'EventTarget'), 'is_exception': interface.is_exception, 'is_node': inherits_interface(interface.name, 'Node'), + 'is_script_wrappable': is_script_wrappable, + 'iterator_method': iterator_method, + 'lifetime': 'Dependent' + if (has_visit_dom_wrapper or + is_active_dom_object or + is_dependent_lifetime) + else 'Independent', 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] 'parent_interface': parent_interface, 'pass_cpp_type': cpp_template_type( @@ -170,11 +199,7 @@ 'set_wrapper_reference_to_list': set_wrapper_reference_to_list, 'special_wrap_for': special_wrap_for, 'v8_class': v8_utilities.v8_class_name(interface), - 'wrapper_configuration': 'WrapperConfiguration::Dependent' - if (has_visit_dom_wrapper or - is_active_dom_object or - is_dependent_lifetime) - else 'WrapperConfiguration::Independent', + 'wrapper_class_id': wrapper_class_id, } # Constructors @@ -221,11 +246,31 @@ 'named_constructor': named_constructor, }) + constants = [constant_context(constant) for constant in interface.constants] + + special_getter_constants = [] + runtime_enabled_constants = [] + constant_configuration_constants = [] + + for constant in constants: + if constant['measure_as'] or constant['deprecate_as']: + special_getter_constants.append(constant) + continue + if constant['runtime_enabled_function']: + runtime_enabled_constants.append(constant) + continue + constant_configuration_constants.append(constant) + # Constants context.update({ - 'constants': [constant_context(constant) - for constant in interface.constants], + 'constant_configuration_constants': constant_configuration_constants, + 'constants': constants, 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, + 'has_constant_configuration': any( + not constant['runtime_enabled_function'] + for constant in constants), + 'runtime_enabled_constants': runtime_enabled_constants, + 'special_getter_constants': special_getter_constants, }) # Attributes @@ -339,22 +384,17 @@ # [DeprecateAs], [Reflect], [RuntimeEnabled] def constant_context(constant): - # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted - # in C++. - if constant.idl_type.name == 'String': - value = '"%s"' % constant.value - else: - value = constant.value - extended_attributes = constant.extended_attributes return { 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), + 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] 'idl_type': constant.idl_type.name, + 'measure_as': v8_utilities.measure_as(constant), # [MeasureAs] 'name': constant.name, # FIXME: use 'reflected_name' as correct 'name' 'reflected_name': extended_attributes.get('Reflect', constant.name), 'runtime_enabled_function': runtime_enabled_function_name(constant), - 'value': value, + 'value': constant.value, } @@ -442,6 +482,13 @@ raise ValueError('Overloads of %s have conflicting extended attribute %s' % (name, extended_attribute)) + # Check and fail if overloads disagree about whether the return type + # is a Promise or not. + promise_overload_count = sum(1 for method in overloads if method.get('idl_type') == 'Promise') + if promise_overload_count not in (0, len(overloads)): + raise ValueError('Overloads of %s have conflicting Promise/non-Promise types' + % (name)) + return { 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [DeprecateAs] 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed] @@ -736,26 +783,26 @@ # • a sequence type # ... # • a dictionary - try: - # FIXME: IDL dictionary not implemented, so use Blink Dictionary - # http://crbug.com/321462 - idl_type, method = next((idl_type, method) - for idl_type, method in idl_types_methods - if (idl_type.native_array_element_type or - idl_type.name == 'Dictionary')) + # + # FIXME: + # We don't strictly follow the algorithm here. The algorithm says "remove + # all other entries" if there is "one entry" matching, but we yield all + # entries to support following constructors: + # [constructor(sequence<DOMString> arg), constructor(Dictionary arg)] + # interface I { ... } + # (Need to check array types before objects because an array is an object) + for idl_type, method in idl_types_methods: if idl_type.native_array_element_type: # (We test for Array instead of generic Object to type-check.) # FIXME: test for Object during resolution, then have type check for # Array in overloaded method: http://crbug.com/262383 - test = '%s->IsArray()' % cpp_value - else: + yield '%s->IsArray()' % cpp_value, method + for idl_type, method in idl_types_methods: + if idl_type.is_dictionary or idl_type.name == 'Dictionary': # FIXME: should be '{1}->IsObject() && !{1}->IsDate() && !{1}->IsRegExp()'.format(cpp_value) # FIXME: the IsDate and IsRegExp checks can be skipped if we've # already generated tests for them. - test = '%s->IsObject()' % cpp_value - yield test, method - except StopIteration: - pass + yield '%s->IsObject()' % cpp_value, method # (Check for exact type matches before performing automatic type conversion; # only needed if distinguishing between primitive types.) @@ -858,9 +905,6 @@ # [Constructor] def constructor_context(interface, constructor): - arguments_need_try_catch = any(v8_methods.argument_needs_try_catch(argument, return_promise=False) - for argument in constructor.arguments) - # [RaisesException=Constructor] is_constructor_raises_exception = \ interface.extended_attributes.get('RaisesException') == 'Constructor' @@ -868,7 +912,6 @@ return { 'arguments': [v8_methods.argument_context(interface, constructor, argument, index) for index, argument in enumerate(constructor.arguments)], - 'arguments_need_try_catch': arguments_need_try_catch, 'cpp_type': cpp_template_type( cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), cpp_name(interface)), @@ -878,7 +921,7 @@ is_constructor_raises_exception or any(argument for argument in constructor.arguments if argument.idl_type.name == 'SerializedScriptValue' or - argument.idl_type.may_raise_exception_on_conversion), + argument.idl_type.v8_conversion_needs_exception_state), 'is_call_with_document': # [ConstructorCallWith=Document] has_extended_attribute_value(interface, @@ -992,8 +1035,8 @@ idl_type.is_wrapper_type, 'idl_type': idl_type.base_type, 'is_custom': 'Custom' in extended_attributes, - 'has_exception_state': is_raises_exception or - idl_type.is_integer_type, + 'has_exception_state': (is_raises_exception or + idl_type.v8_conversion_needs_exception_state), 'is_raises_exception': is_raises_exception, 'name': cpp_name(setter), 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value(
diff --git a/bindings/scripts/v8_methods.py b/bindings/scripts/v8_methods.py index 16fceaa..d330712 100644 --- a/bindings/scripts/v8_methods.py +++ b/bindings/scripts/v8_methods.py
@@ -34,7 +34,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler """ -from idl_definitions import IdlArgument +from idl_definitions import IdlArgument, IdlOperation from idl_types import IdlTypeBase, IdlUnionType, inherits_interface from v8_globals import includes import v8_types @@ -52,23 +52,6 @@ ]) -def argument_needs_try_catch(argument, return_promise): - idl_type = argument.idl_type - base_type = idl_type.base_type - - return not ( - # These cases are handled by separate code paths in the - # generate_argument() macro in Source/bindings/templates/methods.cpp. - idl_type.is_callback_interface or - base_type == 'SerializedScriptValue' or - (argument.is_variadic and idl_type.is_wrapper_type) or - # String and enumeration arguments converted using one of the - # TOSTRING_* macros except for _PROMISE variants in - # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch. - (base_type == 'DOMString' and not argument.is_variadic and - not return_promise)) - - def use_local_result(method): extended_attributes = method.extended_attributes idl_type = method.idl_type @@ -85,7 +68,6 @@ idl_type = method.idl_type is_static = method.is_static name = method.name - return_promise = idl_type.name == 'Promise' idl_type.add_includes_for_type() this_cpp_value = cpp_value(interface, method, len(arguments)) @@ -118,16 +100,19 @@ includes.add('bindings/common/BindingSecurity.h') is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attributes if is_custom_element_callbacks: - includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') + includes.add('core/dom/custom/CustomElementProcessingStack.h') + + is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes is_check_security_for_frame = ( - 'CheckSecurity' in interface.extended_attributes and - 'DoNotCheckSecurity' not in extended_attributes) - is_raises_exception = 'RaisesException' in extended_attributes + has_extended_attribute_value(interface, 'CheckSecurity', 'Frame') and + not is_do_not_check_security) - arguments_need_try_catch = ( - any(argument_needs_try_catch(argument, return_promise) - for argument in arguments)) + is_check_security_for_window = ( + has_extended_attribute_value(interface, 'CheckSecurity', 'Window') and + not is_do_not_check_security) + + is_raises_exception = 'RaisesException' in extended_attributes return { 'activity_logging_world_list': v8_utilities.activity_logging_world_list(method), # [ActivityLogging] @@ -135,7 +120,6 @@ for index, argument in enumerate(arguments)], 'argument_declarations_for_private_script': argument_declarations_for_private_script(interface, method), - 'arguments_need_try_catch': arguments_need_try_catch, 'conditional_string': v8_utilities.conditional_string(method), 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) if idl_type.is_explicit_nullable else idl_type.cpp_type), @@ -153,19 +137,20 @@ 'has_exception_state': is_raises_exception or is_check_security_for_frame or - interface.name == 'EventTarget' or # FIXME: merge with is_check_security_for_frame http://crbug.com/383699 + is_check_security_for_window or any(argument for argument in arguments - if argument.idl_type.name == 'SerializedScriptValue' or - argument.idl_type.may_raise_exception_on_conversion), + if (argument.idl_type.name == 'SerializedScriptValue' or + argument_conversion_needs_exception_state(method, argument))), 'idl_type': idl_type.base_type, 'is_call_with_execution_context': has_extended_attribute_value(method, 'CallWith', 'ExecutionContext'), 'is_call_with_script_arguments': is_call_with_script_arguments, 'is_call_with_script_state': is_call_with_script_state, 'is_check_security_for_frame': is_check_security_for_frame, 'is_check_security_for_node': is_check_security_for_node, + 'is_check_security_for_window': is_check_security_for_window, 'is_custom': 'Custom' in extended_attributes, 'is_custom_element_callbacks': is_custom_element_callbacks, - 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, + 'is_do_not_check_security': is_do_not_check_security, 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attributes, 'is_explicit_nullable': idl_type.is_explicit_nullable, 'is_implemented_in_private_script': is_implemented_in_private_script, @@ -206,26 +191,24 @@ idl_type = argument.idl_type this_cpp_value = cpp_value(interface, method, index) is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type - return_promise = (method.idl_type.name == 'Promise' if method.idl_type - else False) if ('ImplementedInPrivateScript' in extended_attributes and not idl_type.is_wrapper_type and not idl_type.is_basic_type): raise Exception('Private scripts supports only primitive types and DOM wrappers.') + default_cpp_value = argument.default_cpp_value return { 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes, raw_type=True, used_as_variadic_argument=argument.is_variadic), - 'cpp_type_initializer': idl_type.cpp_type_initializer, 'cpp_value': this_cpp_value, # FIXME: check that the default value's type is compatible with the argument's - 'default_value': argument.default_cpp_value, + 'default_value': default_cpp_value, 'enum_validation_expression': idl_type.enum_validation_expression, 'handle': '%sHandle' % argument.name, # FIXME: remove once [Default] removed and just use argument.default_value - 'has_default': 'Default' in extended_attributes or argument.default_value, + 'has_default': 'Default' in extended_attributes or default_cpp_value, 'has_type_checking_interface': (has_extended_attribute_value(interface, 'TypeChecking', 'Interface') or has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and @@ -238,8 +221,9 @@ 'idl_type': idl_type.base_type, 'idl_type_object': idl_type, 'index': index, - 'is_clamp': 'Clamp' in extended_attributes, 'is_callback_interface': idl_type.is_callback_interface, + # FIXME: Remove generic 'Dictionary' special-casing + 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictionary', 'is_nullable': idl_type.is_nullable, 'is_optional': argument.is_optional, 'is_variadic_wrapper_type': is_variadic_wrapper_type, @@ -250,7 +234,7 @@ creation_context='scriptState->context()->Global()'), 'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), - 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, return_promise=return_promise), + 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, return_promise=method.returns_promise), 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type), } @@ -274,8 +258,9 @@ idl_type = argument.idl_type if idl_type.name == 'EventListener': return argument.name - if (idl_type.is_callback_interface or - idl_type.name in ['NodeFilter', 'NodeFilterOrNull', + if idl_type.is_dictionary: + return '*%s' % argument.name + if (idl_type.name in ['NodeFilter', 'NodeFilterOrNull', 'XPathNSResolver', 'XPathNSResolverOrNull']): # FIXME: remove this special case return '%s.release()' % argument.name @@ -361,15 +346,16 @@ suffix = '' - macro = 'TONATIVE_VOID' + macro = 'TONATIVE_VOID_EXCEPTIONSTATE' macro_args = [ - argument.name, - 'toNativeArguments<%s>(info, %s)' % (idl_type.cpp_type, index), + argument.name, + 'toImplArguments<%s>(info, %s, exceptionState)' % (idl_type.cpp_type, index), + 'exceptionState', ] if return_promise: suffix += '_PROMISE' - macro_args.append('info') + macro_args.extend(['info', 'V8ScriptState::current(info.GetIsolate())']) suffix += '_INTERNAL' @@ -407,10 +393,12 @@ """Returns a context of union member for argument.""" this_cpp_value = 'result%d' % index this_cpp_type = idl_type.cpp_type + this_cpp_type_initializer = idl_type.cpp_type_initializer cpp_return_value = this_cpp_value if not idl_type.cpp_type_has_null_value: this_cpp_type = v8_types.cpp_template_type('Nullable', this_cpp_type) + this_cpp_type_initializer = '' cpp_return_value = '%s.get()' % this_cpp_value if idl_type.is_string_type: @@ -420,6 +408,7 @@ return { 'cpp_type': this_cpp_type, + 'cpp_type_initializer': this_cpp_type_initializer, 'cpp_value': this_cpp_value, 'null_check_value': null_check_value, 'v8_set_return_value': idl_type.v8_set_return_value( @@ -435,6 +424,9 @@ def argument_default_cpp_value(argument): + if argument.idl_type.is_dictionary: + # We always create impl objects for IDL dictionaries. + return '%s::create()' % argument.idl_type.base_type if not argument.default_value: return None return argument.idl_type.literal_cpp_value(argument.default_value) @@ -442,3 +434,17 @@ IdlTypeBase.union_arguments = None IdlUnionType.union_arguments = property(union_arguments) IdlArgument.default_cpp_value = property(argument_default_cpp_value) + + +def method_returns_promise(method): + return method.idl_type and method.idl_type.name == 'Promise' + +IdlOperation.returns_promise = property(method_returns_promise) + + +def argument_conversion_needs_exception_state(method, argument): + idl_type = argument.idl_type + return (idl_type.v8_conversion_needs_exception_state or + argument.is_variadic or + (method.returns_promise and (idl_type.is_string_type or + idl_type.is_enum)))
diff --git a/bindings/scripts/v8_types.py b/bindings/scripts/v8_types.py index 1ee093a..a332f4a 100644 --- a/bindings/scripts/v8_types.py +++ b/bindings/scripts/v8_types.py
@@ -39,7 +39,7 @@ import posixpath -from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType +from idl_types import IdlTypeBase, IdlType, IdlUnionType, IdlArrayOrSequenceType, IdlNullableType import v8_attributes # for IdlType.constructor_type_name from v8_globals import includes @@ -49,11 +49,9 @@ ################################################################################ NON_WRAPPER_TYPES = frozenset([ - 'CompareHow', 'Dictionary', 'EventHandler', 'EventListener', - 'MediaQueryListListener', 'NodeFilter', 'SerializedScriptValue', ]) @@ -72,12 +70,9 @@ 'Uint32Array': ('unsigned int', 'v8::kExternalUnsignedIntArray'), } -IdlTypeBase.is_typed_array_element_type = False IdlType.is_typed_array_element_type = property( lambda self: self.base_type in TYPED_ARRAYS) - -IdlTypeBase.is_wrapper_type = False IdlType.is_wrapper_type = property( lambda self: (self.is_interface_type and self.base_type not in NON_WRAPPER_TYPES)) @@ -105,11 +100,9 @@ 'unsigned short', ]) CPP_SPECIAL_CONVERSION_RULES = { - 'CompareHow': 'Range::CompareHow', 'Date': 'double', 'Dictionary': 'Dictionary', 'EventHandler': 'EventListener*', - 'MediaQueryListListener': 'RefPtrWillBeRawPtr<MediaQueryListListener>', 'NodeFilter': 'RefPtrWillBeRawPtr<NodeFilter>', 'Promise': 'ScriptPromise', 'ScriptValue': 'ScriptValue', @@ -203,13 +196,24 @@ |idl_type| argument is of type IdlType. """ - if (idl_type.is_numeric_type): + base_idl_type = idl_type.base_type + + if idl_type.native_array_element_type: + return '' + if idl_type.is_numeric_type: return ' = 0' - if idl_type.base_type == 'boolean': + if base_idl_type == 'boolean': return ' = false' if idl_type.base_type == 'Promise': return '(nullptr)' - return '' + + if (base_idl_type in NON_WRAPPER_TYPES or + base_idl_type in CPP_SPECIAL_CONVERSION_RULES or + base_idl_type == 'any' or + idl_type.is_string_type or + idl_type.is_enum): + return '' + return ' = nullptr' def cpp_type_union(idl_type, extended_attributes=None, raw_type=False): @@ -231,7 +235,6 @@ IdlUnionType.cpp_type_args = cpp_type_union -IdlTypeBase.native_array_element_type = None IdlArrayOrSequenceType.native_array_element_type = property( lambda self: self.element_type) @@ -287,7 +290,6 @@ # [GarbageCollected] IdlType.garbage_collected_types = set() -IdlTypeBase.is_garbage_collected = False IdlType.is_garbage_collected = property( lambda self: self.base_type in IdlType.garbage_collected_types) @@ -299,7 +301,6 @@ # [WillBeGarbageCollected] IdlType.will_be_garbage_collected_types = set() -IdlTypeBase.is_will_be_garbage_collected = False IdlType.is_will_be_garbage_collected = property( lambda self: self.base_type in IdlType.will_be_garbage_collected_types) @@ -328,7 +329,6 @@ INCLUDES_FOR_TYPE = { 'object': set(), - 'CompareHow': set(), 'Dictionary': set(['bindings/core/v8/Dictionary.h']), 'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', 'bindings/core/v8/V8EventListenerList.h']), @@ -339,9 +339,9 @@ 'core/dom/ClassCollection.h', 'core/dom/TagCollection.h', 'core/html/HTMLCollection.h', + 'core/html/HTMLDataListOptionsCollection.h', 'core/html/HTMLFormControlsCollection.h', 'core/html/HTMLTableRowsCollection.h']), - 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), 'NodeList': set(['bindings/core/v8/V8NodeList.h', 'core/dom/NameNodeList.h', 'core/dom/NodeList.h', @@ -381,7 +381,7 @@ IdlType.includes_for_type = property(includes_for_type) IdlUnionType.includes_for_type = property( - lambda self: set.union(*[includes_for_type(member_type) + lambda self: set.union(*[member_type.includes_for_type for member_type in self.member_types])) IdlArrayOrSequenceType.includes_for_type = property( lambda self: self.element_type.includes_for_type) @@ -420,11 +420,14 @@ native_array_element_type, interfaces_info)) includes_for_type.add('wtf/Vector.h') + base_idl_type = idl_type.base_type if idl_type.is_string_type: includes_for_type.add('wtf/text/WTFString.h') - if idl_type.name in interfaces_info: - interface_info = interfaces_info[idl_type.name] + if base_idl_type in interfaces_info: + interface_info = interfaces_info[idl_type.base_type] includes_for_type.add(interface_info['include_path']) + if base_idl_type in INCLUDES_FOR_TYPE: + includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type]) return includes_for_type IdlTypeBase.impl_includes_for_type = impl_includes_for_type @@ -448,10 +451,10 @@ 'ByteString': 'toByteString({arguments})', 'ScalarValueString': 'toScalarValueString({arguments})', 'boolean': '{v8_value}->BooleanValue()', - 'float': 'static_cast<float>({v8_value}->NumberValue())', - 'unrestricted float': 'static_cast<float>({v8_value}->NumberValue())', - 'double': 'static_cast<double>({v8_value}->NumberValue())', - 'unrestricted double': 'static_cast<double>({v8_value}->NumberValue())', + 'float': 'toFloat({arguments})', + 'unrestricted float': 'toFloat({arguments})', + 'double': 'toDouble({arguments})', + 'unrestricted double': 'toDouble({arguments})', 'byte': 'toInt8({arguments})', 'octet': 'toUInt8({arguments})', 'short': 'toInt16({arguments})', @@ -461,19 +464,46 @@ 'long long': 'toInt64({arguments})', 'unsigned long long': 'toUInt64({arguments})', # Interface types - 'CompareHow': 'static_cast<Range::CompareHow>({v8_value}->Int32Value())', 'Dictionary': 'Dictionary({v8_value}, {isolate})', 'EventTarget': 'V8DOMWrapper::isDOMWrapper({v8_value}) ? toWrapperTypeInfo(v8::Handle<v8::Object>::Cast({v8_value}))->toEventTarget(v8::Handle<v8::Object>::Cast({v8_value})) : 0', - 'MediaQueryListListener': 'MediaQueryListListener::create(V8ScriptState::current({isolate}), ScriptValue(V8ScriptState::current({isolate}), {v8_value}))', 'NodeFilter': 'toNodeFilter({v8_value}, info.Holder(), V8ScriptState::current({isolate}))', 'Promise': 'V8ScriptPromise::cast(V8ScriptState::current({isolate}), {v8_value})', - 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, {isolate})', + 'SerializedScriptValue': 'SerializedScriptValue::create({v8_value}, 0, 0, exceptionState, {isolate})', 'ScriptValue': 'ScriptValue(V8ScriptState::current({isolate}), {v8_value})', 'Window': 'toDOMWindow({v8_value}, {isolate})', 'XPathNSResolver': 'toXPathNSResolver({v8_value}, {isolate})', } +def v8_conversion_needs_exception_state(idl_type): + return (idl_type.is_numeric_type or + idl_type.is_dictionary or + idl_type.name in ('ByteString', 'ScalarValueString', 'SerializedScriptValue')) + +IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_exception_state) +IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True + + +TRIVIAL_CONVERSIONS = frozenset([ + 'any', + 'boolean', + 'Date', + 'Dictionary', + 'NodeFilter', + 'XPathNSResolver', + 'Promise' +]) + + +def v8_conversion_is_trivial(idl_type): + # The conversion is a simple expression that returns the converted value and + # cannot raise an exception. + return (idl_type.base_type in TRIVIAL_CONVERSIONS or + idl_type.is_wrapper_type) + +IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial) + + def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolate): if idl_type.name == 'void': return '' @@ -490,7 +520,9 @@ if 'EnforceRange' in extended_attributes: arguments = ', '.join([v8_value, 'EnforceRange', 'exceptionState']) - elif idl_type.may_raise_exception_on_conversion: + elif 'Clamp' in extended_attributes: + arguments = ', '.join([v8_value, 'Clamp', 'exceptionState']) + elif idl_type.v8_conversion_needs_exception_state: arguments = ', '.join([v8_value, 'exceptionState']) else: arguments = v8_value @@ -500,12 +532,12 @@ elif idl_type.is_typed_array_element_type: cpp_expression_format = ( '{v8_value}->Is{idl_type}() ? ' - 'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') + 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') elif idl_type.is_dictionary: - cpp_expression_format = 'V8{idl_type}::toNative({isolate}, {v8_value})' + cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exceptionState)' else: cpp_expression_format = ( - 'V8{idl_type}::toNativeWithTypeCheck({isolate}, {v8_value})') + 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_type, v8_value=v8_value, isolate=isolate) @@ -521,12 +553,12 @@ native_array_element_type.name != 'Dictionary'): this_cpp_type = None ref_ptr_type = cpp_ptr_type('RefPtr', 'Member', native_array_element_type.gc_type) - expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}))' + expression_format = '(to{ref_ptr_type}NativeArray<{native_array_element_type}, V8{native_array_element_type}>({v8_value}, {index}, {isolate}, exceptionState))' add_includes_for_type(native_array_element_type) else: ref_ptr_type = None this_cpp_type = native_array_element_type.cpp_type - expression_format = 'toNativeArray<{cpp_type}>({v8_value}, {index}, {isolate})' + expression_format = 'toImplArray<{cpp_type}>({v8_value}, {index}, {isolate}, exceptionState)' expression = expression_format.format(native_array_element_type=native_array_element_type.name, cpp_type=this_cpp_type, index=index, ref_ptr_type=ref_ptr_type, v8_value=v8_value, isolate=isolate) return expression @@ -536,40 +568,60 @@ # FIXME: Support union type. if idl_type.is_union_type: - return '' + return '/* no V8 -> C++ conversion for IDL union type: %s */' % idl_type.name this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, raw_type=True) - idl_type = idl_type.preprocessed_type + + if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener'): + return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name + cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolate) - args = [variable_name, cpp_value] - if idl_type.base_type == 'DOMString': - macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_VOID' - elif idl_type.may_raise_exception_on_conversion: - macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE' - args.append('exceptionState') - else: - macro = 'TONATIVE_DEFAULT' if used_in_private_script else 'TONATIVE_VOID' + if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: + # Types that need error handling and use one of a group of (C++) macros + # to take care of this. - if used_in_private_script: - args.append('false') + args = [variable_name, cpp_value] - # Macros come in several variants, to minimize expensive creation of - # v8::TryCatch. - suffix = '' + if idl_type.v8_conversion_needs_exception_state: + macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else 'TONATIVE_VOID_EXCEPTIONSTATE' + elif return_promise: + macro = 'TOSTRING_VOID_EXCEPTIONSTATE' + else: + macro = 'TOSTRING_DEFAULT' if used_in_private_script else 'TOSTRING_VOID' - if return_promise: - suffix += '_PROMISE' - args.append('info') - if macro == 'TONATIVE_VOID_EXCEPTIONSTATE': - args.append('V8ScriptState::current(%s)' % isolate) + if macro.endswith('_EXCEPTIONSTATE'): + args.append('exceptionState') + if used_in_private_script: + args.append('false') + + suffix = '' + + if return_promise: + suffix += '_PROMISE' + args.append('info') + if macro.endswith('_EXCEPTIONSTATE'): + args.append('V8ScriptState::current(%s)' % isolate) + + if declare_variable: + args.insert(0, this_cpp_type) + else: + suffix += '_INTERNAL' + + return '%s(%s)' % (macro + suffix, ', '.join(args)) + + # Types that don't need error handling, and simply assign a value to the + # local variable. + + if not idl_type.v8_conversion_is_trivial: + raise Exception('unclassified V8 -> C++ conversion for IDL type: %s' % idl_type.name) + + assignment = '%s = %s' % (variable_name, cpp_value) if declare_variable: - args.insert(0, this_cpp_type) - else: - suffix += '_INTERNAL' + return '%s %s' % (this_cpp_type, assignment) + return assignment - return '%s(%s)' % (macro + suffix, ', '.join(args)) IdlTypeBase.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value @@ -582,7 +634,7 @@ if idl_type.is_enum: # Enumerations are internally DOMStrings return IdlType('DOMString') - if (idl_type.name == 'Any' or idl_type.is_callback_function): + if (idl_type.name in ['Any', 'Object'] or idl_type.is_callback_function): return IdlType('ScriptValue') return idl_type @@ -597,7 +649,10 @@ if idl_type.base_type in ['long long', 'unsigned long long']: # long long and unsigned long long are not representable in ECMAScript; # we represent them as doubles. - idl_type = IdlType('double', is_nullable=idl_type.is_nullable) + is_nullable = idl_type.is_nullable + idl_type = IdlType('double') + if is_nullable: + idl_type = IdlNullableType(idl_type) cpp_value = 'static_cast<double>(%s)' % cpp_value # HTML5 says that unsigned reflected attributes should be in the range # [0, 2^31). When a value isn't in this range, a default value (or 0) @@ -734,7 +789,6 @@ IdlUnionType.release = property( lambda self: [member_type.is_interface_type for member_type in self.member_types]) -IdlArrayOrSequenceType.release = False CPP_VALUE_TO_V8_VALUE = { @@ -795,9 +849,14 @@ def cpp_type_has_null_value(idl_type): # - String types (String/AtomicString) represent null as a null string, # i.e. one for which String::isNull() returns true. + # - Enum types, as they are implemented as Strings. # - Wrapper types (raw pointer or RefPtr/PassRefPtr) represent null as # a null pointer. - return idl_type.is_string_type or idl_type.is_wrapper_type + # - Dictionary types represent null as a null pointer. They are garbage + # collected so their type is raw pointer. + # - 'Object' type. We use ScriptValue for object type. + return (idl_type.is_string_type or idl_type.is_wrapper_type or + idl_type.is_enum or idl_type.is_dictionary or idl_type.base_type == 'object') IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value)
diff --git a/bindings/scripts/v8_utilities.py b/bindings/scripts/v8_utilities.py index 4a2b46a..e6ee9c9 100644 --- a/bindings/scripts/v8_utilities.py +++ b/bindings/scripts/v8_utilities.py
@@ -58,9 +58,10 @@ # Extended attribute parsing ################################################################################ -def extended_attribute_value_contains(extended_attribute_value, value): - return (extended_attribute_value and - value in re.split('[|,]', extended_attribute_value)) +def extended_attribute_value_contains(extended_attribute_value, key): + return (extended_attribute_value == key or + (isinstance(extended_attribute_value, list) and + key in extended_attribute_value)) def has_extended_attribute(definition_or_member, extended_attribute_list): @@ -74,13 +75,14 @@ extended_attribute_value_contains(extended_attributes[name], value)) -def sorted_extended_attribute_set(definition_or_member, name): +def extended_attribute_value_as_list(definition_or_member, name): extended_attributes = definition_or_member.extended_attributes if name not in extended_attributes: - return [] - - attribute_values = re.split('[|,]', extended_attributes[name]) - return sorted(attribute_values) + return None + value = extended_attributes[name] + if isinstance(value, list): + return value + return [value] ################################################################################ @@ -222,13 +224,7 @@ extended_attributes = definition_or_member.extended_attributes if 'Conditional' not in extended_attributes: return None - conditional = extended_attributes['Conditional'] - for delimiter in ',|': - if delimiter in conditional: - conditions = conditional.split(delimiter) - operator_separator = ' %s ' % DELIMITER_TO_OPERATOR[delimiter] - return operator_separator.join('ENABLE(%s)' % expression for expression in sorted(conditions)) - return 'ENABLE(%s)' % conditional + return 'ENABLE(%s)' % extended_attributes['Conditional'] # [DeprecateAs] @@ -251,7 +247,7 @@ def exposed(definition_or_member, interface): - exposure_set = sorted_extended_attribute_set(definition_or_member, 'Exposed') + exposure_set = extended_attribute_value_as_list(definition_or_member, 'Exposed') if not exposure_set: return None @@ -273,7 +269,7 @@ def expanded_exposure_set_for_interface(interface): - exposure_set = sorted_extended_attribute_set(interface, 'Exposed') + exposure_set = extended_attribute_value_as_list(interface, 'Exposed') # "Worker" is an aggregation for the different kinds of workers. if 'Worker' in exposure_set:
diff --git a/bindings/tests/idls/SVGTestInterface.idl b/bindings/tests/idls/core/SVGTestInterface.idl similarity index 100% rename from bindings/tests/idls/SVGTestInterface.idl rename to bindings/tests/idls/core/SVGTestInterface.idl
diff --git a/bindings/tests/idls/TestCallbackInterface.idl b/bindings/tests/idls/core/TestCallbackInterface.idl similarity index 100% rename from bindings/tests/idls/TestCallbackInterface.idl rename to bindings/tests/idls/core/TestCallbackInterface.idl
diff --git a/bindings/tests/idls/TestDictionary.idl b/bindings/tests/idls/core/TestDictionary.idl similarity index 84% rename from bindings/tests/idls/TestDictionary.idl rename to bindings/tests/idls/core/TestDictionary.idl index a05f0b8..7bd1ac0 100644 --- a/bindings/tests/idls/TestDictionary.idl +++ b/bindings/tests/idls/core/TestDictionary.idl
@@ -1,6 +1,9 @@ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + +enum TestEnum { "foo", "bar", "baz" }; + [ GarbageCollected, ] dictionary TestDictionary { @@ -17,4 +20,8 @@ TestInterfaceWillBeGarbageCollected? testInterfaceWillBeGarbageCollectedOrNullMember; DOMString[] stringArrayMember; sequence<DOMString> stringSequenceMember; + TestEnum enumMember = "foo"; + Element? elementOrNullMember; + object objectMember; + object? objectOrNullMember; };
diff --git a/bindings/tests/idls/TestException.idl b/bindings/tests/idls/core/TestException.idl similarity index 100% rename from bindings/tests/idls/TestException.idl rename to bindings/tests/idls/core/TestException.idl
diff --git a/bindings/tests/idls/TestImplements.idl b/bindings/tests/idls/core/TestImplements.idl similarity index 100% rename from bindings/tests/idls/TestImplements.idl rename to bindings/tests/idls/core/TestImplements.idl
diff --git a/bindings/tests/idls/TestImplements2.idl b/bindings/tests/idls/core/TestImplements2.idl similarity index 100% rename from bindings/tests/idls/TestImplements2.idl rename to bindings/tests/idls/core/TestImplements2.idl
diff --git a/bindings/tests/idls/TestImplements3.idl b/bindings/tests/idls/core/TestImplements3.idl similarity index 100% rename from bindings/tests/idls/TestImplements3.idl rename to bindings/tests/idls/core/TestImplements3.idl
diff --git a/bindings/tests/idls/TestInterface.idl b/bindings/tests/idls/core/TestInterface.idl similarity index 95% rename from bindings/tests/idls/TestInterface.idl rename to bindings/tests/idls/core/TestInterface.idl index 7dfed9a..135c6f8 100644 --- a/bindings/tests/idls/TestInterface.idl +++ b/bindings/tests/idls/core/TestInterface.idl
@@ -34,12 +34,13 @@ [ ActiveDOMObject, Conditional=CONDITION, - Custom=LegacyCallAsFunction|ToV8, + Custom=(LegacyCallAsFunction,ToV8), DoNotCheckConstants, ImplementedAs=TestInterfaceImplementation, + Iterable, RuntimeEnabled=FeatureName, SetWrapperReferenceTo(TestInterface referencedName), - TypeChecking=Interface|Unrestricted, + TypeChecking=(Interface,Unrestricted), Exposed=(Worker,Window), ] interface TestInterface : TestInterfaceEmpty { // members needed to test [ImplementedAs], as this affect attribute @@ -87,6 +88,9 @@ [Exposed=Window] attribute long windowExposedAttribute; [Exposed=(Window,ServiceWorker)] void windowAndServiceWorkerExposedMethod(); + + void voidMethodPartailOverload(); + static void voidMethodPartailOverload(); }; TestInterface implements TestImplements;
diff --git a/bindings/tests/idls/TestInterface2.idl b/bindings/tests/idls/core/TestInterface2.idl similarity index 92% rename from bindings/tests/idls/TestInterface2.idl rename to bindings/tests/idls/core/TestInterface2.idl index 8027826..8bb30a6 100644 --- a/bindings/tests/idls/TestInterface2.idl +++ b/bindings/tests/idls/core/TestInterface2.idl
@@ -38,8 +38,11 @@ Custom=Wrap, // Conflicts with and [Custom=ToV8], respectively DependentLifetime, // Covered by [ActiveDOMObject] SetWrapperReferenceFrom=ownerNode, // Conflicts with [SetWrapperReferenceTo] - SpecialWrapFor=TestInterface|TestInterfaceEmpty, // Conflicts with [Custom=ToV8] + SpecialWrapFor=(TestInterface,TestInterfaceEmpty), // Conflicts with [Custom=ToV8] ] interface TestInterface2 { + // This interface has only runtime enabled constants. + [RuntimeEnabled=FeatureName] const unsigned short CONST_VALUE_1 = 1; + // Indexed property operations with an identifier [RaisesException] getter TestInterfaceEmpty item(unsigned long index); [RaisesException] setter DOMString setItem(unsigned long index, DOMString value);
diff --git a/bindings/tests/idls/TestInterface3.idl b/bindings/tests/idls/core/TestInterface3.idl similarity index 95% rename from bindings/tests/idls/TestInterface3.idl rename to bindings/tests/idls/core/TestInterface3.idl index 6b90bda..2e20986 100644 --- a/bindings/tests/idls/TestInterface3.idl +++ b/bindings/tests/idls/core/TestInterface3.idl
@@ -40,7 +40,7 @@ [Custom] setter boolean (unsigned long index, Node value); [Custom] deleter boolean (unsigned long index); - [Custom=PropertyGetter|PropertyEnumerator|PropertyQuery] getter Node (DOMString name); + [Custom=(PropertyGetter,PropertyEnumerator,PropertyQuery)] getter Node (DOMString name); [Custom] setter Node (DOMString name, Node value); [Custom] deleter boolean (DOMString name); };
diff --git a/bindings/tests/idls/TestInterfaceCheckSecurity.idl b/bindings/tests/idls/core/TestInterfaceCheckSecurity.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceCheckSecurity.idl rename to bindings/tests/idls/core/TestInterfaceCheckSecurity.idl
diff --git a/bindings/tests/idls/TestInterfaceConstructor.idl b/bindings/tests/idls/core/TestInterfaceConstructor.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceConstructor.idl rename to bindings/tests/idls/core/TestInterfaceConstructor.idl
diff --git a/bindings/tests/idls/TestInterfaceConstructor2.idl b/bindings/tests/idls/core/TestInterfaceConstructor2.idl similarity index 96% rename from bindings/tests/idls/TestInterfaceConstructor2.idl rename to bindings/tests/idls/core/TestInterfaceConstructor2.idl index 10057de..209a000 100644 --- a/bindings/tests/idls/TestInterfaceConstructor2.idl +++ b/bindings/tests/idls/core/TestInterfaceConstructor2.idl
@@ -40,6 +40,7 @@ // 2 constructors with same type length, to test overload resolution Constructor(DOMString stringArg), Constructor(Dictionary dictionaryArg), + Constructor(sequence<sequence<DOMString>> stringSequenceSequenceArg), Constructor( TestInterfaceEmpty testInterfaceEmptyArg, long longArg,
diff --git a/bindings/tests/idls/TestInterfaceConstructor3.idl b/bindings/tests/idls/core/TestInterfaceConstructor3.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceConstructor3.idl rename to bindings/tests/idls/core/TestInterfaceConstructor3.idl
diff --git a/bindings/tests/idls/TestInterfaceConstructor4.idl b/bindings/tests/idls/core/TestInterfaceConstructor4.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceConstructor4.idl rename to bindings/tests/idls/core/TestInterfaceConstructor4.idl
diff --git a/bindings/tests/idls/TestInterfaceCustomConstructor.idl b/bindings/tests/idls/core/TestInterfaceCustomConstructor.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceCustomConstructor.idl rename to bindings/tests/idls/core/TestInterfaceCustomConstructor.idl
diff --git a/bindings/tests/idls/TestInterfaceDocument.idl b/bindings/tests/idls/core/TestInterfaceDocument.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceDocument.idl rename to bindings/tests/idls/core/TestInterfaceDocument.idl
diff --git a/bindings/tests/idls/TestInterfaceEmpty.idl b/bindings/tests/idls/core/TestInterfaceEmpty.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceEmpty.idl rename to bindings/tests/idls/core/TestInterfaceEmpty.idl
diff --git a/bindings/tests/idls/TestInterfaceEventConstructor.idl b/bindings/tests/idls/core/TestInterfaceEventConstructor.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceEventConstructor.idl rename to bindings/tests/idls/core/TestInterfaceEventConstructor.idl
diff --git a/bindings/tests/idls/TestInterfaceEventTarget.idl b/bindings/tests/idls/core/TestInterfaceEventTarget.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceEventTarget.idl rename to bindings/tests/idls/core/TestInterfaceEventTarget.idl
diff --git a/bindings/tests/idls/TestInterfaceGarbageCollected.idl b/bindings/tests/idls/core/TestInterfaceGarbageCollected.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceGarbageCollected.idl rename to bindings/tests/idls/core/TestInterfaceGarbageCollected.idl
diff --git a/bindings/tests/idls/TestInterfaceNamedConstructor.idl b/bindings/tests/idls/core/TestInterfaceNamedConstructor.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceNamedConstructor.idl rename to bindings/tests/idls/core/TestInterfaceNamedConstructor.idl
diff --git a/bindings/tests/idls/TestInterfaceNamedConstructor2.idl b/bindings/tests/idls/core/TestInterfaceNamedConstructor2.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceNamedConstructor2.idl rename to bindings/tests/idls/core/TestInterfaceNamedConstructor2.idl
diff --git a/bindings/tests/idls/TestInterfaceNode.idl b/bindings/tests/idls/core/TestInterfaceNode.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceNode.idl rename to bindings/tests/idls/core/TestInterfaceNode.idl
diff --git a/bindings/tests/idls/core/TestInterfaceNotScriptWrappable.idl b/bindings/tests/idls/core/TestInterfaceNotScriptWrappable.idl new file mode 100644 index 0000000..aa8192d --- /dev/null +++ b/bindings/tests/idls/core/TestInterfaceNotScriptWrappable.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NotScriptWrappable, +] interface TestInterfaceNotScriptWrappable { + attribute TestInterfaceNotScriptWrappable attr1; + void func(TestInterfaceNotScriptWrappable arg); +};
diff --git a/bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl b/bindings/tests/idls/core/TestInterfaceWillBeGarbageCollected.idl similarity index 100% rename from bindings/tests/idls/TestInterfaceWillBeGarbageCollected.idl rename to bindings/tests/idls/core/TestInterfaceWillBeGarbageCollected.idl
diff --git a/bindings/tests/idls/TestNode.idl b/bindings/tests/idls/core/TestNode.idl similarity index 100% rename from bindings/tests/idls/TestNode.idl rename to bindings/tests/idls/core/TestNode.idl
diff --git a/bindings/tests/idls/TestObject.idl b/bindings/tests/idls/core/TestObject.idl similarity index 94% rename from bindings/tests/idls/TestObject.idl rename to bindings/tests/idls/core/TestObject.idl index e76b5b9..44d9cae 100644 --- a/bindings/tests/idls/TestObject.idl +++ b/bindings/tests/idls/core/TestObject.idl
@@ -62,6 +62,7 @@ // Extended attributes [DeprecateAs=Constant] const short DEPRECATED_CONSTANT = 1; + [MeasureAs=Constant] const short MEASURED_CONSTANT = 1; [RuntimeEnabled=FeatureName] const short FEATURE_ENABLED_CONST = 1; [Reflect=CONST_IMPL] const short CONST_JAVASCRIPT = 1; @@ -164,11 +165,9 @@ [CachedAttribute=isStringDirty] attribute DOMString? cachedStringOrNoneAttribute; [CallWith=ExecutionContext] attribute any callWithExecutionContextAnyAttribute; [CallWith=ScriptState] attribute any callWithScriptStateAnyAttribute; - [CallWith=ExecutionContext|ScriptState] attribute any callWithExecutionContextAndScriptStateAnyAttribute; + [CallWith=(ExecutionContext,ScriptState)] attribute any callWithExecutionContextAndScriptStateAnyAttribute; [CheckSecurity=Node] readonly attribute Document checkSecurityForNodeReadonlyDocumentAttribute; // All uses are read only [Conditional=CONDITION] attribute long conditionalLongAttribute; - [Conditional=(CONDITION_1,CONDITION_2)] attribute long conditionalAndLongAttribute; - [Conditional=CONDITION_1|CONDITION_2] attribute long conditionalOrLongAttribute; // Constructors: FIXME: replace suffix with [ConstructorAttribute] attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute; [DeprecateAs=deprecatedTestInterfaceEmptyConstructorAttribute] attribute TestInterfaceEmptyConstructor testInterfaceEmptyConstructorAttribute; @@ -224,12 +223,12 @@ [Reflect=class] attribute DOMString reflectedClass; // Limited value attributes and enumerated attributes [Reflect, ReflectOnly="unique"] attribute DOMString limitedToOnlyOneAttribute; - [Reflect, ReflectOnly="Per"|"Paal"|"Espen"] attribute DOMString limitedToOnlyAttribute; - [Reflect=other, ReflectOnly="Value1"|"Value2" ] attribute DOMString limitedToOnlyOtherAttribute; - [Reflect, ReflectOnly="rsa"|"dsa", ReflectMissing="rsa"] attribute DOMString limitedWithMissingDefaultAttribute; - [Reflect, ReflectOnly="ltr"|"rtl"|"auto", ReflectMissing="auto", ReflectInvalid="ltr"] attribute DOMString limitedWithInvalidMissingDefaultAttribute; - [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] readonly attribute DOMString corsSettingAttribute; - [Reflect, ReflectOnly="empty"|"missing"|"invalid"|"a-normal", ReflectEmpty="empty", ReflectMissing="missing", ReflectInvalid="invalid"] readonly attribute DOMString limitedWithEmptyMissingInvalidAttribute; + [Reflect, ReflectOnly=("Per","Paal","Espen")] attribute DOMString limitedToOnlyAttribute; + [Reflect=other, ReflectOnly=("Value1","Value2")] attribute DOMString limitedToOnlyOtherAttribute; + [Reflect, ReflectOnly=("rsa","dsa"), ReflectMissing="rsa"] attribute DOMString limitedWithMissingDefaultAttribute; + [Reflect, ReflectOnly=("ltr","rtl","auto"), ReflectMissing="auto", ReflectInvalid="ltr"] attribute DOMString limitedWithInvalidMissingDefaultAttribute; + [Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] readonly attribute DOMString corsSettingAttribute; + [Reflect, ReflectOnly=("empty","missing","invalid","a-normal"), ReflectEmpty="empty", ReflectMissing="missing", ReflectInvalid="invalid"] readonly attribute DOMString limitedWithEmptyMissingInvalidAttribute; [Replaceable] readonly attribute long replaceableReadonlyLongAttribute; [Replaceable, PutForwards=href] readonly attribute TestNode locationReplaceable; @@ -253,8 +252,6 @@ [Reflect, URL] attribute DOMString urlStringAttribute; [Reflect=reflectUrlAttribute, URL] attribute DOMString urlStringAttribute; [Unforgeable] attribute long unforgeableLongAttribute; - [LogActivity=SetterOnly, LogPreviousValue] attribute DOMString? activityLoggingSetterOnlyLogPreviousValueAttribute; - [LogActivity, LogPreviousValue] attribute TestInterfaceEmpty activityLoggingLogPreviousValueInterfaceAttribute; // Methods @@ -311,11 +308,8 @@ void voidMethodVoidCallbackFunctionArg(VoidCallbackFunction voidCallbackFunctionArg); void voidMethodAnyCallbackFunctionOptionalAnyArg(AnyCallbackFunctionOptionalAnyArg anyCallbackFunctionOptionalAnyArgArg); // Custom type conversions - CompareHow compareHowMethod(); any anyMethod(); - void voidMethodCompareHowArg(CompareHow compareHowArg); void voidMethodEventTargetArg(EventTarget eventTargetArg); - void voidMethodMediaQueryListListenerArg(MediaQueryListListener mediaQueryListListenerArg); void voidMethodAnyArg(any anyArg); // DOM node types void voidMethodAttrArg(Attr attrArg); @@ -349,11 +343,16 @@ void voidMethodSequenceLongArg(sequence<long> longSequenceArg); void voidMethodSequenceStringArg(sequence<DOMString> stringSequenceArg); void voidMethodSequenceTestInterfaceEmptyArg(sequence<TestInterfaceEmpty> testInterfaceEmptySequenceArg); + void voidMethodSequenceSequenceDOMStringArg(sequence<sequence<DOMString>> stringSequenceSequenceArg); // Nullable types long? nullableLongMethod(); DOMString? nullableStringMethod(); TestInterface? nullableTestInterfaceMethod(); sequence<long>? nullableLongSequenceMethod(); + // Union types + (TestInterfaceGarbageCollected or DOMString) testInterfaceGarbageCollectedOrDOMStringMethod(); + (TestInterfaceWillBeGarbageCollected or TestDictionary) testInterfaceWillBeGarbageCollectedOrTestDictionaryMethod(); + (sequence<long> or DOMString[] or unrestricted double) longSequenceOrDOMStringArrayOrUnrestrictedDoubleMethod(); // Currently only used on interface type arguments void voidMethodTestInterfaceEmptyOrNullArg(TestInterfaceEmpty? nullableTestInterfaceEmptyArg); // Callback interface types @@ -376,6 +375,8 @@ void voidMethodSerializedScriptValueArg(SerializedScriptValue serializedScriptValueArg); void voidMethodXPathNSResolverArg(XPathNSResolver xPathNSResolverArg); void voidMethodDictionarySequenceArg(sequence<Dictionary> dictionarySequenceArg); + Promise overloadedPromiseMethod(long arg); + Promise overloadedPromiseMethod(DOMString arg); // Arguments void voidMethodStringArgLongArg(DOMString stringArg, long longArg); @@ -433,6 +434,8 @@ void overloadedMethodH(TestInterfaceEmpty testInterfaceEmptyArg); void overloadedMethodI(DOMString stringArg); void overloadedMethodI(double doubleArg); + void overloadedMethodJ(DOMString stringArg); + void overloadedMethodJ(TestDictionary testDictionaryArg); [PerWorldBindings] void overloadedPerWorldBindingsMethod(); @@ -468,7 +471,6 @@ [CallWith=(ActiveWindow,FirstWindow)] void callWithActiveWindowScriptWindow(); [CheckSecurity=Node] void checkSecurityForNodeVoidMethod(); [Conditional=CONDITION] void conditionalConditionVoidMethod(); - [Conditional=(CONDITION_1,CONDITION_2)] void conditionalCondition1AndCondition2VoidMethod(); [Conditional=CONDITION] static void conditionalConditionStaticVoidMethod(); [Custom] void customVoidMethod(); [Conditional=CONDITION, Custom] void conditionalConditionCustomVoidMethod(); @@ -549,4 +551,5 @@ [OnlyExposedToPrivateScript] attribute DOMString attributeImplementedInCPPForPrivateScriptOnly; [ImplementedInPrivateScript, OnlyExposedToPrivateScript] short methodForPrivateScriptOnly(short value1, short value2); [ImplementedInPrivateScript, OnlyExposedToPrivateScript] attribute DOMString attributeForPrivateScriptOnly; + [ImplementedInPrivateScript] attribute TestEnum enumForPrivateScript; };
diff --git a/bindings/tests/idls/TestPartialInterface.idl b/bindings/tests/idls/core/TestPartialInterface.idl similarity index 100% rename from bindings/tests/idls/TestPartialInterface.idl rename to bindings/tests/idls/core/TestPartialInterface.idl
diff --git a/bindings/tests/idls/TestPartialInterface2.idl b/bindings/tests/idls/core/TestPartialInterface2.idl similarity index 100% rename from bindings/tests/idls/TestPartialInterface2.idl rename to bindings/tests/idls/core/TestPartialInterface2.idl
diff --git a/bindings/tests/idls/TestSpecialOperations.idl b/bindings/tests/idls/core/TestSpecialOperations.idl similarity index 100% rename from bindings/tests/idls/TestSpecialOperations.idl rename to bindings/tests/idls/core/TestSpecialOperations.idl
diff --git a/bindings/tests/idls/TestSpecialOperationsNotEnumerable.idl b/bindings/tests/idls/core/TestSpecialOperationsNotEnumerable.idl similarity index 100% rename from bindings/tests/idls/TestSpecialOperationsNotEnumerable.idl rename to bindings/tests/idls/core/TestSpecialOperationsNotEnumerable.idl
diff --git a/bindings/tests/idls/TestTypedefs.idl b/bindings/tests/idls/core/TestTypedefs.idl similarity index 100% rename from bindings/tests/idls/TestTypedefs.idl rename to bindings/tests/idls/core/TestTypedefs.idl
diff --git a/bindings/tests/idls/TestInterface.idl b/bindings/tests/idls/modules/TestInterface5.idl similarity index 86% copy from bindings/tests/idls/TestInterface.idl copy to bindings/tests/idls/modules/TestInterface5.idl index 7dfed9a..72e8535 100644 --- a/bindings/tests/idls/TestInterface.idl +++ b/bindings/tests/idls/modules/TestInterface5.idl
@@ -34,22 +34,23 @@ [ ActiveDOMObject, Conditional=CONDITION, - Custom=LegacyCallAsFunction|ToV8, + Custom=(LegacyCallAsFunction,ToV8), DoNotCheckConstants, - ImplementedAs=TestInterfaceImplementation, + ImplementedAs=TestInterface5Implementation, + Iterable, RuntimeEnabled=FeatureName, - SetWrapperReferenceTo(TestInterface referencedName), - TypeChecking=Interface|Unrestricted, + SetWrapperReferenceTo(TestInterface5 referencedName), + TypeChecking=(Interface,Unrestricted), Exposed=(Worker,Window), -] interface TestInterface : TestInterfaceEmpty { +] interface TestInterface5 : TestInterfaceEmpty { // members needed to test [ImplementedAs], as this affect attribute // configuration and method configuration, and [TypeChecking] // constants also needed for [DoNotCheckConstants] const unsigned long UNSIGNED_LONG = 0; [Reflect=CONST_CPP] const short CONST_JAVASCRIPT = 1; - attribute TestInterface testInterfaceAttribute; // Self-referential interface type with [ImplementedAs] - attribute TestInterfaceConstructor testInterfaceConstructorAttribute; + attribute TestInterface5 testInterfaceAttribute; // Self-referential interface type with [ImplementedAs] + attribute TestInterface5Constructor testInterfaceConstructorAttribute; attribute double doubleAttribute; attribute float floatAttribute; attribute unrestricted double unrestrictedDoubleAttribute; @@ -89,6 +90,3 @@ [Exposed=(Window,ServiceWorker)] void windowAndServiceWorkerExposedMethod(); }; -TestInterface implements TestImplements; -// TestInterface implements TestImplements2; // at implement*ed* interface -TestInterface implements TestImplements3;
diff --git a/modules/serviceworkers/InstallPhaseEvent.idl b/bindings/tests/idls/modules/TestPartialInterface3.idl similarity index 74% copy from modules/serviceworkers/InstallPhaseEvent.idl copy to bindings/tests/idls/modules/TestPartialInterface3.idl index 9f2637f..d09f7bd 100644 --- a/modules/serviceworkers/InstallPhaseEvent.idl +++ b/bindings/tests/idls/modules/TestPartialInterface3.idl
@@ -28,10 +28,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-phase-event-interface [ - RuntimeEnabled=ServiceWorker, - Exposed=ServiceWorker, -] interface InstallPhaseEvent : Event { - [CallWith=ScriptState] void waitUntil(any value); + ImplementedAs=TestPartialInterfaceImplementation3, + PerContextEnabled=PartialContextName3, +] partial interface TestInterface { + const unsigned short PARTIAL3_UNSIGNED_SHORT = 0; + + attribute long partial3LongAttribute; + static attribute long partial3StaticLongAttribute; + + void voidMethodPartialOverload(DOMString value); + static void voidMethodPartialOverload(DOMString value); + + void partial2VoidMethod(DOMString value); + static void partial2StaticVoidMethod(DOMString value); };
diff --git a/core/README b/core/README index 1a601a7..418d1e5 100644 --- a/core/README +++ b/core/README
@@ -6,4 +6,4 @@ The current version corresponds to: URL: http://src.chromium.org/blink/branches/dart/dartium -Current revision: 182210 +Current revision: 190578
diff --git a/core/animation/AnimationPlayer.idl b/core/animation/AnimationPlayer.idl index bc38234..45720a4 100644 --- a/core/animation/AnimationPlayer.idl +++ b/core/animation/AnimationPlayer.idl
@@ -28,22 +28,22 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" }; + [ - RuntimeEnabled=WebAnimationsElementAnimate, NoInterfaceObject, WillBeGarbageCollected, ActiveDOMObject, ] interface AnimationPlayer : EventTarget { - [RuntimeEnabled=WebAnimationsAPI] attribute AnimationNode? source; - [RuntimeEnabled=WebAnimationsAPI] attribute double startTime; - [RuntimeEnabled=WebAnimationsAPI] attribute double currentTime; - [RuntimeEnabled=WebAnimationsAPI] attribute double playbackRate; - [RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean paused; - [RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean finished; - [RuntimeEnabled=WebAnimationsAPI, RaisesException] void finish(); - [RuntimeEnabled=WebAnimationsAPI] void play(); - [RuntimeEnabled=WebAnimationsAPI] void pause(); - [RuntimeEnabled=WebAnimationsAPI] void reverse(); + [RuntimeEnabled=WebAnimationsAPI] attribute AnimationNode? source; + [RuntimeEnabled=WebAnimationsPlaybackControl] attribute double? startTime; + [RuntimeEnabled=WebAnimationsPlaybackControl] attribute double? currentTime; + [RuntimeEnabled=WebAnimationsPlaybackControl] attribute double playbackRate; + [RuntimeEnabled=WebAnimationsPlaybackControl, MeasureAs=AnimationPlayerGetPlayState] readonly attribute AnimationPlayState playState; + [RuntimeEnabled=WebAnimationsPlaybackControl, MeasureAs=AnimationPlayerFinish, RaisesException] void finish(); + [RuntimeEnabled=WebAnimationsPlaybackControl, MeasureAs=AnimationPlayerPlay] void play(); + [RuntimeEnabled=WebAnimationsPlaybackControl, MeasureAs=AnimationPlayerPause] void pause(); + [RuntimeEnabled=WebAnimationsPlaybackControl, MeasureAs=AnimationPlayerReverse] void reverse(); void cancel(); [MeasureAs=AnimationPlayerFinishEvent] attribute EventHandler onfinish;
diff --git a/core/css/CSSRule.idl b/core/css/CSSRule.idl index a70bd3e..a708af4 100644 --- a/core/css/CSSRule.idl +++ b/core/css/CSSRule.idl
@@ -22,6 +22,7 @@ [ Custom=Wrap, DependentLifetime, + NotScriptWrappable, WillBeGarbageCollected, ] interface CSSRule {
diff --git a/core/css/CSSStyleDeclaration.idl b/core/css/CSSStyleDeclaration.idl index 45127b6..1e7803a 100644 --- a/core/css/CSSStyleDeclaration.idl +++ b/core/css/CSSStyleDeclaration.idl
@@ -34,7 +34,7 @@ readonly attribute unsigned long length; getter DOMString item([Default=Undefined] optional unsigned long index); - [Custom=PropertyGetter|PropertyEnumerator|PropertyQuery] getter (DOMString or float) (DOMString name); + [Custom=(PropertyGetter,PropertyEnumerator,PropertyQuery)] getter (DOMString or float) (DOMString name); [Custom] setter void (DOMString propertyName, DOMString? propertyValue); readonly attribute CSSRule parentRule;
diff --git a/core/css/CSSValue.idl b/core/css/CSSValue.idl index 7218639..3f33813 100644 --- a/core/css/CSSValue.idl +++ b/core/css/CSSValue.idl
@@ -21,6 +21,7 @@ [ Custom=Wrap, DependentLifetime, + NotScriptWrappable, WillBeGarbageCollected, ] interface CSSValue {
diff --git a/core/css/CSSValueList.idl b/core/css/CSSValueList.idl index 04ad96f..4d808f9 100644 --- a/core/css/CSSValueList.idl +++ b/core/css/CSSValueList.idl
@@ -24,8 +24,7 @@ */ // Introduced in DOM Level 2: -[ -] interface CSSValueList : CSSValue { +interface CSSValueList : CSSValue { readonly attribute unsigned long length; [ImplementedAs=itemWithBoundsCheck] getter CSSValue item(unsigned long index); };
diff --git a/core/css/DocumentFontFaceSet.idl b/core/css/DocumentFontFaceSet.idl index 6ed56ab..04de8b7 100644 --- a/core/css/DocumentFontFaceSet.idl +++ b/core/css/DocumentFontFaceSet.idl
@@ -28,8 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=FontLoadEvents, -] partial interface Document { +partial interface Document { [MeasureAs=DocumentFonts] readonly attribute FontFaceSet fonts; };
diff --git a/core/css/FontFace.idl b/core/css/FontFace.idl index ef915f0..d83c666 100644 --- a/core/css/FontFace.idl +++ b/core/css/FontFace.idl
@@ -38,12 +38,12 @@ }; [ + ActiveDOMObject, // FIXME: should be union type http://crbug.com/240176 - Constructor(DOMString family, DOMString source, optional Dictionary descriptors), - Constructor(DOMString family, ArrayBuffer source, optional Dictionary descriptors), - Constructor(DOMString family, ArrayBufferView source, optional Dictionary descriptors), + Constructor(DOMString family, DOMString source, optional FontFaceDescriptors descriptors), + Constructor(DOMString family, ArrayBuffer source, optional FontFaceDescriptors descriptors), + Constructor(DOMString family, ArrayBufferView source, optional FontFaceDescriptors descriptors), ConstructorCallWith=ExecutionContext, - RuntimeEnabled=FontLoadEvents, WillBeGarbageCollected, ] interface FontFace {
diff --git a/core/css/FontFaceDescriptors.idl b/core/css/FontFaceDescriptors.idl new file mode 100644 index 0000000..1ba9ef1 --- /dev/null +++ b/core/css/FontFaceDescriptors.idl
@@ -0,0 +1,14 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + GarbageCollected +] dictionary FontFaceDescriptors { + DOMString style = "normal"; + DOMString weight = "normal"; + DOMString stretch = "normal"; + DOMString unicodeRange = "U+0-10FFFF"; + DOMString variant = "normal"; + DOMString featureSettings = "normal"; +};
diff --git a/core/css/FontFaceSet.idl b/core/css/FontFaceSet.idl index 10bc2f7..31ae4fc 100644 --- a/core/css/FontFaceSet.idl +++ b/core/css/FontFaceSet.idl
@@ -34,15 +34,14 @@ ActiveDOMObject, SetWrapperReferenceFrom=document, NoInterfaceObject, - RuntimeEnabled=FontLoadEvents, ] interface FontFaceSet : EventTarget { attribute EventHandler onloading; attribute EventHandler onloadingdone; attribute EventHandler onloadingerror; - [RaisesException] boolean check(DOMString font, optional DOMString text = null); - [CallWith=ScriptState] Promise load(DOMString font, optional DOMString text = null); + [RaisesException] boolean check(DOMString font, optional DOMString text = " "); + [CallWith=ScriptState] Promise load(DOMString font, optional DOMString text = " "); [MeasureAs=FontFaceSetReady, CallWith=ScriptState] Promise ready(); [RaisesException] void add(FontFace fontFace);
diff --git a/core/css/FontFaceSetLoadEvent.idl b/core/css/FontFaceSetLoadEvent.idl index 455ad6b..10530b4 100644 --- a/core/css/FontFaceSetLoadEvent.idl +++ b/core/css/FontFaceSetLoadEvent.idl
@@ -31,7 +31,6 @@ // FIXME: Make this constructable from Javascript [ NoInterfaceObject, - RuntimeEnabled=FontLoadEvents, ] interface FontFaceSetLoadEvent : Event { readonly attribute FontFace[] fontfaces; };
diff --git a/core/css/MediaQueryList.idl b/core/css/MediaQueryList.idl index 7b8b77b..cb93f6f 100644 --- a/core/css/MediaQueryList.idl +++ b/core/css/MediaQueryList.idl
@@ -16,13 +16,22 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + +// http://dev.w3.org/csswg/cssom-view/#mediaquerylist [ ActiveDOMObject, NoInterfaceObject, WillBeGarbageCollected -] interface MediaQueryList { +] interface MediaQueryList : EventTarget { readonly attribute DOMString media; readonly attribute boolean matches; - void addListener([Default=Undefined] optional MediaQueryListListener listener); - void removeListener([Default=Undefined] optional MediaQueryListListener listener); + + // Even though this interface is now an event target, these functions + // exist as aliases for addEventListener for backwards compatibility + // with older versions of this interface. See the note at + // http://dev.w3.org/csswg/cssom-view/#dom-mediaquerylist-removelistener + [ImplementedAs=addDeprecatedListener] void addListener([Default=Undefined] optional EventListener listener); + [ImplementedAs=removeDeprecatedListener]void removeListener([Default=Undefined] optional EventListener listener); + + attribute EventHandler onchange; };
diff --git a/core/css/MediaQueryListEvent.idl b/core/css/MediaQueryListEvent.idl new file mode 100644 index 0000000..2376a4f --- /dev/null +++ b/core/css/MediaQueryListEvent.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +// http://dev.w3.org/csswg/cssom-view/#mediaquerylistevent +[ + EventConstructor, +] interface MediaQueryListEvent : Event { + [InitializedByEventConstructor] readonly attribute DOMString media; + [InitializedByEventConstructor] readonly attribute boolean matches; +};
diff --git a/core/css/RGBColor.idl b/core/css/RGBColor.idl index 398fe1b..81ae393 100644 --- a/core/css/RGBColor.idl +++ b/core/css/RGBColor.idl
@@ -19,6 +19,7 @@ */ [ + NotScriptWrappable, WillBeGarbageCollected ] interface RGBColor { readonly attribute CSSPrimitiveValue red;
diff --git a/core/css/Rect.idl b/core/css/Rect.idl index 87336d5..dbf1b36 100644 --- a/core/css/Rect.idl +++ b/core/css/Rect.idl
@@ -18,6 +18,7 @@ */ [ + NotScriptWrappable, WillBeGarbageCollected ] interface Rect { readonly attribute CSSPrimitiveValue top;
diff --git a/core/css/WebKitCSSTransformValue.idl b/core/css/WebKitCSSTransformValue.idl index a17e482..05258f9 100644 --- a/core/css/WebKitCSSTransformValue.idl +++ b/core/css/WebKitCSSTransformValue.idl
@@ -30,9 +30,7 @@ DoNotCheckConstants, ImplementedAs=CSSTransformValue, ] interface WebKitCSSTransformValue : CSSValueList { - // OperationTypes - const unsigned short CSS_TRANSLATE = 1; const unsigned short CSS_TRANSLATEX = 2; const unsigned short CSS_TRANSLATEY = 3;
diff --git a/core/dom/DOMMatrix.idl b/core/dom/DOMMatrix.idl index c6497e5..33d40dd 100644 --- a/core/dom/DOMMatrix.idl +++ b/core/dom/DOMMatrix.idl
@@ -34,4 +34,23 @@ attribute unrestricted double m44; // FIXME: Should implement some methods (See: crbug.com/388780) + // Mutable transform methods + DOMMatrix multiplySelf(DOMMatrix other); + DOMMatrix preMultiplySelf(DOMMatrix other); + DOMMatrix translateSelf(unrestricted double tx, + unrestricted double ty, + optional unrestricted double tz = 0); + DOMMatrix scaleSelf(unrestricted double scale, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0); + DOMMatrix scale3dSelf(unrestricted double scale, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0, + optional unrestricted double oz = 0); + DOMMatrix scaleNonUniformSelf(unrestricted double sx, + optional unrestricted double sy = 1, + optional unrestricted double sz = 1, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0, + optional unrestricted double oz = 0); };
diff --git a/core/dom/DOMMatrixReadOnly.idl b/core/dom/DOMMatrixReadOnly.idl index 53cec15..f049f7b 100644 --- a/core/dom/DOMMatrixReadOnly.idl +++ b/core/dom/DOMMatrixReadOnly.idl
@@ -4,6 +4,7 @@ [ GarbageCollected, + NotScriptWrappable, RuntimeEnabled=GeometryInterfaces, ] interface DOMMatrixReadOnly { // These attributes are simple aliases for certain elements of the 4x4 matrix @@ -35,4 +36,24 @@ readonly attribute boolean isIdentity; // FIXME: Should implement some methods (See: crbug.com/388780) + // Immutable transform methods + DOMMatrix multiply(DOMMatrix other); + DOMMatrix translate(unrestricted double tx, + unrestricted double ty, + optional unrestricted double tz = 0); + DOMMatrix scale(unrestricted double scale, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0); + DOMMatrix scale3d(unrestricted double scale, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0, + optional unrestricted double oz = 0); + DOMMatrix scaleNonUniform(unrestricted double sx, + optional unrestricted double sy = 1, + optional unrestricted double sz = 1, + optional unrestricted double ox = 0, + optional unrestricted double oy = 0, + optional unrestricted double oz = 0); + Float32Array toFloat32Array(); + Float64Array toFloat64Array(); };
diff --git a/core/dom/DOMPoint.idl b/core/dom/DOMPoint.idl index d75c518..e202163 100644 --- a/core/dom/DOMPoint.idl +++ b/core/dom/DOMPoint.idl
@@ -2,17 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// FIXME: Blink doesn't currently support dictionary definitions. -// For now, we can use Dictionary interface. See http://crbug.com/321462. -// dictionary DOMPointInit { -// unrestricted double x = 0; -// unrestricted double y = 0; -// unrestricted double z = 0; -// unrestricted double w = 1; -// }; - [ - Constructor(optional Dictionary point), + Constructor(optional DOMPointInit point), Constructor(unrestricted double x, unrestricted double y, optional unrestricted double z = 0, optional unrestricted double w = 1), RuntimeEnabled=GeometryInterfaces,
diff --git a/core/dom/DOMPointInit.idl b/core/dom/DOMPointInit.idl new file mode 100644 index 0000000..b1d7090 --- /dev/null +++ b/core/dom/DOMPointInit.idl
@@ -0,0 +1,14 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Spec: http://dev.w3.org/fxtf/geometry/#DOMPoint + +[ + GarbageCollected +] dictionary DOMPointInit { + unrestricted double x = 0; + unrestricted double y = 0; + unrestricted double z = 0; + unrestricted double w = 1; +};
diff --git a/core/dom/DOMPointReadOnly.idl b/core/dom/DOMPointReadOnly.idl index a02868d..6fa6110 100644 --- a/core/dom/DOMPointReadOnly.idl +++ b/core/dom/DOMPointReadOnly.idl
@@ -6,6 +6,7 @@ Constructor(unrestricted double x, unrestricted double y, unrestricted double z, unrestricted double w), GarbageCollected, + NotScriptWrappable, RuntimeEnabled=GeometryInterfaces, ] interface DOMPointReadOnly { readonly attribute unrestricted double x;
diff --git a/core/dom/DOMRectReadOnly.idl b/core/dom/DOMRectReadOnly.idl index 50e05a5..87b80da 100644 --- a/core/dom/DOMRectReadOnly.idl +++ b/core/dom/DOMRectReadOnly.idl
@@ -6,6 +6,7 @@ Constructor(unrestricted double x, unrestricted double y, unrestricted double width, unrestricted double height), GarbageCollected, + NotScriptWrappable, RuntimeEnabled=GeometryInterfaces, ] interface DOMRectReadOnly { readonly attribute unrestricted double x;
diff --git a/core/dom/Document.idl b/core/dom/Document.idl index e6cadff..09e5837 100644 --- a/core/dom/Document.idl +++ b/core/dom/Document.idl
@@ -23,7 +23,7 @@ typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; [ - SpecialWrapFor=HTMLDocument|XMLDocument + SpecialWrapFor=(HTMLDocument,XMLDocument) ] interface Document : Node { // DOM Level 1 Core @@ -80,7 +80,7 @@ // DOM Level 2 Abstract Views (DocumentView interface) - [ImplementedAs=executingWindow] readonly attribute Window defaultView; + [ImplementedAs=domWindow] readonly attribute Window defaultView; // DOM Level 2 Style (DocumentStyle interface)
diff --git a/core/dom/DocumentFullscreen.idl b/core/dom/DocumentFullscreen.idl index 43547f7..ca9d85a 100644 --- a/core/dom/DocumentFullscreen.idl +++ b/core/dom/DocumentFullscreen.idl
@@ -29,7 +29,7 @@ [RuntimeEnabled=FullscreenUnprefixed] attribute EventHandler onfullscreenerror; // Mozilla version - [MeasureAs=PrefixedDocumentIsFullscreen] readonly attribute boolean webkitIsFullScreen; + [MeasureAs=PrefixedDocumentIsFullscreen, ImplementedAs=webkitCurrentFullScreenElement] readonly attribute boolean webkitIsFullScreen; [MeasureAs=PrefixedDocumentFullScreenKeyboardInputAllowed] readonly attribute boolean webkitFullScreenKeyboardInputAllowed; [MeasureAs=PrefixedDocumentCurrentFullScreenElement] readonly attribute Element webkitCurrentFullScreenElement; [MeasureAs=PrefixedDocumentCancelFullScreen, ImplementedAs=exitFullscreen] void webkitCancelFullScreen();
diff --git a/core/dom/Element.idl b/core/dom/Element.idl index 89e5e7c..688db84 100644 --- a/core/dom/Element.idl +++ b/core/dom/Element.idl
@@ -19,7 +19,7 @@ */ [ - SpecialWrapFor=HTMLElement|SVGElement, + SpecialWrapFor=(HTMLElement,SVGElement), ] interface Element : Node { // DOM Level 1 Core @@ -55,7 +55,7 @@ [Reflect, DartNoAutoScope] attribute DOMString id; readonly attribute DOMString? namespaceURI; [RaisesException=Setter] attribute DOMString? prefix; - readonly attribute DOMString? localName; + [DartCustom] readonly attribute DOMString? localName; [RaisesException] boolean matches(DOMString selectors); @@ -75,8 +75,8 @@ // attribute (Dictionary or double) scrollLeft; // attribute (Dictionary or double) scrollTop; // http://crbug.com/240176 - [Custom=Setter] attribute long scrollLeft; - [Custom=Setter] attribute long scrollTop; + [Custom=Setter] attribute double scrollLeft; + [Custom=Setter] attribute double scrollTop; readonly attribute long scrollWidth; readonly attribute long scrollHeight;
diff --git a/core/dom/Iterator.idl b/core/dom/Iterator.idl new file mode 100644 index 0000000..87027c5 --- /dev/null +++ b/core/dom/Iterator.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + Iterable, + GarbageCollected, + NoInterfaceObject, +] interface Iterator { + [CallWith=ScriptState, RaisesException] any next(optional any value); +};
diff --git a/core/dom/MutationObserver.idl b/core/dom/MutationObserver.idl index 2c6d142..e024d4a 100644 --- a/core/dom/MutationObserver.idl +++ b/core/dom/MutationObserver.idl
@@ -33,7 +33,7 @@ Custom=VisitDOMWrapper, WillBeGarbageCollected, ] interface MutationObserver { - [RaisesException] void observe(Node target, Dictionary options); + [RaisesException] void observe(Node target, MutationObserverInit options); sequence<MutationRecord> takeRecords(); void disconnect(); };
diff --git a/core/dom/MutationObserverInit.idl b/core/dom/MutationObserverInit.idl new file mode 100644 index 0000000..e44a484 --- /dev/null +++ b/core/dom/MutationObserverInit.idl
@@ -0,0 +1,17 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Spec: http://dom.spec.whatwg.org/#interface-mutationobserver + +[ + GarbageCollected +] dictionary MutationObserverInit { + boolean childList = false; + boolean attributes; + boolean characterData; + boolean subtree = false; + boolean attributeOldValue; + boolean characterDataOldValue; + sequence<DOMString> attributeFilter; +};
diff --git a/core/dom/Notation.idl b/core/dom/Notation.idl deleted file mode 100644 index 5ad13ec..0000000 --- a/core/dom/Notation.idl +++ /dev/null
@@ -1,25 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -// FIXME: Remove Notation interface. We never create Notation objects. We have -// this interface to provide window.Notation. -interface Notation : Node { - // We don't need to provide any attributes. -}; -
diff --git a/core/dom/Range.idl b/core/dom/Range.idl index cb2d8fd..51a9da4 100644 --- a/core/dom/Range.idl +++ b/core/dom/Range.idl
@@ -48,7 +48,7 @@ const unsigned short END_TO_END = 2; const unsigned short END_TO_START = 3; - [RaisesException, TypeChecking=Interface] short compareBoundaryPoints(CompareHow how, Range sourceRange); + [RaisesException, TypeChecking=Interface] short compareBoundaryPoints(unsigned short how, Range sourceRange); [RaisesException, CustomElementCallbacks] void deleteContents(); [RaisesException, CustomElementCallbacks] DocumentFragment extractContents();
diff --git a/core/editing/Selection.idl b/core/editing/Selection.idl index dc27b0d..263a3c2 100644 --- a/core/editing/Selection.idl +++ b/core/editing/Selection.idl
@@ -45,14 +45,13 @@ readonly attribute long focusOffset; readonly attribute boolean isCollapsed; - [RaisesException, TypeChecking=Interface] void collapse(Node node, optional long offset); + [RaisesException] void collapse(Node? node, optional long offset = 0); [RaisesException] void collapseToStart(); [RaisesException] void collapseToEnd(); - // FIXME: should be: optional long offset = 0 http://crbug.com/258153 // We mark offset as optional, defaulting to 0; this differs from spec. // http://crbug.com/384966 - [RaisesException, TypeChecking=Interface] void extend(Node node, optional long offset); + [RaisesException, TypeChecking=Interface] void extend(Node node, optional long offset = 0); [RaisesException] void selectAllChildren([Default=Undefined] optional Node node); [CustomElementCallbacks] void deleteFromDocument(); @@ -67,8 +66,7 @@ // Firefox extensions // https://developer.mozilla.org/En/DOM/Selection // - // FIXME: Add use counters. - boolean containsNode([Default = Undefined] optional Node node, [Default = Undefined] optional boolean allowPartial); + [MeasureAs=SelectionContainsNode] boolean containsNode([Default = Undefined] optional Node node, [Default = Undefined] optional boolean allowPartial); // WebKit extensions [MeasureAs=SelectionBaseNode] readonly attribute Node baseNode; @@ -87,8 +85,7 @@ [Default=Undefined] optional long baseOffset, [Default=Undefined] optional Node extentNode, [Default=Undefined] optional long extentOffset); - [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException, TypeChecking=Interface] void setPosition(Node node, - optional long offset); + [ImplementedAs=collapse, MeasureAs=SelectionSetPosition, RaisesException] void setPosition(Node? node, optional long offset = 0); // IE extensions // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx
diff --git a/core/events/EventTarget.idl b/core/events/EventTarget.idl index c83100d..eacdc4e 100644 --- a/core/events/EventTarget.idl +++ b/core/events/EventTarget.idl
@@ -19,6 +19,7 @@ */ [ + CheckSecurity=Window, Custom=ToV8, WillBeGarbageCollected, ] interface EventTarget {
diff --git a/core/fileapi/FileReader.idl b/core/fileapi/FileReader.idl index d6cd5d0..1d10d87 100644 --- a/core/fileapi/FileReader.idl +++ b/core/fileapi/FileReader.idl
@@ -34,7 +34,8 @@ ActiveDOMObject, Constructor, ConstructorCallWith=ExecutionContext, - Exposed=(Window,Worker) + Exposed=(Window,Worker), + TypeChecking=Interface ] interface FileReader : EventTarget { // ready states const unsigned short EMPTY = 0;
diff --git a/core/frame/ConsoleBase.idl b/core/frame/ConsoleBase.idl index 508c5b9..533d293 100644 --- a/core/frame/ConsoleBase.idl +++ b/core/frame/ConsoleBase.idl
@@ -51,8 +51,8 @@ [CallWith=ScriptState] void timeEnd(optional DOMString title = null); void timeStamp(optional DOMString title = null); - [CallWith=ScriptState] void timeline(optional DOMString title = null); - [CallWith=ScriptState] void timelineEnd(optional DOMString title = null); + [DeprecateAs=ConsoleTimeline,CallWith=ScriptState] void timeline(optional DOMString title = null); + [DeprecateAs=ConsoleTimelineEnd,CallWith=ScriptState] void timelineEnd(optional DOMString title = null); [CallWith=(ScriptArguments,ScriptState)] void group(); [CallWith=(ScriptArguments,ScriptState)] void groupCollapsed();
diff --git a/core/frame/ScrollOptions.idl b/core/frame/ScrollOptions.idl new file mode 100644 index 0000000..8a2af31 --- /dev/null +++ b/core/frame/ScrollOptions.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Spec: Non-standard + +[ + GarbageCollected +] dictionary ScrollOptions { + DOMString behavior; +};
diff --git a/core/frame/WebKitPoint.idl b/core/frame/WebKitPoint.idl deleted file mode 100644 index cc11b47..0000000 --- a/core/frame/WebKitPoint.idl +++ /dev/null
@@ -1,35 +0,0 @@ -/* - * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - CustomConstructor, - CustomConstructor(float x, float y), - MeasureAs=WebKitPoint, - WillBeGarbageCollected, -] interface WebKitPoint { - attribute float x; - attribute float y; -}; -
diff --git a/core/frame/Window.idl b/core/frame/Window.idl index ce7aa0e..4ef969a 100644 --- a/core/frame/Window.idl +++ b/core/frame/Window.idl
@@ -98,12 +98,12 @@ // Overloading can be replaced by optional if RuntimeEnabled is removed, by // changing the third argument to *optional* Dictionary scrollOptions - void scrollBy(long x, long y); - [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollBy(long x, long y, Dictionary scrollOptions); - void scrollTo(long x, long y); - [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollTo(long x, long y, Dictionary scrollOptions); - void scroll(long x, long y); - [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scroll(long x, long y, Dictionary scrollOptions); + void scrollBy(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollBy(double x, double y, ScrollOptions scrollOptions); + void scrollTo(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollTo(double x, double y, ScrollOptions scrollOptions); + void scroll(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scroll(double x, double y, ScrollOptions scrollOptions); void moveBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats. void moveTo([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats. void resizeBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
diff --git a/core/html/HTMLDialogElement.idl b/core/html/HTMLDialogElement.idl index c26e394..702653d 100644 --- a/core/html/HTMLDialogElement.idl +++ b/core/html/HTMLDialogElement.idl
@@ -23,9 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=DialogElement -] interface HTMLDialogElement : HTMLElement { +interface HTMLDialogElement : HTMLElement { [Reflect] attribute boolean open; attribute DOMString returnValue; [RaisesException] void close(optional DOMString returnValue = null);
diff --git a/core/html/HTMLElement.idl b/core/html/HTMLElement.idl index a138212..e606b15 100644 --- a/core/html/HTMLElement.idl +++ b/core/html/HTMLElement.idl
@@ -40,6 +40,7 @@ [CustomElementCallbacks, RaisesException=Setter] attribute DOMString contentEditable; readonly attribute boolean isContentEditable; + [RuntimeEnabled=ContextMenu] attribute HTMLMenuElement? contextMenu; attribute boolean spellcheck;
diff --git a/core/html/HTMLFormElement.idl b/core/html/HTMLFormElement.idl index 6c2f1f9..36db8c9 100644 --- a/core/html/HTMLFormElement.idl +++ b/core/html/HTMLFormElement.idl
@@ -23,7 +23,7 @@ ] interface HTMLFormElement : HTMLElement { [Reflect=accept_charset] attribute DOMString acceptCharset; [Reflect, URL] attribute DOMString action; - [Reflect, ReflectOnly="on"|"off", ReflectMissing="on", ReflectInvalid="on"] attribute DOMString autocomplete; + [Reflect, ReflectOnly=("on","off"), ReflectMissing="on", ReflectInvalid="on"] attribute DOMString autocomplete; [CustomElementCallbacks] attribute DOMString enctype; [CustomElementCallbacks] attribute DOMString encoding; [CustomElementCallbacks] attribute DOMString method;
diff --git a/core/html/HTMLImageElement.idl b/core/html/HTMLImageElement.idl index bd0808a..cde8092 100644 --- a/core/html/HTMLImageElement.idl +++ b/core/html/HTMLImageElement.idl
@@ -28,7 +28,7 @@ [Reflect] attribute DOMString alt; [Reflect, TreatNullAs=EmptyString] attribute DOMString border; readonly attribute boolean complete; - [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; + [Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString? crossOrigin; attribute long height; [Reflect] attribute long hspace; [Reflect] attribute boolean isMap;
diff --git a/core/html/HTMLInputElement.idl b/core/html/HTMLInputElement.idl index 61a1ff6..d53dd5b 100644 --- a/core/html/HTMLInputElement.idl +++ b/core/html/HTMLInputElement.idl
@@ -64,8 +64,8 @@ [RaisesException=Setter, CustomElementCallbacks] attribute Date? valueAsDate; [RaisesException=Setter, CustomElementCallbacks] attribute unrestricted double valueAsNumber; - [RaisesException, CustomElementCallbacks] void stepUp(optional long n); - [RaisesException, CustomElementCallbacks] void stepDown(optional long n); + [RaisesException, CustomElementCallbacks] void stepUp(optional long n = 1); + [RaisesException, CustomElementCallbacks] void stepDown(optional long n = 1); [CustomElementCallbacks] attribute unsigned long width; readonly attribute boolean willValidate; @@ -85,7 +85,7 @@ [RaisesException] void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - optional DOMString selectionMode = null); + optional DOMString selectionMode = "preserve"); [RaisesException, ImplementedAs=setSelectionRangeForBinding] void setSelectionRange([Default=Undefined] optional long start,
diff --git a/core/html/HTMLLinkElement.idl b/core/html/HTMLLinkElement.idl index 667acdb..a31a5ef 100644 --- a/core/html/HTMLLinkElement.idl +++ b/core/html/HTMLLinkElement.idl
@@ -23,7 +23,7 @@ [Reflect] attribute boolean disabled; [Reflect] attribute DOMString charset; [Reflect, URL] attribute DOMString href; - [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; + [Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString? crossOrigin; [Reflect] attribute DOMString hreflang; [Reflect] attribute DOMString media; [Reflect] attribute DOMString rel; @@ -35,7 +35,7 @@ // DOM Level 2 Style readonly attribute StyleSheet sheet; - [RuntimeEnabled=HTMLImports] readonly attribute Document import; + readonly attribute Document import; [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity; };
diff --git a/core/html/HTMLMediaElement.idl b/core/html/HTMLMediaElement.idl index aa9d040..7990f6b 100644 --- a/core/html/HTMLMediaElement.idl +++ b/core/html/HTMLMediaElement.idl
@@ -26,6 +26,7 @@ [ ActiveDOMObject, RuntimeEnabled=Media, + SpecialWrapFor=(HTMLAudioElement,HTMLVideoElement), TypeChecking=Unrestricted, ] interface HTMLMediaElement : HTMLElement { @@ -35,7 +36,7 @@ // network state [Reflect, URL] attribute DOMString src; [URL] readonly attribute DOMString currentSrc; - [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; + [Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString? crossOrigin; const unsigned short NETWORK_EMPTY = 0; const unsigned short NETWORK_IDLE = 1;
diff --git a/core/html/HTMLScriptElement.idl b/core/html/HTMLScriptElement.idl index a626770..c96ec40 100644 --- a/core/html/HTMLScriptElement.idl +++ b/core/html/HTMLScriptElement.idl
@@ -26,7 +26,7 @@ [Reflect] attribute boolean defer; [Reflect, URL] attribute DOMString src; [Reflect] attribute DOMString type; - [Reflect, ReflectOnly="anonymous"|"use-credentials", ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString crossOrigin; + [Reflect, ReflectOnly=("anonymous","use-credentials"), ReflectEmpty="anonymous", ReflectInvalid="anonymous"] attribute DOMString? crossOrigin; [Reflect, RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute DOMString nonce; [Reflect, RuntimeEnabled=SubresourceIntegrity] attribute DOMString integrity;
diff --git a/core/html/HTMLTableElement.idl b/core/html/HTMLTableElement.idl index e6897fa..69d364f 100644 --- a/core/html/HTMLTableElement.idl +++ b/core/html/HTMLTableElement.idl
@@ -45,6 +45,6 @@ HTMLElement createCaption(); void deleteCaption(); - [RaisesException] HTMLElement insertRow(optional long index); + [RaisesException] HTMLElement insertRow(optional long index = -1); [RaisesException] void deleteRow([Default=Undefined] optional long index); };
diff --git a/core/html/HTMLTableRowElement.idl b/core/html/HTMLTableRowElement.idl index aadbc51..1f06529 100644 --- a/core/html/HTMLTableRowElement.idl +++ b/core/html/HTMLTableRowElement.idl
@@ -27,6 +27,6 @@ [Reflect=char] attribute DOMString ch; [Reflect=charoff] attribute DOMString chOff; [Reflect] attribute DOMString vAlign; - [RaisesException] HTMLElement insertCell(optional long index); + [RaisesException] HTMLElement insertCell(optional long index = -1); [RaisesException] void deleteCell([Default=Undefined] optional long index); };
diff --git a/core/html/HTMLTableSectionElement.idl b/core/html/HTMLTableSectionElement.idl index a8f0b89..8816676 100644 --- a/core/html/HTMLTableSectionElement.idl +++ b/core/html/HTMLTableSectionElement.idl
@@ -24,6 +24,6 @@ [Reflect=charoff] attribute DOMString chOff; [Reflect] attribute DOMString vAlign; readonly attribute HTMLCollection rows; - [RaisesException] HTMLElement insertRow(optional long index); + [RaisesException] HTMLElement insertRow(optional long index = -1); [RaisesException] void deleteRow([Default=Undefined] optional long index); };
diff --git a/core/html/MediaController.idl b/core/html/MediaController.idl index 8e70a8b..0a61cb6 100644 --- a/core/html/MediaController.idl +++ b/core/html/MediaController.idl
@@ -35,7 +35,7 @@ readonly attribute TimeRanges seekable; readonly attribute unrestricted double duration; - [RaisesException=Setter] attribute double currentTime; + attribute double currentTime; readonly attribute boolean paused; readonly attribute TimeRanges played;
diff --git a/core/html/canvas/CanvasPattern.idl b/core/html/canvas/CanvasPattern.idl index d8e453d..7bc553c 100644 --- a/core/html/canvas/CanvasPattern.idl +++ b/core/html/canvas/CanvasPattern.idl
@@ -25,4 +25,7 @@ [ WillBeGarbageCollected, ] interface CanvasPattern { + + [RuntimeEnabled=ExperimentalCanvasFeatures] void setTransform(SVGMatrix transform); + };
diff --git a/core/html/canvas/CanvasRenderingContext2D.idl b/core/html/canvas/CanvasRenderingContext2D.idl index aa076cc..b1eb216 100644 --- a/core/html/canvas/CanvasRenderingContext2D.idl +++ b/core/html/canvas/CanvasRenderingContext2D.idl
@@ -38,7 +38,7 @@ enum CanvasFillRule { "nonzero", "evenodd" }; [ - TypeChecking=Interface|Unrestricted, + TypeChecking=(Interface,Unrestricted), WillBeGarbageCollected, ] interface CanvasRenderingContext2D { // back-reference to the canvas @@ -89,20 +89,20 @@ // path API (see also CanvasPathMethods) void beginPath(); void fill(optional CanvasFillRule winding); - [RuntimeEnabled=Path2D] void fill(Path2D path, optional CanvasFillRule winding); + void fill(Path2D path, optional CanvasFillRule winding); void stroke(); - [RuntimeEnabled=Path2D] void stroke(Path2D path); + void stroke(Path2D path); // Focus rings void drawFocusIfNeeded(Element element); - [RuntimeEnabled=Path2D] void drawFocusIfNeeded(Path2D path, Element element); + void drawFocusIfNeeded(Path2D path, Element element); [RuntimeEnabled=ExperimentalCanvasFeatures] void scrollPathIntoView(optional Path2D path); void clip(optional CanvasFillRule winding); - [RuntimeEnabled=Path2D] void clip(Path2D path, optional CanvasFillRule winding); + void clip(Path2D path, optional CanvasFillRule winding); boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasFillRule winding); - [RuntimeEnabled=Path2D] boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding); + boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule winding); boolean isPointInStroke(unrestricted float x, unrestricted float y); - [RuntimeEnabled=Path2D] boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); + boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); // text (see also the CanvasDrawingStyles interface) void fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth); @@ -124,9 +124,7 @@ [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void drawImage(ImageBitmap imageBitmap, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh); // hit regions - // FIXME: Blink does not currently support WebIDL dictionary definitions. - // See http://crbug.com/321462 - [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegion(optional Dictionary options); + [RuntimeEnabled=ExperimentalCanvasFeatures, RaisesException] void addHitRegion(optional HitRegionOptions options); [RuntimeEnabled=ExperimentalCanvasFeatures] void removeHitRegion(DOMString id); [RuntimeEnabled=ExperimentalCanvasFeatures] void clearHitRegions(); @@ -159,6 +157,7 @@ attribute DOMString font; // (default 10px sans-serif) attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start") attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") + [RuntimeEnabled=ExperimentalCanvasFeatures] attribute DOMString direction; // "inherit", "rtl", "ltr" (default: "inherit") // Non-standard APIs. Candidates for deprecation // https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D
diff --git a/core/html/canvas/HitRegionOptions.idl b/core/html/canvas/HitRegionOptions.idl new file mode 100644 index 0000000..33380b8 --- /dev/null +++ b/core/html/canvas/HitRegionOptions.idl
@@ -0,0 +1,17 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Spec: https://html.spec.whatwg.org/multipage/scripting.html#hitregionoptions + +enum CanvasFillRule { "nonzero", "evenodd" }; + +[ + GarbageCollected +] dictionary HitRegionOptions { + Path2D? path = null; + CanvasFillRule fillRule = "nonzero"; + DOMString id = ""; + Element? control = null; + // We don't use parentID, label and role yet. +};
diff --git a/core/html/canvas/Path2D.idl b/core/html/canvas/Path2D.idl index c89979d..9210737 100644 --- a/core/html/canvas/Path2D.idl +++ b/core/html/canvas/Path2D.idl
@@ -32,7 +32,6 @@ Constructor, Constructor(Path2D path), Constructor(DOMString text), - RuntimeEnabled=Path2D, WillBeGarbageCollected, ] interface Path2D {
diff --git a/core/html/canvas/WebGLRenderingContextBase.idl b/core/html/canvas/WebGLRenderingContextBase.idl index a790556..5ba1683 100644 --- a/core/html/canvas/WebGLRenderingContextBase.idl +++ b/core/html/canvas/WebGLRenderingContextBase.idl
@@ -41,11 +41,11 @@ typedef unrestricted float GLclampf; [ - // FIXME: [DoNotCheckConstants] and [TypeChecking=Interface|Unrestricted] should be applied + // FIXME: [DoNotCheckConstants] and [TypeChecking=(Interface,Unrestricted)] should be applied // to members and not need to be put on implementing interface // DoNotCheckConstants, // need to put on implementing interface NoInterfaceObject, // Always used on target of 'implements' - // TypeChecking=Interface|Unrestricted, // need to put on implementing interface + // TypeChecking=(Interface,Unrestricted), // need to put on implementing interface WillBeGarbageCollected, ] interface WebGLRenderingContextBase {
diff --git a/core/html/shadow/PluginPlaceholderElement.idl b/core/html/shadow/PluginPlaceholderElement.idl new file mode 100644 index 0000000..54b5e49 --- /dev/null +++ b/core/html/shadow/PluginPlaceholderElement.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoInterfaceObject +] interface PluginPlaceholderElement : HTMLDivElement { + [ImplementedInPrivateScript, OnlyExposedToPrivateScript] attribute DOMString message; + [ImplementedInPrivateScript, OnlyExposedToPrivateScript] void createdCallback(); +};
diff --git a/core/inspector/CodeGeneratorInspector.py b/core/inspector/CodeGeneratorInspector.py index 7d4be18..5d02acf 100755 --- a/core/inspector/CodeGeneratorInspector.py +++ b/core/inspector/CodeGeneratorInspector.py
@@ -48,7 +48,7 @@ TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", "Runtime.InternalPropertyDescriptor", - "Debugger.FunctionDetails", "Debugger.CallFrame", "Debugger.Location", + "Debugger.FunctionDetails", "Debugger.CollectionEntry", "Debugger.CallFrame", "Debugger.Location", "Canvas.TraceLog", "Canvas.ResourceState"]) TYPES_WITH_OPEN_FIELD_LIST_SET = frozenset([ @@ -57,8 +57,6 @@ # InspectorResourceAgent needs to update mime-type. "Network.Response"]) -EXACTLY_INT_SUPPORTED = False - cmdline_parser = optparse.OptionParser() cmdline_parser.add_option("--output_dir") @@ -117,58 +115,15 @@ str = possible_abbreviation.lower() + str[pos:] return str - @staticmethod - def camel_case_to_capitalized_with_underscores(str): - if len(str) == 0: - return str - output = Capitalizer.split_camel_case_(str) - return "_".join(output).upper() - - @staticmethod - def split_camel_case_(str): - output = [] - pos_being = 0 - pos = 1 - has_oneletter = False - while pos < len(str): - if str[pos].isupper(): - output.append(str[pos_being:pos].upper()) - if pos - pos_being == 1: - has_oneletter = True - pos_being = pos - pos += 1 - output.append(str[pos_being:]) - if has_oneletter: - array_pos = 0 - while array_pos < len(output) - 1: - if len(output[array_pos]) == 1: - array_pos_end = array_pos + 1 - while array_pos_end < len(output) and len(output[array_pos_end]) == 1: - array_pos_end += 1 - if array_pos_end - array_pos > 1: - possible_abbreviation = "".join(output[array_pos:array_pos_end]) - if possible_abbreviation.upper() in Capitalizer.ABBREVIATION: - output[array_pos:array_pos_end] = [possible_abbreviation] - else: - array_pos = array_pos_end - 1 - array_pos += 1 - return output - ABBREVIATION = frozenset(["XHR", "DOM", "CSS"]) VALIDATOR_IFDEF_NAME = "ENABLE(ASSERT)" class DomainNameFixes: - @classmethod - def get_fixed_data(cls, domain_name): - field_name_res = Capitalizer.upper_camel_case_to_lower(domain_name) + "Agent" - - class Res(object): - agent_field_name = field_name_res - - return Res - + @staticmethod + def get_fixed_data(domain_name): + return Capitalizer.upper_camel_case_to_lower(domain_name) + "Agent" class RawTypes(object): @staticmethod @@ -190,41 +145,14 @@ else: raise Exception("Unknown type: %s" % json_type) - # For output parameter all values are passed by pointer except RefPtr-based types. - class OutputPassModel: - class ByPointer: - @staticmethod - def get_argument_prefix(): - return "&" - - @staticmethod - def get_parameter_type_suffix(): - return "*" - - class ByReference: - @staticmethod - def get_argument_prefix(): - return "" - - @staticmethod - def get_parameter_type_suffix(): - return "&" - class BaseType(object): - need_internal_runtime_cast_ = False - - @classmethod - def request_raw_internal_runtime_cast(cls): - if not cls.need_internal_runtime_cast_: - cls.need_internal_runtime_cast_ = True - @classmethod def get_raw_validator_call_text(cls): - return "RuntimeCastHelper::assertType<JSONValue::Type%s>" % cls.get_validate_method_params().template_type + return "RuntimeCastHelper::assertType<JSONValue::Type%s>" % cls.get_getter_name() @staticmethod - def get_validate_method_params(): - raise Exception("Abstract method") + def get_getter_name(): + raise Exception("Unsupported") class String(BaseType): @staticmethod @@ -238,20 +166,6 @@ return "InspectorString::create(%s)" @staticmethod - def get_c_initializer(): - return "\"\"" - - @staticmethod - def get_validate_method_params(): - class ValidateMethodParams: - template_type = "String" - return ValidateMethodParams - - @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByPointer - - @staticmethod def is_heavy_value(): return True @@ -276,19 +190,11 @@ def get_constructor_pattern(): return "InspectorBasicValue::create(%s)" - @staticmethod - def get_c_initializer(): - return "0" - @classmethod def get_raw_validator_call_text(cls): return "RuntimeCastHelper::assertInt" @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByPointer - - @staticmethod def is_heavy_value(): return False @@ -314,18 +220,8 @@ return "InspectorBasicValue::create(%s)" @staticmethod - def get_c_initializer(): - return "0" - - @staticmethod - def get_validate_method_params(): - class ValidateMethodParams: - template_type = "Number" - return ValidateMethodParams - - @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByPointer + def get_raw_validator_call_text(): + return "RuntimeCastHelper::assertType<JSONValue::TypeNumber>" @staticmethod def is_heavy_value(): @@ -351,20 +247,6 @@ return "InspectorBasicValue::create(%s)" @staticmethod - def get_c_initializer(): - return "false" - - @staticmethod - def get_validate_method_params(): - class ValidateMethodParams: - template_type = "Boolean" - return ValidateMethodParams - - @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByPointer - - @staticmethod def is_heavy_value(): return False @@ -390,24 +272,10 @@ return "%s" @staticmethod - def get_c_initializer(): - return "JSONObject::create()" - - @staticmethod def get_output_argument_prefix(): return "" @staticmethod - def get_validate_method_params(): - class ValidateMethodParams: - template_type = "Object" - return ValidateMethodParams - - @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByReference - - @staticmethod def is_heavy_value(): return True @@ -427,10 +295,6 @@ get_setter_name = get_getter_name @staticmethod - def get_c_initializer(): - raise Exception("Unsupported") - - @staticmethod def get_constructor_pattern(): raise Exception("Unsupported") @@ -439,10 +303,6 @@ return "RuntimeCastHelper::assertAny" @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByReference - - @staticmethod def is_heavy_value(): return True @@ -468,24 +328,10 @@ return "%s" @staticmethod - def get_c_initializer(): - return "JSONArray::create()" - - @staticmethod def get_output_argument_prefix(): return "" @staticmethod - def get_validate_method_params(): - class ValidateMethodParams: - template_type = "Array" - return ValidateMethodParams - - @staticmethod - def get_output_pass_model(): - return RawTypes.OutputPassModel.ByReference - - @staticmethod def is_heavy_value(): return True @@ -669,23 +515,10 @@ def get_event_setter_expression_pattern(): return "*%s" - class ExactlyInt(ValueType): - def __init__(self): - TypeModel.ValueType.__init__(self, "int", False) - - def get_input_param_type_text(self): - return "TypeBuilder::ExactlyInt" - - def get_opt_output_type_(self): - return "TypeBuilder::ExactlyInt" - @classmethod def init_class(cls): cls.Bool = cls.ValueType("bool", False) - if EXACTLY_INT_SUPPORTED: - cls.Int = cls.ExactlyInt() - else: - cls.Int = cls.ValueType("int", False) + cls.Int = cls.ValueType("int", False) cls.Number = cls.ValueType("double", False) cls.String = cls.ValueType("String", True,) cls.Object = cls.RefPtrBased("JSONObject") @@ -754,9 +587,6 @@ def get_indent(self): return self.indent - def get_indented(self, additional_indent): - return Writer(self.output, self.indent + additional_indent) - def insert_writer(self, additional_indent): new_output = [] self.output.append(new_output) @@ -859,8 +689,6 @@ @classmethod def get_code_generator(enum_binding_cls): - #FIXME: generate ad-hoc enums too once we figure out how to better implement them in C++. - comment_out = helper.is_ad_hoc class CodeGenerator: @staticmethod @@ -896,8 +724,6 @@ validator_writer = generate_context.validator_writer - domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name) - validator_writer.newline("void %s%s::assertCorrectValue(JSONValue* value)\n" % (helper.full_name_prefix_for_impl, enum_name)) validator_writer.newline("{\n") validator_writer.newline(" WTF::String s;\n") @@ -1003,7 +829,7 @@ @staticmethod def request_internal_runtime_cast(): - RawTypes.String.request_raw_internal_runtime_cast() + pass @staticmethod def get_code_generator(): @@ -1196,7 +1022,6 @@ for prop_data in resolve_data.main_properties: prop_name = prop_data.p["name"] param_type_binding = prop_data.param_type_binding - raw_type = param_type_binding.reduce_to_raw_type() if isinstance(param_type_binding.get_type_model(), TypeModel.ValueType): writer.append_multiline("\n void %s" % prop_name) writer.append("(%s value)\n" % param_type_binding.get_type_model().get_command_return_pass_model().get_output_parameter_type()) @@ -1244,8 +1069,6 @@ validator_writer = generate_context.validator_writer - domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name) - validator_writer.newline("void %s%s::assertCorrectValue(JSONValue* value)\n" % (helper.full_name_prefix_for_impl, class_name)) validator_writer.newline("{\n") validator_writer.newline(" RefPtr<JSONObject> object;\n") @@ -1369,7 +1192,7 @@ @staticmethod def request_internal_runtime_cast(): - RawTypes.Object.request_raw_internal_runtime_cast() + pass @staticmethod def get_code_generator(): @@ -1516,7 +1339,7 @@ raise Exception("Unsupported") def request_internal_runtime_cast(self): - self.raw_type_.request_raw_internal_runtime_cast() + pass def get_code_generator(self): return None @@ -1803,30 +1626,11 @@ def go(): Generator.process_types(type_map) - first_cycle_guardable_list_list = [ - Generator.backend_method_declaration_list, - Generator.backend_method_implementation_list, - Generator.backend_method_name_declaration_list, - Generator.backend_method_name_declaration_index_list, - Generator.backend_agent_interface_list, - Generator.frontend_class_field_lines, - Generator.frontend_constructor_init_list, - Generator.frontend_domain_class_lines, - Generator.frontend_method_list, - Generator.method_handler_list, - Generator.method_name_enum_list, - Generator.backend_constructor_init_list, - Generator.backend_virtual_setters_list, - Generator.backend_setters_list, - Generator.backend_field_list] - for json_domain in json_api["domains"]: domain_name = json_domain["domain"] domain_name_lower = domain_name.lower() - domain_fixes = DomainNameFixes.get_fixed_data(domain_name) - - agent_field_name = domain_fixes.agent_field_name + agent_field_name = DomainNameFixes.get_fixed_data(domain_name) frontend_method_declaration_lines = [] @@ -1914,7 +1718,6 @@ method_in_code = "" method_out_code = "" - result_object_declaration = "" agent_call_param_list = ["&error"] agent_call_params_declaration_list = [" ErrorString error;"] send_response_call_params_list = ["error"] @@ -1947,10 +1750,6 @@ optional = json_parameter.get("optional") non_optional_type_model = param_raw_type.get_raw_type_model() - if optional: - type_model = non_optional_type_model.get_optional() - else: - type_model = non_optional_type_model if optional: code = (" bool %s_valueFound = false;\n" @@ -1988,7 +1787,7 @@ callback_writer.newline("class " + callback_name + " : public CallbackBase {\n") callback_writer.newline("public:\n") - callback_writer.newline(" " + callback_name + "(PassRefPtr<InspectorBackendDispatcherImpl>, int id);\n") + callback_writer.newline(" " + callback_name + "(PassRefPtrWillBeRawPtr<InspectorBackendDispatcherImpl>, int id);\n") callback_writer.newline(" void sendSuccess(" + ", ".join(decl_parameter_list) + ");\n") error_part_writer = callback_writer.insert_writer("") callback_writer.newline("};\n") @@ -2009,12 +1808,12 @@ ad_hoc_type_output.append(callback_output) - method_out_code += " RefPtr<" + agent_interface_name + "::" + callback_name + "> callback = adoptRef(new " + agent_interface_name + "::" + callback_name + "(this, callId));\n" + method_out_code += " RefPtrWillBeRawPtr<" + agent_interface_name + "::" + callback_name + "> callback = adoptRefWillBeNoop(new " + agent_interface_name + "::" + callback_name + "(this, callId));\n" agent_call_param_list.append("callback") normal_response_cook_text += " if (!error.length()) \n" normal_response_cook_text += " return;\n" normal_response_cook_text += " callback->disable();\n" - backend_agent_interface_list.append(", PassRefPtr<%s> callback" % callback_name) + backend_agent_interface_list.append(", PassRefPtrWillBeRawPtr<%s> callback" % callback_name) else: if "returns" in json_command: method_out_code += "\n" @@ -2031,7 +1830,6 @@ raw_type = return_type_binding.reduce_to_raw_type() setter_type = raw_type.get_setter_name() - initializer = raw_type.get_c_initializer() type_model = return_type_binding.get_type_model() if optional: @@ -2070,8 +1868,7 @@ # Redirect to another agent's implementation. agent_field = "m_" + agent_field_name if "redirect" in json_command: - domain_fixes = DomainNameFixes.get_fixed_data(json_command.get("redirect")) - agent_field = "m_" + domain_fixes.agent_field_name + agent_field = "m_" + DomainNameFixes.get_fixed_data(json_command.get("redirect")) Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None, domainName=domain_name, methodName=json_command_name, @@ -2211,8 +2008,6 @@ def generate_all_domains_code(out, type_data_callback): writer = Writer(out, "") for domain_data in type_map.domains(): - domain_fixes = DomainNameFixes.get_fixed_data(domain_data.name()) - namespace_declared = [] def namespace_lazy_generator(): @@ -2272,40 +2067,8 @@ fill_recursive(input) return res - -# A writer that only updates file if it actually changed to better support incremental build. -class SmartOutput: - def __init__(self, file_name): - self.file_name_ = file_name - self.output_ = "" - - def write(self, text): - self.output_ += text - - def close(self): - text_changed = True - - try: - read_file = open(self.file_name_, "r") - old_text = read_file.read() - read_file.close() - text_changed = old_text != self.output_ - except: - # Ignore, just overwrite by default - pass - - if text_changed: - out_file = open(self.file_name_, "w") - out_file.write(self.output_) - out_file.close() - - def output_file(file_name): - # For now, disable the incremental build optimisation in all cases. - if False: - return SmartOutput(file_name) - else: - return open(file_name, "w") + return open(file_name, "w") Generator.go()
diff --git a/core/inspector/CodeGeneratorInspectorStrings.py b/core/inspector/CodeGeneratorInspectorStrings.py index 83705c5..0591782 100644 --- a/core/inspector/CodeGeneratorInspectorStrings.py +++ b/core/inspector/CodeGeneratorInspectorStrings.py
@@ -70,7 +70,7 @@ """) callback_main_methods = ( -"""InspectorBackendDispatcher::$agentName::$callbackName::$callbackName(PassRefPtr<InspectorBackendDispatcherImpl> backendImpl, int id) : CallbackBase(backendImpl, id) {} +"""InspectorBackendDispatcher::$agentName::$callbackName::$callbackName(PassRefPtrWillBeRawPtr<InspectorBackendDispatcherImpl> backendImpl, int id) : CallbackBase(backendImpl, id) {} void InspectorBackendDispatcher::$agentName::$callbackName::sendSuccess($parameters) { @@ -126,6 +126,7 @@ #include "InspectorTypeBuilder.h" +#include "platform/heap/Handle.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" @@ -140,15 +141,17 @@ class InspectorBackendDispatcherImpl; -class InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher> { +class InspectorBackendDispatcher: public RefCountedWillBeGarbageCollectedFinalized<InspectorBackendDispatcher> { public: - static PassRefPtr<InspectorBackendDispatcher> create(InspectorFrontendChannel* inspectorFrontendChannel); + static PassRefPtrWillBeRawPtr<InspectorBackendDispatcher> create(InspectorFrontendChannel* inspectorFrontendChannel); virtual ~InspectorBackendDispatcher() { } + virtual void trace(Visitor*) { } - class CallbackBase: public RefCounted<CallbackBase> { + class CallbackBase: public RefCountedWillBeGarbageCollectedFinalized<CallbackBase> { public: - CallbackBase(PassRefPtr<InspectorBackendDispatcherImpl> backendImpl, int id); + CallbackBase(PassRefPtrWillBeRawPtr<InspectorBackendDispatcherImpl> backendImpl, int id); virtual ~CallbackBase(); + virtual void trace(Visitor*); void sendFailure(const ErrorString&); bool isActive(); @@ -158,7 +161,7 @@ private: void disable() { m_alreadySent = true; } - RefPtr<InspectorBackendDispatcherImpl> m_backendImpl; + RefPtrWillBeMember<InspectorBackendDispatcherImpl> m_backendImpl; int m_id; bool m_alreadySent; @@ -278,15 +281,15 @@ $methods -PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel) +PassRefPtrWillBeRawPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel) { - return adoptRef(new InspectorBackendDispatcherImpl(inspectorFrontendChannel)); + return adoptRefWillBeNoop(new InspectorBackendDispatcherImpl(inspectorFrontendChannel)); } void InspectorBackendDispatcherImpl::dispatch(const String& message) { - RefPtr<InspectorBackendDispatcher> protect = this; + RefPtrWillBeRawPtr<InspectorBackendDispatcher> protect(this); typedef void (InspectorBackendDispatcherImpl::*CallHandler)(long callId, JSONObject* messageObject, JSONArray* protocolErrors); typedef HashMap<String, CallHandler> DispatchMap; DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); @@ -484,11 +487,16 @@ return true; } -InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr<InspectorBackendDispatcherImpl> backendImpl, int id) +InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtrWillBeRawPtr<InspectorBackendDispatcherImpl> backendImpl, int id) : m_backendImpl(backendImpl), m_id(id), m_alreadySent(false) {} InspectorBackendDispatcher::CallbackBase::~CallbackBase() {} +void InspectorBackendDispatcher::CallbackBase::trace(Visitor* visitor) +{ + visitor->trace(m_backendImpl); +} + void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& error) { ASSERT(error.length()); @@ -576,30 +584,6 @@ WTF_MAKE_NONCOPYABLE(OptOutput); }; - -// A small transient wrapper around int type, that can be used as a funciton parameter type -// cleverly disallowing C++ implicit casts from float or double. -class ExactlyInt { -public: - template<typename T> - ExactlyInt(T t) : m_value(cast_to_int<T>(t)) {} - - ExactlyInt() {} - - operator int() { return m_value; } -private: - int m_value; - - template<typename T> - static int cast_to_int(T) { return T::default_case_cast_is_not_supported(); } -}; - -template<> -inline int ExactlyInt::cast_to_int<int>(int i) { return i; } - -template<> -inline int ExactlyInt::cast_to_int<unsigned int>(unsigned int i) { return i; } - class RuntimeCastHelper { public: #if $validatorIfdefName
diff --git a/core/inspector/CodeGeneratorInstrumentation.py b/core/inspector/CodeGeneratorInstrumentation.py index aa0335e..54e5ce8 100755 --- a/core/inspector/CodeGeneratorInstrumentation.py +++ b/core/inspector/CodeGeneratorInstrumentation.py
@@ -324,7 +324,8 @@ if len(self.agents) == 0: return - body_lines = map(self.generate_agent_call, self.agents) + body_lines = map(self.generate_ref_ptr, self.params) + body_lines += map(self.generate_agent_call, self.agents) if self.returns_cookie: if "Timeline" in self.agents: @@ -371,6 +372,11 @@ maybe_return=maybe_return, params_agent=", ".join(map(Parameter.to_str_value, self.params_impl)[1:])) + def generate_ref_ptr(self, param): + if param.is_prp: + return "\n RefPtr<%s> %s = %s;" % (param.inner_type, param.value, param.name) + else: + return "" class Parameter: def __init__(self, source): @@ -401,8 +407,12 @@ self.name = generate_param_name(self.type) if re.match("PassRefPtr<", param_decl): - self.value = "%s.get()" % self.name + self.is_prp = True + self.value = self.name + self.name = "prp" + self.name[0].upper() + self.name[1:] + self.inner_type = re.match("PassRefPtr<(.+)>", param_decl).group(1) else: + self.is_prp = False self.value = self.name
diff --git a/core/inspector/InjectedScriptHost.idl b/core/inspector/InjectedScriptHost.idl index 018f9d2..56f1e4d 100644 --- a/core/inspector/InjectedScriptHost.idl +++ b/core/inspector/InjectedScriptHost.idl
@@ -36,23 +36,25 @@ ] interface InjectedScriptHost { [NotEnumerable, Unforgeable] void clearConsoleMessages(); - [NotEnumerable, Unforgeable, Custom] void inspect(any objectId, any hints); + [NotEnumerable, Unforgeable, Custom] void inspect(any objectId, object hints); [NotEnumerable, Unforgeable, Custom] any inspectedObject(long num); - [NotEnumerable, Unforgeable, Custom] any internalConstructorName(any obj); + [NotEnumerable, Unforgeable, Custom] DOMString internalConstructorName(any obj); [NotEnumerable, Unforgeable, Custom] boolean isHTMLAllCollection(any obj); - [NotEnumerable, Unforgeable, Custom] DOMString type(any obj); - [NotEnumerable, Unforgeable, Custom] any functionDetails(any obj); + [NotEnumerable, Unforgeable, Custom] DOMString subtype(any obj); + [NotEnumerable, Unforgeable, Custom] any functionDetails(Function obj); + [NotEnumerable, Unforgeable, Custom] any[]? collectionEntries(object obj); [NotEnumerable, Unforgeable, Custom] any[] getInternalProperties(any obj); - [NotEnumerable, Unforgeable, Custom] EventListener[] getEventListeners(EventTarget target); + [NotEnumerable, Unforgeable, Custom] any[] getEventListeners(EventTarget target); [NotEnumerable, Unforgeable, Custom] any eval(DOMString text); [NotEnumerable, Unforgeable, Custom] any evaluateWithExceptionDetails(DOMString text); [NotEnumerable, Unforgeable, Custom] void debugFunction(any fn); [NotEnumerable, Unforgeable, Custom] void undebugFunction(any fn); [NotEnumerable, Unforgeable, Custom] void monitorFunction(any fn); [NotEnumerable, Unforgeable, Custom] void unmonitorFunction(any fn); - [NotEnumerable, Unforgeable, Custom] any callFunction(any fn, any receiver, any[] argv); - [NotEnumerable, Unforgeable, Custom] any suppressWarningsAndCallFunction(any fn, any receiver, any[] argv); + [NotEnumerable, Unforgeable, Custom] any callFunction(Function fn, any receiver, optional any[] argv); + [NotEnumerable, Unforgeable, Custom] any suppressWarningsAndCallFunction(Function fn, any receiver, optional any[] argv); + [NotEnumerable, Unforgeable, Custom] void setNonEnumProperty(object obj, DOMString key, any value); // Only declarative scope (local, with and catch) is accepted. Returns undefined. - [NotEnumerable, Unforgeable, Custom] any setFunctionVariableValue(any functionObject, long scopeIndex, DOMString variableName, any newValue); + [NotEnumerable, Unforgeable, Custom] any setFunctionVariableValue(Function functionObject, long scopeIndex, DOMString variableName, any newValue); };
diff --git a/core/inspector/InspectorInstrumentation.idl b/core/inspector/InspectorInstrumentation.idl index d1d5b3b..1970ed8 100644 --- a/core/inspector/InspectorInstrumentation.idl +++ b/core/inspector/InspectorInstrumentation.idl
@@ -286,7 +286,7 @@ [Resource] void markResourceAsCached(Page*, unsigned long identifier); - [Timeline, Resource, Console] // Console should come AFTER Resource notification, front-end relies on this. + [Timeline, Resource] void didReceiveResourceResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); [Inline=Forward] @@ -340,7 +340,7 @@ [Canvas, Page] void frameDetachedFromParent([Keep] LocalFrame*); - [Console, Resource, DOM, Canvas, Page, PageDebugger] + [Resource, DOM, Canvas, Page, PageDebugger] void didCommitLoad([Keep] LocalFrame*, DocumentLoader*); [DOM, Inline=FastReturn] @@ -392,14 +392,14 @@ void didDispatchDOMStorageEvent(Page* page, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin); [Worker] - void didStartWorkerGlobalScope(ExecutionContext*, WorkerGlobalScopeProxy* proxy, const KURL& url); + void didStartWorker(ExecutionContext*, WorkerInspectorProxy* proxy, const KURL& url); + + [Worker] + void workerTerminated(ExecutionContext*, WorkerInspectorProxy* proxy); [WorkerRuntime] void willEvaluateWorkerScript([Keep] WorkerGlobalScope* context, int workerThreadStartMode); - [Worker] - void workerGlobalScopeTerminated(ExecutionContext*, WorkerGlobalScopeProxy* proxy); - [Profiler, Timeline] void willProcessTask(WorkerGlobalScope* context); @@ -480,20 +480,13 @@ class ConsoleMessage; - // Use the same implementation as above as a similar method dispatched on Page. - [Console] + [Console, Debugger] void addMessageToConsole(ExecutionContext* context, ConsoleMessage* consoleMessage); - [Console, Debugger] - void addConsoleAPIMessageToConsole(ExecutionContext* context, MessageType type, MessageLevel level, const String& message, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier = 0); - - [Console] - void consoleCount(ExecutionContext* context, ScriptState* state, PassRefPtrWillBeRawPtr<ScriptArguments> arguments); - - [Timeline, Console] + [Timeline] void consoleTime([Keep] ExecutionContext* context, const String& title); - [Console, Timeline] + [Timeline] void consoleTimeEnd([Keep] ExecutionContext* context, const String& title, ScriptState* state); [Timeline, Inline=FastReturn] @@ -511,9 +504,8 @@ [Profiler, Inline=FastReturn] void consoleProfileEnd(ExecutionContext* context, const String& title); - //FIXME: remove when we move console message storage from InspectorConsoleAgent to FrameConsole [Console] - void adoptWorkerConsoleMessages(ExecutionContext* context, WorkerGlobalScopeProxy* proxy); + void consoleMessagesCleared(ExecutionContext* context); } interface InspectorOverrides { @@ -522,6 +514,9 @@ [Worker, Inline=FastReturn] bool shouldPauseDedicatedWorkerOnStart(ExecutionContext* context); + + [Resource, Inline=FastReturn] + bool shouldForceCORSPreflight(Document*); }
diff --git a/core/page/EventSource.idl b/core/page/EventSource.idl index 685c569..d96ca6d 100644 --- a/core/page/EventSource.idl +++ b/core/page/EventSource.idl
@@ -32,7 +32,7 @@ [ WillBeGarbageCollected, ActiveDOMObject, - Constructor(DOMString url, optional Dictionary eventSourceInit), + Constructor(DOMString url, optional EventSourceInit eventSourceInit), ConstructorCallWith=ExecutionContext, Exposed=(Window,Worker), RaisesException=Constructor,
diff --git a/core/page/EventSourceInit.idl b/core/page/EventSourceInit.idl new file mode 100644 index 0000000..39c9157 --- /dev/null +++ b/core/page/EventSourceInit.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + GarbageCollected +] dictionary EventSourceInit { + boolean withCredentials = false; +};
diff --git a/core/page/PagePopupController.idl b/core/page/PagePopupController.idl index e2c88b2..6d36d2b 100644 --- a/core/page/PagePopupController.idl +++ b/core/page/PagePopupController.idl
@@ -39,5 +39,6 @@ DOMString localizeNumberString(DOMString numberString); DOMString formatMonth(long year, long zeroBaseMonth); DOMString formatShortMonth(long year, long zeroBaseMonth); + DOMString formatWeek(long year, long weekNumber, DOMString localizedStartDate); void histogramEnumeration(DOMString name, long sample, long boundaryValue); };
diff --git a/core/streams/ReadableStream.idl b/core/streams/ReadableStream.idl index 927fa94..9d299d2 100644 --- a/core/streams/ReadableStream.idl +++ b/core/streams/ReadableStream.idl
@@ -2,8 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +enum ReadableStreamState { + "readable", + "waiting", + "closed", + "errored" +}; + [ RuntimeEnabled=Stream, GarbageCollected ] interface ReadableStream { + [CallWith=ScriptState, RaisesException] any read(); + [CallWith=ScriptState] Promise wait(); + [ImplementedAs=stateString] readonly attribute ReadableStreamState state; + + [CallWith=ScriptState] Promise cancel(any reason); + + [CallWith=ScriptState] readonly attribute Promise closed; };
diff --git a/core/svg/SVGAnimatedAngle.idl b/core/svg/SVGAnimatedAngle.idl index 7fe115c..ae8022d 100644 --- a/core/svg/SVGAnimatedAngle.idl +++ b/core/svg/SVGAnimatedAngle.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedAngle { readonly attribute SVGAngle baseVal;
diff --git a/core/svg/SVGAnimatedBoolean.idl b/core/svg/SVGAnimatedBoolean.idl index daeb710..453172a 100644 --- a/core/svg/SVGAnimatedBoolean.idl +++ b/core/svg/SVGAnimatedBoolean.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), TypeChecking=Interface, ] interface SVGAnimatedBoolean {
diff --git a/core/svg/SVGAnimatedEnumeration.idl b/core/svg/SVGAnimatedEnumeration.idl index 8a4f2d9..f67a59f 100644 --- a/core/svg/SVGAnimatedEnumeration.idl +++ b/core/svg/SVGAnimatedEnumeration.idl
@@ -25,6 +25,7 @@ [ ImplementedAs=SVGAnimatedEnumerationBase, + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), TypeChecking=Interface, ] interface SVGAnimatedEnumeration {
diff --git a/core/svg/SVGAnimatedInteger.idl b/core/svg/SVGAnimatedInteger.idl index 87c2d7f..143c8e3 100644 --- a/core/svg/SVGAnimatedInteger.idl +++ b/core/svg/SVGAnimatedInteger.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), TypeChecking=Interface, ] interface SVGAnimatedInteger {
diff --git a/core/svg/SVGAnimatedLength.idl b/core/svg/SVGAnimatedLength.idl index c741a20..76117af 100644 --- a/core/svg/SVGAnimatedLength.idl +++ b/core/svg/SVGAnimatedLength.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedLength { readonly attribute SVGLength baseVal;
diff --git a/core/svg/SVGAnimatedLengthList.idl b/core/svg/SVGAnimatedLengthList.idl index ec507a3..b7ed587 100644 --- a/core/svg/SVGAnimatedLengthList.idl +++ b/core/svg/SVGAnimatedLengthList.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedLengthList { readonly attribute SVGLengthList baseVal;
diff --git a/core/svg/SVGAnimatedNumber.idl b/core/svg/SVGAnimatedNumber.idl index f941bdf..2468fac 100644 --- a/core/svg/SVGAnimatedNumber.idl +++ b/core/svg/SVGAnimatedNumber.idl
@@ -25,6 +25,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), TypeChecking=Interface, ] interface SVGAnimatedNumber {
diff --git a/core/svg/SVGAnimatedNumberList.idl b/core/svg/SVGAnimatedNumberList.idl index 355e490..cb3210a 100644 --- a/core/svg/SVGAnimatedNumberList.idl +++ b/core/svg/SVGAnimatedNumberList.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedNumberList { readonly attribute SVGNumberList baseVal;
diff --git a/core/svg/SVGAnimatedPreserveAspectRatio.idl b/core/svg/SVGAnimatedPreserveAspectRatio.idl index dbcb42d..c2eb443 100644 --- a/core/svg/SVGAnimatedPreserveAspectRatio.idl +++ b/core/svg/SVGAnimatedPreserveAspectRatio.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedPreserveAspectRatio { readonly attribute SVGPreserveAspectRatio baseVal;
diff --git a/core/svg/SVGAnimatedRect.idl b/core/svg/SVGAnimatedRect.idl index 33a7123..4802de5 100644 --- a/core/svg/SVGAnimatedRect.idl +++ b/core/svg/SVGAnimatedRect.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedRect { readonly attribute SVGRect baseVal;
diff --git a/core/svg/SVGAnimatedString.idl b/core/svg/SVGAnimatedString.idl index dec2f05..b4e6361 100644 --- a/core/svg/SVGAnimatedString.idl +++ b/core/svg/SVGAnimatedString.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedString { [RaisesException=Setter] attribute DOMString baseVal;
diff --git a/core/svg/SVGAnimatedTransformList.idl b/core/svg/SVGAnimatedTransformList.idl index 7a56c32..024a4fc 100644 --- a/core/svg/SVGAnimatedTransformList.idl +++ b/core/svg/SVGAnimatedTransformList.idl
@@ -24,6 +24,7 @@ */ [ + NotScriptWrappable, SetWrapperReferenceTo(SVGElement contextElement), ] interface SVGAnimatedTransformList { readonly attribute SVGTransformList baseVal;
diff --git a/core/svg/SVGRenderingIntent.idl b/core/svg/SVGRenderingIntent.idl index 2cdc2f4..1c47a29 100644 --- a/core/svg/SVGRenderingIntent.idl +++ b/core/svg/SVGRenderingIntent.idl
@@ -25,6 +25,7 @@ [ DependentLifetime, + WillBeGarbageCollected ] interface SVGRenderingIntent { // Rendering Intent Types const unsigned short RENDERING_INTENT_UNKNOWN = 0;
diff --git a/core/svg/SVGUnitTypes.idl b/core/svg/SVGUnitTypes.idl index 95c2a49..651d740 100644 --- a/core/svg/SVGUnitTypes.idl +++ b/core/svg/SVGUnitTypes.idl
@@ -25,6 +25,7 @@ [ DependentLifetime, + WillBeGarbageCollected ] interface SVGUnitTypes { // Unit Types const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;
diff --git a/core/testing/DictionaryTest.idl b/core/testing/DictionaryTest.idl new file mode 100644 index 0000000..d347e99 --- /dev/null +++ b/core/testing/DictionaryTest.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + GarbageCollected +] interface DictionaryTest { + void set(optional InternalDictionary testingDictionary); + InternalDictionary get(); +};
diff --git a/core/testing/GCObservation.idl b/core/testing/GCObservation.idl index 378b055..ba754c0 100644 --- a/core/testing/GCObservation.idl +++ b/core/testing/GCObservation.idl
@@ -29,7 +29,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ] interface GCObservation { // Technically, this is true if the object was "near death"; the // object may have been kept alive through a weak handle. Having
diff --git a/core/testing/InternalDictionary.idl b/core/testing/InternalDictionary.idl new file mode 100644 index 0000000..d0c4e60 --- /dev/null +++ b/core/testing/InternalDictionary.idl
@@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +enum InternalEnum { "foo", "bar", "baz" }; + +[ + GarbageCollected +] dictionary InternalDictionary { + long longMember; + long longMemberWithDefault = 42; + long? longOrNullMember; + long? longOrNullMemberWithDefault = null; + boolean booleanMember; + double doubleMember; + DOMString stringMember; + DOMString stringMemberWithDefault = "defaultStringValue"; + sequence<DOMString> stringSequenceMember; + sequence<DOMString>? stringSequenceOrNullMember; + InternalEnum enumMember; + InternalEnum enumMemberWithDefault = "foo"; + InternalEnum? enumOrNullMember; + Element elementMember; + Element? elementOrNullMember; + object objectMember; + object? objectOrNullMemberWithDefault = null; +};
diff --git a/core/testing/InternalProfilers.idl b/core/testing/InternalProfilers.idl index c73eb1a..8387baf 100644 --- a/core/testing/InternalProfilers.idl +++ b/core/testing/InternalProfilers.idl
@@ -29,7 +29,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ] interface InternalProfilers { void startHeapProfiling(DOMString prefix); void stopHeapProfiling();
diff --git a/core/testing/InternalSettings.idl b/core/testing/InternalSettings.idl index dabbbb4..b04e925 100644 --- a/core/testing/InternalSettings.idl +++ b/core/testing/InternalSettings.idl
@@ -45,6 +45,10 @@ [RaisesException] void setImagesEnabled(boolean enabled); [RaisesException] void setDefaultVideoPosterURL(DOMString poster); [RaisesException] void setViewportEnabled(boolean enabled); + [RaisesException] void setAvailablePointerTypes(DOMString pointers); + [RaisesException] void setPrimaryPointerType(DOMString pointer); + [RaisesException] void setAvailableHoverTypes(DOMString types); + [RaisesException] void setPrimaryHoverType(DOMString type); // FIXME: This is a temporary flag and should be removed once squashing is // ready (crbug.com/261605).
diff --git a/core/testing/Internals.idl b/core/testing/Internals.idl index 675dfbc..1535447 100644 --- a/core/testing/Internals.idl +++ b/core/testing/Internals.idl
@@ -26,7 +26,8 @@ [ DoNotCheckConstants, - WillBeGarbageCollected, + GarbageCollected, + Iterable, ] interface Internals { DOMString address(Node node); @@ -36,12 +37,6 @@ boolean isPreloaded(DOMString url); boolean isLoadingFromMemoryCache(DOMString url); - void crash(); - - void setStyleResolverStatsEnabled(boolean enabled); - [RaisesException] DOMString styleResolverStatsReport(); - [RaisesException] DOMString styleResolverStatsTotalsReport(); - [TypeChecking=Interface] boolean isSharingStyle(Element element1, Element element2); [TypeChecking=Interface] CSSStyleDeclaration computedStyleIncludingVisitedInfo(Node node); @@ -56,7 +51,6 @@ [RaisesException] boolean hasContentElement(Node root); [RaisesException, TypeChecking=Interface] unsigned long countElementShadow(Node Root); [TypeChecking=Interface] DOMString shadowPseudoId(Element element); - [TypeChecking=Interface] void setShadowPseudoId(Element element, DOMString id); [RaisesException, TypeChecking=Interface] boolean isValidContentSelect(Element contentElement); [TypeChecking=Interface] Node treeScopeRootNode(Node node); [TypeChecking=Interface] Node parentTreeScope(Node node); @@ -81,6 +75,7 @@ DOMString visiblePlaceholder(Element element); [TypeChecking=Interface] void selectColorInColorChooser(Element element, DOMString colorValue); + [TypeChecking=Interface] void endColorChooser(Element element); // If the argument is omitted, the top-level document is used. boolean hasAutofocusRequest(optional Document document); @@ -89,8 +84,6 @@ [RaisesException] void setEnableMockPagePopup(boolean enabled); readonly attribute PagePopupController pagePopupController; - [RaisesException] ClientRect unscaledViewportRect(); - [RaisesException] ClientRect absoluteCaretBounds(); [TypeChecking=Interface] ClientRect boundingBox(Element element); @@ -124,9 +117,9 @@ [TypeChecking=Interface] unsigned long lengthFromRange(Element scope, Range range); [TypeChecking=Interface] DOMString rangeAsText(Range range); - [RaisesException, TypeChecking=Interface] WebKitPoint touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document document); + [RaisesException, TypeChecking=Interface] DOMPoint touchPositionAdjustedToBestClickableNode(long x, long y, long width, long height, Document document); [RaisesException, TypeChecking=Interface] Node touchNodeAdjustedToBestClickableNode(long x, long y, long width, long height, Document document); - [RaisesException, TypeChecking=Interface] WebKitPoint touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document); + [RaisesException, TypeChecking=Interface] DOMPoint touchPositionAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document); [RaisesException, TypeChecking=Interface] Node touchNodeAdjustedToBestContextMenuNode(long x, long y, long width, long height, Document document); [RaisesException, TypeChecking=Interface] ClientRect bestZoomableAreaForTouchPoint(long x, long y, long width, long height, Document document); @@ -147,9 +140,6 @@ unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding, boolean ignoreClipping, boolean allowChildFrameContent); - void emitInspectorDidBeginFrame(optional long frameId); - void emitInspectorDidCancelFrame(); - [TypeChecking=Interface] boolean hasSpellingMarker(Document document, long from, long length); [TypeChecking=Interface] boolean hasGrammarMarker(Document document, long from, long length); void setContinuousSpellCheckingEnabled(boolean enabled); @@ -206,6 +196,7 @@ void mediaPlayerRequestFullscreen(HTMLMediaElement mediaElement); double effectiveMediaVolume(HTMLMediaElement mediaElement); + void mediaPlayerRemoteRouteAvailabilityChanged(HTMLMediaElement mediaElement, boolean available); void registerURLSchemeAsBypassingContentSecurityPolicy(DOMString scheme); void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(DOMString scheme); @@ -240,8 +231,6 @@ [TypeChecking=Interface] DOMString markerTextForListItem(Element element); - [TypeChecking=Interface] DOMString baseURL(Document document); - SerializedScriptValue deserializeBuffer(ArrayBuffer buffer); ArrayBuffer serializeObject(SerializedScriptValue obj); @@ -288,4 +277,9 @@ DOMString serializeNavigationMarkup(); void hideAllTransitionElements(); + + [RaisesException, TypeChecking=Interface] void forcePluginPlaceholder(HTMLElement plugin, DOMString htmlSource); + [RaisesException, TypeChecking=Interface] void forcePluginPlaceholder(HTMLElement plugin, Dictionary options); + + DictionaryTest dictionaryTest(); };
diff --git a/core/testing/LayerRect.idl b/core/testing/LayerRect.idl index effc2e6..1bf1154 100644 --- a/core/testing/LayerRect.idl +++ b/core/testing/LayerRect.idl
@@ -29,7 +29,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ] interface LayerRect { /* The node that most closely represents the layer in which the rect occurs. When a layer doesn't correspond directly to a node (eg.
diff --git a/core/testing/LayerRectList.idl b/core/testing/LayerRectList.idl index ffe74d3..566be6e 100644 --- a/core/testing/LayerRectList.idl +++ b/core/testing/LayerRectList.idl
@@ -29,7 +29,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ] interface LayerRectList { readonly attribute unsigned long length; getter LayerRect item(unsigned long index);
diff --git a/core/testing/PartialPrivateScriptTest.idl b/core/testing/PartialPrivateScriptTest.idl index b19d17f..5175774 100644 --- a/core/testing/PartialPrivateScriptTest.idl +++ b/core/testing/PartialPrivateScriptTest.idl
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -partial interface PrivateScriptTest { +[ + NoImplHeader +] partial interface PrivateScriptTest { [ImplementedInPrivateScript] short addIntegerInPartial(short value1, short value2); [ImplementedInPrivateScript] short addInteger2InPartial(short value1, short value2); [ImplementedInPrivateScript] attribute DOMString stringAttributeInPartial;
diff --git a/core/testing/PrivateScriptTest.idl b/core/testing/PrivateScriptTest.idl index 20fca89..769aa5f 100644 --- a/core/testing/PrivateScriptTest.idl +++ b/core/testing/PrivateScriptTest.idl
@@ -35,11 +35,12 @@ [ImplementedInPrivateScript] void voidMethodThrowsRangeError(); [ImplementedInPrivateScript] void voidMethodThrowsSyntaxError(); [ImplementedInPrivateScript] void voidMethodThrowsReferenceError(); - [ImplementedInPrivateScript] void voidMethodWithStackOverflow(); + [ImplementedInPrivateScript] void voidMethodThrowsStackOverflowError(); [ImplementedInPrivateScript, OnlyExposedToPrivateScript] short addIntegerForPrivateScriptOnly(short value1, short value2); [ImplementedInPrivateScript, OnlyExposedToPrivateScript] attribute DOMString stringAttributeForPrivateScriptOnly; [ImplementedInPrivateScript] short addIntegerImplementedInCPP(short value1, short value2); [OnlyExposedToPrivateScript] short addIntegerImplementedInCPPForPrivateScriptOnly(short value1, short value2); [ImplementedInPrivateScript] attribute DOMString stringAttributeImplementedInCPP; [OnlyExposedToPrivateScript] attribute DOMString stringAttributeImplementedInCPPForPrivateScriptOnly; + [ImplementedInPrivateScript] void dispatchDocumentOnload(Document document); };
diff --git a/core/testing/TypeConversions.idl b/core/testing/TypeConversions.idl index ffaa21e..ba3e99a 100644 --- a/core/testing/TypeConversions.idl +++ b/core/testing/TypeConversions.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ] interface TypeConversions { attribute long testLong; [EnforceRange, ImplementedAs=testLong] attribute long testEnforceRangeLong;
diff --git a/core/timing/PerformanceEntry.idl b/core/timing/PerformanceEntry.idl index 06d8222..8e382cd 100644 --- a/core/timing/PerformanceEntry.idl +++ b/core/timing/PerformanceEntry.idl
@@ -31,7 +31,6 @@ // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html [ WillBeGarbageCollected, - Custom=Wrap, ] interface PerformanceEntry { readonly attribute DOMString name; readonly attribute DOMString entryType;
diff --git a/core/xml/DocumentXMLTreeViewer.idl b/core/xml/DocumentXMLTreeViewer.idl new file mode 100644 index 0000000..150d440 --- /dev/null +++ b/core/xml/DocumentXMLTreeViewer.idl
@@ -0,0 +1,9 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + NoImplHeader +] partial interface Document { + [ImplementedInPrivateScript, OnlyExposedToPrivateScript] void transformDocumentToTreeView(DOMString noStyleMessage); +};
diff --git a/core/xml/XMLHttpRequest.idl b/core/xml/XMLHttpRequest.idl index 6147be4..4facb56 100644 --- a/core/xml/XMLHttpRequest.idl +++ b/core/xml/XMLHttpRequest.idl
@@ -33,7 +33,8 @@ "document", "json", "text", - "legacystream" + "legacystream", + "stream" }; [ @@ -88,5 +89,5 @@ readonly attribute DOMString statusText; // Extension - void overrideMimeType(DOMString override); + [RaisesException] void overrideMimeType(DOMString override); };
diff --git a/core/xml/XMLHttpRequestProgressEvent.idl b/core/xml/XMLHttpRequestProgressEvent.idl index a28d64b..41bed63 100644 --- a/core/xml/XMLHttpRequestProgressEvent.idl +++ b/core/xml/XMLHttpRequestProgressEvent.idl
@@ -25,7 +25,7 @@ // We should also inherit from LSProgressEvent when the idl is added. interface XMLHttpRequestProgressEvent : ProgressEvent { - [MeasureAs=XHRProgressEventPosition] readonly attribute unsigned long long position; - [MeasureAs=XHRProgressEventTotalSize] readonly attribute unsigned long long totalSize; + [DeprecateAs=XHRProgressEventPosition] readonly attribute unsigned long long position; + [DeprecateAs=XHRProgressEventTotalSize] readonly attribute unsigned long long totalSize; };
diff --git a/core/xml/XSLTProcessor.idl b/core/xml/XSLTProcessor.idl index dc51a60..f8d3b1d 100644 --- a/core/xml/XSLTProcessor.idl +++ b/core/xml/XSLTProcessor.idl
@@ -33,6 +33,7 @@ [ WillBeGarbageCollected, Constructor, + ConstructorCallWith=Document, RuntimeEnabled=XSLT, MeasureAs=XSLTProcessor ] interface XSLTProcessor {
diff --git a/modules/README b/modules/README index 1a601a7..418d1e5 100644 --- a/modules/README +++ b/modules/README
@@ -6,4 +6,4 @@ The current version corresponds to: URL: http://src.chromium.org/blink/branches/dart/dartium -Current revision: 182210 +Current revision: 190578
diff --git a/modules/credentialmanager/CredentialsContainer.idl b/modules/credentialmanager/CredentialsContainer.idl index 64ecde0..43497bc 100644 --- a/modules/credentialmanager/CredentialsContainer.idl +++ b/modules/credentialmanager/CredentialsContainer.idl
@@ -7,7 +7,7 @@ GarbageCollected ] interface CredentialsContainer { [CallWith=ScriptState] Promise request(optional Dictionary options); - [CallWith=ScriptState] Promise notifySignedIn(optional Credential credential); - [CallWith=ScriptState] Promise notifyFailedSignIn(optional Credential credential); + [CallWith=ScriptState] Promise notifySignedIn(Credential credential); + [CallWith=ScriptState] Promise notifyFailedSignIn(Credential credential); [CallWith=ScriptState] Promise notifySignedOut(); };
diff --git a/modules/device_orientation/DeviceAcceleration.idl b/modules/device_orientation/DeviceAcceleration.idl index 6ad701c..827bc46 100644 --- a/modules/device_orientation/DeviceAcceleration.idl +++ b/modules/device_orientation/DeviceAcceleration.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface DeviceAcceleration { readonly attribute double? x;
diff --git a/modules/device_orientation/DeviceRotationRate.idl b/modules/device_orientation/DeviceRotationRate.idl index 71d299f..117c8b6 100644 --- a/modules/device_orientation/DeviceRotationRate.idl +++ b/modules/device_orientation/DeviceRotationRate.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, NoInterfaceObject ] interface DeviceRotationRate { readonly attribute double? alpha;
diff --git a/modules/encoding/TextDecodeOptions.idl b/modules/encoding/TextDecodeOptions.idl new file mode 100644 index 0000000..a4e0974 --- /dev/null +++ b/modules/encoding/TextDecodeOptions.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://encoding.spec.whatwg.org/#textdecoder + +[ + GarbageCollected +] dictionary TextDecodeOptions { + boolean stream = false; +};
diff --git a/modules/encoding/TextDecoder.idl b/modules/encoding/TextDecoder.idl index af0ffac..977a865 100644 --- a/modules/encoding/TextDecoder.idl +++ b/modules/encoding/TextDecoder.idl
@@ -31,7 +31,7 @@ [ RuntimeEnabled=EncodingAPI, Exposed=(Window,Worker), - Constructor(optional DOMString label = "utf-8", optional Dictionary options), + Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), RaisesException=Constructor, GarbageCollected, MeasureAs=TextDecoderConstructor @@ -39,5 +39,5 @@ readonly attribute DOMString encoding; readonly attribute boolean fatal; readonly attribute boolean ignoreBOM; - [RaisesException, MeasureAs=TextDecoderDecode] DOMString decode(optional ArrayBufferView input, optional Dictionary options); + [RaisesException, MeasureAs=TextDecoderDecode] DOMString decode(optional ArrayBufferView input, optional TextDecodeOptions options); };
diff --git a/modules/encoding/TextDecoderOptions.idl b/modules/encoding/TextDecoderOptions.idl new file mode 100644 index 0000000..c222515 --- /dev/null +++ b/modules/encoding/TextDecoderOptions.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://encoding.spec.whatwg.org/#textdecoder + +[ + GarbageCollected +] dictionary TextDecoderOptions { + boolean fatal = false; + boolean ignoreBOM = false; +};
diff --git a/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl b/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl index ed94199..b275832 100644 --- a/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl +++ b/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl
@@ -13,6 +13,6 @@ [RuntimeEnabled=PrefixedEncryptedMedia] attribute EventHandler onwebkitneedkey; [RuntimeEnabled=EncryptedMedia] readonly attribute MediaKeys mediaKeys; - [RuntimeEnabled=EncryptedMedia, RaisesException, TypeChecking=Interface] void setMediaKeys(MediaKeys? mediaKeys); + [RuntimeEnabled=EncryptedMedia, TypeChecking=Interface, CallWith=ScriptState] Promise setMediaKeys(MediaKeys? mediaKeys); [RuntimeEnabled=EncryptedMedia] attribute EventHandler onneedkey; };
diff --git a/modules/encryptedmedia/MediaKeySession.idl b/modules/encryptedmedia/MediaKeySession.idl index 9126d3b..acf3177 100644 --- a/modules/encryptedmedia/MediaKeySession.idl +++ b/modules/encryptedmedia/MediaKeySession.idl
@@ -37,6 +37,10 @@ readonly attribute DOMString sessionId; [CallWith=ScriptState] readonly attribute Promise closed; + // session initialization + [CallWith=ScriptState] Promise generateRequest(DOMString initDataType, ArrayBuffer initData); + [CallWith=ScriptState] Promise generateRequest(DOMString initDataType, ArrayBufferView initData); + // session operations [CallWith=ScriptState] Promise update(ArrayBuffer response); [CallWith=ScriptState] Promise update(ArrayBufferView response);
diff --git a/modules/encryptedmedia/MediaKeys.idl b/modules/encryptedmedia/MediaKeys.idl index 05dded4..14a542d 100644 --- a/modules/encryptedmedia/MediaKeys.idl +++ b/modules/encryptedmedia/MediaKeys.idl
@@ -35,9 +35,9 @@ ] interface MediaKeys { readonly attribute DOMString keySystem; + [CallWith=ScriptState] MediaKeySession createSession(optional SessionType sessionType = "temporary"); + [CallWith=ScriptState] static Promise create(DOMString keySystem); - [CallWith=ScriptState] Promise createSession(DOMString initDataType, ArrayBuffer initData, optional SessionType sessionType = "temporary"); - [CallWith=ScriptState] Promise createSession(DOMString initDataType, ArrayBufferView initData, optional SessionType sessionType = "temporary"); static boolean isTypeSupported(DOMString keySystem, optional DOMString contentType = null); };
diff --git a/modules/geofencing/CircularRegion.idl b/modules/geofencing/CircularGeofencingRegion.idl similarity index 88% rename from modules/geofencing/CircularRegion.idl rename to modules/geofencing/CircularGeofencingRegion.idl index 19278fd..1ddf454 100644 --- a/modules/geofencing/CircularRegion.idl +++ b/modules/geofencing/CircularGeofencingRegion.idl
@@ -7,7 +7,7 @@ Exposed=(Window,Worker), GarbageCollected, Constructor(Dictionary init) -] interface CircularRegion : GeofencingRegion { +] interface CircularGeofencingRegion : GeofencingRegion { const double MIN_RADIUS = 1.0; const double MAX_RADIUS = 100.0;
diff --git a/modules/geofencing/GeofencingRegion.idl b/modules/geofencing/GeofencingRegion.idl index 4e22058..32d3d3c 100644 --- a/modules/geofencing/GeofencingRegion.idl +++ b/modules/geofencing/GeofencingRegion.idl
@@ -4,6 +4,7 @@ [ RuntimeEnabled=Geofencing, + SpecialWrapFor=CircularGeofencingRegion, NoInterfaceObject, GarbageCollected, ] interface GeofencingRegion {
diff --git a/modules/geofencing/WorkerNavigatorGeofencing.idl b/modules/geofencing/WorkerNavigatorGeofencing.idl new file mode 100644 index 0000000..bfcbe18 --- /dev/null +++ b/modules/geofencing/WorkerNavigatorGeofencing.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +[ + RuntimeEnabled=Geofencing, + Exposed=Worker, +] partial interface WorkerNavigator { + readonly attribute Geofencing geofencing; +};
diff --git a/modules/indexeddb/IDBDatabase.idl b/modules/indexeddb/IDBDatabase.idl index bb9c038..36ab560 100644 --- a/modules/indexeddb/IDBDatabase.idl +++ b/modules/indexeddb/IDBDatabase.idl
@@ -43,9 +43,9 @@ [RaisesException] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options); [RaisesException] void deleteObjectStore(DOMString name); // FIXME: should be union type http://crbug.com/240176 - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMString storeName, optional IDBTransactionMode mode = "readonly"); - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, optional IDBTransactionMode mode = "readonly"); - [CallWith=ExecutionContext, RaisesException] IDBTransaction transaction(DOMStringList storeNames, optional IDBTransactionMode mode = "readonly"); + [CallWith=ScriptState, RaisesException] IDBTransaction transaction(DOMString storeName, optional IDBTransactionMode mode = "readonly"); + [CallWith=ScriptState, RaisesException] IDBTransaction transaction(sequence<DOMString> storeNames, optional IDBTransactionMode mode = "readonly"); + [CallWith=ScriptState, RaisesException] IDBTransaction transaction(DOMStringList storeNames, optional IDBTransactionMode mode = "readonly"); void close(); attribute EventHandler onabort; attribute EventHandler onclose;
diff --git a/modules/indexeddb/IDBIndexParameters.idl b/modules/indexeddb/IDBIndexParameters.idl new file mode 100644 index 0000000..199d45c --- /dev/null +++ b/modules/indexeddb/IDBIndexParameters.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#options-object-concept + +[ + GarbageCollected +] dictionary IDBIndexParameters { + boolean unique = false; + boolean multiEntry = false; +};
diff --git a/modules/indexeddb/IDBObjectStore.idl b/modules/indexeddb/IDBObjectStore.idl index a22fc74..2afdfe4 100644 --- a/modules/indexeddb/IDBObjectStore.idl +++ b/modules/indexeddb/IDBObjectStore.idl
@@ -50,8 +50,8 @@ [CallWith=ScriptState, RaisesException] IDBRequest openCursor([Default=Undefined] optional any range, optional DOMString direction = "next"); [CallWith=ScriptState, RaisesException, RuntimeEnabled=IndexedDBExperimental] IDBRequest openKeyCursor([Default=Undefined] optional any range, optional IDBCursorDirection direction = "next"); // FIXME: should be union type http://crbug.com/240176 - [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional Dictionary options); - [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional Dictionary options); + [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, DOMString keyPath, optional IDBIndexParameters options); + [CallWith=ScriptState, RaisesException] IDBIndex createIndex(DOMString name, sequence<DOMString> keyPath, optional IDBIndexParameters options); [RaisesException] IDBIndex index(DOMString name); [RaisesException] void deleteIndex(DOMString name); [CallWith=ScriptState, RaisesException] IDBRequest count([Default=Undefined] optional any key);
diff --git a/modules/mediasource/MediaSource.idl b/modules/mediasource/MediaSource.idl index 0a946ba..1863acb 100644 --- a/modules/mediasource/MediaSource.idl +++ b/modules/mediasource/MediaSource.idl
@@ -40,7 +40,7 @@ Constructor, ConstructorCallWith=ExecutionContext, RuntimeEnabled=MediaSource, - TypeChecking=Interface|Unrestricted, + TypeChecking=(Interface,Unrestricted), ] interface MediaSource : EventTarget { // All the source buffers created by this object. readonly attribute SourceBufferList sourceBuffers;
diff --git a/modules/mediasource/SourceBuffer.idl b/modules/mediasource/SourceBuffer.idl index a29f0fa..321daf7 100644 --- a/modules/mediasource/SourceBuffer.idl +++ b/modules/mediasource/SourceBuffer.idl
@@ -39,7 +39,7 @@ ActiveDOMObject, NoInterfaceObject, RuntimeEnabled=MediaSource, - TypeChecking=Interface|Unrestricted, + TypeChecking=(Interface,Unrestricted), ] interface SourceBuffer : EventTarget { // Gets or sets the AppendMode.
diff --git a/modules/mediastream/MediaStream.idl b/modules/mediastream/MediaStream.idl index 171b878..14cf0f5 100644 --- a/modules/mediastream/MediaStream.idl +++ b/modules/mediastream/MediaStream.idl
@@ -33,7 +33,7 @@ NoInterfaceObject, ] interface MediaStream : EventTarget { // DEPRECATED - readonly attribute DOMString label; + [MeasureAs=MediaStreamLabel] readonly attribute DOMString label; readonly attribute DOMString id; @@ -45,11 +45,11 @@ [RaisesException] void removeTrack(MediaStreamTrack track); MediaStreamTrack getTrackById(DOMString trackId); [CallWith=ExecutionContext] MediaStream clone(); - - readonly attribute boolean ended; + // DEPRECATED + [MeasureAs=MediaStreamEnded] readonly attribute boolean ended; // DEPRECATED - void stop(); + [MeasureAs=MediaStreamStop] void stop(); attribute EventHandler onended; attribute EventHandler onaddtrack;
diff --git a/modules/netinfo/NetworkInformation.idl b/modules/netinfo/NetworkInformation.idl index 8a4f848..166c2b5 100644 --- a/modules/netinfo/NetworkInformation.idl +++ b/modules/netinfo/NetworkInformation.idl
@@ -15,7 +15,7 @@ [ RuntimeEnabled=NetworkInformation, Exposed=(Window,Worker), - WillBeGarbageCollected, + GarbageCollected, ActiveDOMObject ] interface NetworkInformation : EventTarget { readonly attribute ConnectionType type;
diff --git a/modules/notifications/Notification.idl b/modules/notifications/Notification.idl index 51a26d9..ebf279d 100644 --- a/modules/notifications/Notification.idl +++ b/modules/notifications/Notification.idl
@@ -32,12 +32,13 @@ [ GarbageCollected, ActiveDOMObject, - Constructor(DOMString title, [Default=Undefined] optional Dictionary options), + Constructor(DOMString title, optional NotificationOptions options), ConstructorCallWith=ExecutionContext, + MeasureAs=NotificationCreated, RuntimeEnabled=Notifications, ] interface Notification : EventTarget { - [CallWith=ExecutionContext] static readonly attribute DOMString permission; - [CallWith=ExecutionContext] static void requestPermission(optional NotificationPermissionCallback callback); + [CallWith=ExecutionContext, MeasureAs=NotificationPermission] static readonly attribute DOMString permission; + [CallWith=ExecutionContext, MeasureAs=NotificationPermissionRequested] static void requestPermission(optional NotificationPermissionCallback callback); // FIXME: Implement the Notification.get() method. @@ -53,5 +54,5 @@ readonly attribute DOMString tag; readonly attribute DOMString icon; - void close(); + [MeasureAs=NotificationClosed] void close(); };
diff --git a/modules/notifications/NotificationOptions.idl b/modules/notifications/NotificationOptions.idl new file mode 100644 index 0000000..8230322 --- /dev/null +++ b/modules/notifications/NotificationOptions.idl
@@ -0,0 +1,21 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://notifications.spec.whatwg.org/#api + +enum NotificationDirection { + "auto", + "ltr", + "rtl" +}; + +[ + GarbageCollected +] dictionary NotificationOptions { + NotificationDirection dir = "auto"; + DOMString lang = ""; + DOMString body = ""; + DOMString tag = ""; + DOMString icon; +};
diff --git a/modules/performance/SharedWorkerPerformance.idl b/modules/performance/SharedWorkerPerformance.idl index ef8b36b..cef9493 100644 --- a/modules/performance/SharedWorkerPerformance.idl +++ b/modules/performance/SharedWorkerPerformance.idl
@@ -27,9 +27,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=HighResolutionTimeInWorkers, -] partial interface SharedWorker { +partial interface SharedWorker { // See https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime2/Overview.html for details. [CallWith=ExecutionContext] readonly attribute double workerStart; };
diff --git a/modules/performance/WorkerGlobalScopePerformance.idl b/modules/performance/WorkerGlobalScopePerformance.idl index 0bbe715..559003a 100644 --- a/modules/performance/WorkerGlobalScopePerformance.idl +++ b/modules/performance/WorkerGlobalScopePerformance.idl
@@ -28,8 +28,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=HighResolutionTimeInWorkers, -] partial interface WorkerGlobalScope { +partial interface WorkerGlobalScope { readonly attribute WorkerPerformance performance; };
diff --git a/modules/presentation/NavigatorPresentation.idl b/modules/presentation/NavigatorPresentation.idl new file mode 100644 index 0000000..4cf7e1e --- /dev/null +++ b/modules/presentation/NavigatorPresentation.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://webscreens.github.io/presentation-api/#presentation-extension-to-navigator + +[ + RuntimeEnabled=Presentation +] partial interface Navigator { + readonly attribute Presentation presentation; +};
diff --git a/modules/presentation/Presentation.idl b/modules/presentation/Presentation.idl new file mode 100644 index 0000000..1546a1d --- /dev/null +++ b/modules/presentation/Presentation.idl
@@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://webscreens.github.io/presentation-api/#presentation-interface + +[ + GarbageCollected, + RuntimeEnabled=Presentation +] interface Presentation : EventTarget { + attribute EventHandler onavailablechange; +};
diff --git a/modules/serviceworkers/Body.idl b/modules/serviceworkers/Body.idl new file mode 100644 index 0000000..bb06579 --- /dev/null +++ b/modules/serviceworkers/Body.idl
@@ -0,0 +1,21 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://fetch.spec.whatwg.org/#body +[ + RuntimeEnabled=ServiceWorker, + Exposed=ServiceWorker, + NoInterfaceObject, + ActiveDOMObject, + GarbageCollected, +] interface Body { + readonly attribute boolean bodyUsed; + [CallWith=ScriptState] Promise arrayBuffer(); + [CallWith=ScriptState] Promise blob(); + [CallWith=ScriptState] Promise json(); + [CallWith=ScriptState] Promise text(); + + // Still to be implemented. + // [CallWith=ScriptState] Promise formData(); +};
diff --git a/modules/serviceworkers/Cache.idl b/modules/serviceworkers/Cache.idl index 5f44e41..6da74e9 100644 --- a/modules/serviceworkers/Cache.idl +++ b/modules/serviceworkers/Cache.idl
@@ -4,32 +4,20 @@ // See https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache -// FIXME: Blink doesn't support dictionary definitions. For now, we can use the -// Dictionary interface. See http://crbug.com/321462 - -// dictionary QueryParams { -// boolean ignoreSearch; -// boolean ignoreMethod; -// boolean ignoreVary; -// boolean prefixMatch; -// DOMString cacheName; -// }; - [ - WillBeGarbageCollected, - NoInterfaceObject, + GarbageCollected, Exposed=ServiceWorker, - RuntimeEnabled=ServiceWorker, + RuntimeEnabled=ServiceWorkerOnFetch, ] interface Cache { // FIXME: Blink doesn't support union types, we use overrides instead. See http://crbug.com/240176 - // [CallWith=ScriptState] Promise match((Request or ScalarValueString) request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise match(Request request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise match(ScalarValueString request, optional Dictionary queryParams); + // [CallWith=ScriptState] Promise match((Request or ScalarValueString) request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise match(Request request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise match(ScalarValueString request, optional QueryParams queryParams); - // [CallWith=ScriptState] Promise matchAll((Request or ScalarValueString) request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise matchAll(Request request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise matchAll(ScalarValueString request, optional Dictionary queryParams); + // [CallWith=ScriptState] Promise matchAll((Request or ScalarValueString) request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise matchAll(Request request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise matchAll(ScalarValueString request, optional QueryParams queryParams); // [CallWith=ScriptState] Promise add((Request or ScalarValueString) request); [CallWith=ScriptState] Promise add(Request request); @@ -44,11 +32,11 @@ [CallWith=ScriptState] Promise put(Request request, Response response); [CallWith=ScriptState] Promise put(ScalarValueString request, Response response); - // [CallWith=ScriptState] Promise delete((Request or ScalarValueString) request, optional Dictionary queryParams); - [CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(Request request, optional Dictionary queryParams); - [CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(ScalarValueString request, optional Dictionary queryParams); + // [CallWith=ScriptState] Promise delete((Request or ScalarValueString) request, optional QueryParams queryParams); + [CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(Request request, optional QueryParams queryParams); + [CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(ScalarValueString request, optional QueryParams queryParams); - // [CallWith=ScriptState] Promise keys(optional (Request or ScalarValueString) request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise keys(optional Request request, optional Dictionary queryParams); - [CallWith=ScriptState] Promise keys(ScalarValueString request, optional Dictionary queryParams); + // [CallWith=ScriptState] Promise keys(optional (Request or ScalarValueString) request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise keys(optional Request request, optional QueryParams queryParams); + [CallWith=ScriptState] Promise keys(ScalarValueString request, optional QueryParams queryParams); };
diff --git a/modules/serviceworkers/CacheStorage.idl b/modules/serviceworkers/CacheStorage.idl index 35b5393..c36ce34 100644 --- a/modules/serviceworkers/CacheStorage.idl +++ b/modules/serviceworkers/CacheStorage.idl
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// See https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage [ - WillBeGarbageCollected, - NoInterfaceObject, + GarbageCollected, Exposed=ServiceWorker, - RuntimeEnabled=ServiceWorker, + RuntimeEnabled=ServiceWorkerOnFetch, ] interface CacheStorage { [CallWith=ScriptState] Promise get(ScalarValueString cacheName); [CallWith=ScriptState] Promise has(ScalarValueString cacheName);
diff --git a/modules/serviceworkers/InstallPhaseEvent.idl b/modules/serviceworkers/ExtendableEvent.idl similarity index 95% rename from modules/serviceworkers/InstallPhaseEvent.idl rename to modules/serviceworkers/ExtendableEvent.idl index 9f2637f..c6a2b5f 100644 --- a/modules/serviceworkers/InstallPhaseEvent.idl +++ b/modules/serviceworkers/ExtendableEvent.idl
@@ -28,10 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#install-phase-event-interface +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#extendable-event-interface [ RuntimeEnabled=ServiceWorker, Exposed=ServiceWorker, -] interface InstallPhaseEvent : Event { +] interface ExtendableEvent : Event { [CallWith=ScriptState] void waitUntil(any value); };
diff --git a/modules/serviceworkers/FetchBodyStream.idl b/modules/serviceworkers/FetchBodyStream.idl deleted file mode 100644 index 7c1c3fb..0000000 --- a/modules/serviceworkers/FetchBodyStream.idl +++ /dev/null
@@ -1,21 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// http://fetch.spec.whatwg.org/#fetchbodystream -[ - RuntimeEnabled=ServiceWorker, - Exposed=ServiceWorker, - NoInterfaceObject, - ActiveDOMObject, - WillBeGarbageCollected, -] interface FetchBodyStream { - [CallWith=ScriptState] Promise asArrayBuffer(); - [CallWith=ScriptState] Promise asBlob(); - [CallWith=ScriptState] Promise asJSON(); - [CallWith=ScriptState] Promise asText(); - - // Still to be implemented. - // [CallWith=ScriptState] Promise asFormData(); -}; -
diff --git a/modules/serviceworkers/FetchEvent.idl b/modules/serviceworkers/FetchEvent.idl index d425143..88bf9e1 100644 --- a/modules/serviceworkers/FetchEvent.idl +++ b/modules/serviceworkers/FetchEvent.idl
@@ -4,11 +4,11 @@ // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#fetch-event-interface [ - RuntimeEnabled=ServiceWorker, + RuntimeEnabled=ServiceWorkerOnFetch, Exposed=ServiceWorker ] interface FetchEvent : Event { readonly attribute Request request; readonly attribute boolean isReload; - [CallWith=ScriptState] void respondWith(any value); + [CallWith=ScriptState, RaisesException] void respondWith(any value); };
diff --git a/modules/serviceworkers/Headers.idl b/modules/serviceworkers/Headers.idl index efcbc3b..1b29e74 100644 --- a/modules/serviceworkers/Headers.idl +++ b/modules/serviceworkers/Headers.idl
@@ -3,14 +3,15 @@ // found in the LICENSE file. // http://fetch.spec.whatwg.org/#headers-class +typedef Dictionary OpenEndedDictionary; [ Constructor, Constructor(Headers input), - Constructor(Dictionary input), + Constructor(OpenEndedDictionary input), RuntimeEnabled=ServiceWorker, Exposed=ServiceWorker, RaisesException=Constructor, - WillBeGarbageCollected, + GarbageCollected, ] interface Headers { [RaisesException] void append(ByteString name, ByteString value); [ImplementedAs=remove, RaisesException] void delete(ByteString key);
diff --git a/modules/serviceworkers/InstallEvent.idl b/modules/serviceworkers/InstallEvent.idl index b014697..bdc33db 100644 --- a/modules/serviceworkers/InstallEvent.idl +++ b/modules/serviceworkers/InstallEvent.idl
@@ -32,7 +32,7 @@ [ RuntimeEnabled=ServiceWorker, Exposed=ServiceWorker, -] interface InstallEvent : InstallPhaseEvent { +] interface InstallEvent : ExtendableEvent { void replace(); [CallWith=ScriptState] Promise reloadAll(); };
diff --git a/modules/serviceworkers/QueryParams.idl b/modules/serviceworkers/QueryParams.idl new file mode 100644 index 0000000..817aa4b --- /dev/null +++ b/modules/serviceworkers/QueryParams.idl
@@ -0,0 +1,15 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache +[ + GarbageCollected +] dictionary QueryParams { + // FIXME: Specify defaults. https://github.com/slightlyoff/ServiceWorker/issues/466 + boolean ignoreSearch; + boolean ignoreMethod; + boolean ignoreVary; + boolean prefixMatch; + DOMString cacheName; +};
diff --git a/modules/serviceworkers/RegistrationOptionList.idl b/modules/serviceworkers/RegistrationOptionList.idl new file mode 100644 index 0000000..07d8216 --- /dev/null +++ b/modules/serviceworkers/RegistrationOptionList.idl
@@ -0,0 +1,10 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#registration-option-list-dictionary +[ + GarbageCollected +] dictionary RegistrationOptionList { + ScalarValueString scope = "/"; +};
diff --git a/modules/serviceworkers/Request.idl b/modules/serviceworkers/Request.idl index 3d1b402..3716a5e 100644 --- a/modules/serviceworkers/Request.idl +++ b/modules/serviceworkers/Request.idl
@@ -14,7 +14,7 @@ RuntimeEnabled=ServiceWorker, Exposed=ServiceWorker, RaisesException=Constructor, - WillBeGarbageCollected, + GarbageCollected, ] interface Request { readonly attribute ByteString method; readonly attribute ScalarValueString url; @@ -24,7 +24,10 @@ readonly attribute RequestMode mode; readonly attribute RequestCredentials credentials; + Request clone(); + // FIXME: Implement the following: - // readonly attribute FetchBodyStream body; // readonly attribute RequestContext context; }; + +Request implements Body;
diff --git a/modules/serviceworkers/Response.idl b/modules/serviceworkers/Response.idl index 28df198..d3cd258 100644 --- a/modules/serviceworkers/Response.idl +++ b/modules/serviceworkers/Response.idl
@@ -7,14 +7,16 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque" }; [ - // FIXME: Add ctors for ArrayBuffer, ArrayBufferView, FormData, - // and URLSearchParams response bodies. + // FIXME: Add ctors for FormData and URLSearchParams response bodies. Constructor(ScalarValueString body, optional Dictionary responseInitDict), Constructor(Blob? body, optional Dictionary responseInitDict), + Constructor(ArrayBuffer input, optional Dictionary requestInitDict), + Constructor(ArrayBufferView input, optional Dictionary requestInitDict), + ConstructorCallWith=ExecutionContext, RuntimeEnabled=ServiceWorker, Exposed=ServiceWorker, RaisesException=Constructor, - WillBeGarbageCollected, + GarbageCollected, ] interface Response { // FIXME: Implement redirect(). readonly attribute ResponseType type; @@ -22,5 +24,8 @@ readonly attribute unsigned short status; readonly attribute ByteString statusText; readonly attribute Headers headers; - [CallWith=ExecutionContext] readonly attribute FetchBodyStream body; + + Response clone(); }; + +Response implements Body;
diff --git a/modules/serviceworkers/ServiceWorker.idl b/modules/serviceworkers/ServiceWorker.idl index 69171df..ec8d558 100644 --- a/modules/serviceworkers/ServiceWorker.idl +++ b/modules/serviceworkers/ServiceWorker.idl
@@ -47,6 +47,8 @@ // FIXME: Should inherit this from Worker. [Custom, RaisesException] void postMessage(SerializedScriptValue message, optional sequence<Transferable> transfer); + [RaisesException] void terminate(); + readonly attribute ScalarValueString scriptURL; readonly attribute ServiceWorkerState state;
diff --git a/modules/serviceworkers/ServiceWorkerClient.idl b/modules/serviceworkers/ServiceWorkerClient.idl index 01a92cf..a0439a7 100644 --- a/modules/serviceworkers/ServiceWorkerClient.idl +++ b/modules/serviceworkers/ServiceWorkerClient.idl
@@ -6,7 +6,7 @@ [ Exposed=ServiceWorker, RuntimeEnabled=ServiceWorker, - WillBeGarbageCollected, + GarbageCollected, ] interface ServiceWorkerClient { readonly attribute unsigned long id;
diff --git a/modules/serviceworkers/ServiceWorkerClientQueryParams.idl b/modules/serviceworkers/ServiceWorkerClientQueryParams.idl new file mode 100644 index 0000000..a37df36 --- /dev/null +++ b/modules/serviceworkers/ServiceWorkerClientQueryParams.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#serviceworker-client-query-params-dictionary +[ + GarbageCollected +] dictionary ServiceWorkerClientQueryParams { + // FIXME: Specify defaults. https://github.com/slightlyoff/ServiceWorker/issues/466 + boolean includeUncontrolled; +};
diff --git a/modules/serviceworkers/ServiceWorkerClients.idl b/modules/serviceworkers/ServiceWorkerClients.idl index a484d6e..e7b555b 100644 --- a/modules/serviceworkers/ServiceWorkerClients.idl +++ b/modules/serviceworkers/ServiceWorkerClients.idl
@@ -6,7 +6,7 @@ [ Exposed=ServiceWorker, RuntimeEnabled=ServiceWorker, - WillBeGarbageCollected, + GarbageCollected, ] interface ServiceWorkerClients { - [CallWith=ScriptState] Promise getServiced(); + [CallWith=ScriptState] Promise getAll(optional ServiceWorkerClientQueryParams options); };
diff --git a/modules/serviceworkers/ServiceWorkerContainer.idl b/modules/serviceworkers/ServiceWorkerContainer.idl index df0017e..2dc7f45 100644 --- a/modules/serviceworkers/ServiceWorkerContainer.idl +++ b/modules/serviceworkers/ServiceWorkerContainer.idl
@@ -31,15 +31,11 @@ // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-container-interface [ RuntimeEnabled=ServiceWorker, - WillBeGarbageCollected + GarbageCollected ] interface ServiceWorkerContainer { - [Unforgeable] readonly attribute ServiceWorker? installing; - [Unforgeable] readonly attribute ServiceWorker? waiting; - [Unforgeable] readonly attribute ServiceWorker? active; [Unforgeable] readonly attribute ServiceWorker? controller; - [CallWith=ScriptState] readonly attribute Promise ready; - [CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(ScalarValueString url, optional Dictionary options); - [CallWith=ScriptState, ImplementedAs=unregisterServiceWorker] Promise unregister(optional ScalarValueString scope = "/"); + [CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(ScalarValueString url, optional RegistrationOptionList options); + [CallWith=ScriptState] Promise getRegistration(optional ScalarValueString documentURL = ""); };
diff --git a/modules/serviceworkers/ServiceWorkerGlobalScope.idl b/modules/serviceworkers/ServiceWorkerGlobalScope.idl index be99abc..10d9a9b 100644 --- a/modules/serviceworkers/ServiceWorkerGlobalScope.idl +++ b/modules/serviceworkers/ServiceWorkerGlobalScope.idl
@@ -37,15 +37,16 @@ readonly attribute ServiceWorkerClients clients; [CallWith=ExecutionContext, Unforgeable] readonly attribute ScalarValueString scope; - // FIXME: Rename this once it's ready for testing. - [CallWith=ExecutionContext, Unforgeable, ImplementedAs=caches] readonly attribute CacheStorage nativeCaches; + [CallWith=ExecutionContext, Unforgeable, RuntimeEnabled=ServiceWorkerOnFetch] readonly attribute CacheStorage caches; [CallWith=ScriptState] Promise fetch(DOMString request, optional Dictionary requestInitDict); [CallWith=ScriptState] Promise fetch(Request request, optional Dictionary requestInitDict); + [RaisesException] void close(); + attribute EventHandler onactivate; - attribute EventHandler onfetch; + [RuntimeEnabled=ServiceWorkerOnFetch] attribute EventHandler onfetch; attribute EventHandler oninstall; attribute EventHandler onmessage; - attribute EventHandler onsync; + [RuntimeEnabled=BackgroundSync] attribute EventHandler onsync; };
diff --git a/modules/serviceworkers/ServiceWorkerRegistration.idl b/modules/serviceworkers/ServiceWorkerRegistration.idl index 869808d..13ace48 100644 --- a/modules/serviceworkers/ServiceWorkerRegistration.idl +++ b/modules/serviceworkers/ServiceWorkerRegistration.idl
@@ -6,7 +6,7 @@ [ ActiveDOMObject, RuntimeEnabled=ServiceWorker, - WillBeGarbageCollected, + GarbageCollected, ] interface ServiceWorkerRegistration : EventTarget { [Unforgeable] readonly attribute ServiceWorker? installing; [Unforgeable] readonly attribute ServiceWorker? waiting;
diff --git a/modules/speech/SpeechSynthesis.idl b/modules/speech/SpeechSynthesis.idl index 7822292..98b53de 100644 --- a/modules/speech/SpeechSynthesis.idl +++ b/modules/speech/SpeechSynthesis.idl
@@ -25,8 +25,7 @@ [ GarbageCollected, - NoInterfaceObject, - RuntimeEnabled=SpeechSynthesis + NoInterfaceObject ] interface SpeechSynthesis : EventTarget { readonly attribute boolean pending; readonly attribute boolean speaking;
diff --git a/modules/speech/SpeechSynthesisEvent.idl b/modules/speech/SpeechSynthesisEvent.idl index e438411..d0456ed 100644 --- a/modules/speech/SpeechSynthesisEvent.idl +++ b/modules/speech/SpeechSynthesisEvent.idl
@@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - RuntimeEnabled=SpeechSynthesis -] interface SpeechSynthesisEvent : Event { +interface SpeechSynthesisEvent : Event { readonly attribute unsigned long charIndex; readonly attribute float elapsedTime; readonly attribute DOMString name;
diff --git a/modules/speech/SpeechSynthesisUtterance.idl b/modules/speech/SpeechSynthesisUtterance.idl index 490a03a..b4a36ed 100644 --- a/modules/speech/SpeechSynthesisUtterance.idl +++ b/modules/speech/SpeechSynthesisUtterance.idl
@@ -26,8 +26,7 @@ [ GarbageCollected, Constructor(optional DOMString text = null), - ConstructorCallWith=ExecutionContext, - RuntimeEnabled=SpeechSynthesis, + ConstructorCallWith=ExecutionContext ] interface SpeechSynthesisUtterance : EventTarget { attribute DOMString text; attribute DOMString lang;
diff --git a/modules/speech/SpeechSynthesisVoice.idl b/modules/speech/SpeechSynthesisVoice.idl index 05d36a5..ea323b0 100644 --- a/modules/speech/SpeechSynthesisVoice.idl +++ b/modules/speech/SpeechSynthesisVoice.idl
@@ -25,8 +25,7 @@ [ GarbageCollected, - NoInterfaceObject, - RuntimeEnabled=SpeechSynthesis + NoInterfaceObject ] interface SpeechSynthesisVoice { readonly attribute DOMString voiceURI; readonly attribute DOMString name;
diff --git a/modules/speech/WindowSpeechSynthesis.idl b/modules/speech/WindowSpeechSynthesis.idl index 1200a2e..a22453a 100644 --- a/modules/speech/WindowSpeechSynthesis.idl +++ b/modules/speech/WindowSpeechSynthesis.idl
@@ -25,7 +25,6 @@ [ ImplementedAs=DOMWindowSpeechSynthesis, - RuntimeEnabled=SpeechSynthesis, ] partial interface Window { readonly attribute SpeechSynthesis speechSynthesis; };
diff --git a/modules/webaudio/AudioBuffer.idl b/modules/webaudio/AudioBuffer.idl index 7ec7c60..d94eaf8 100644 --- a/modules/webaudio/AudioBuffer.idl +++ b/modules/webaudio/AudioBuffer.idl
@@ -27,7 +27,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, Conditional=WEB_AUDIO ] interface AudioBuffer { readonly attribute long length; // in sample-frames
diff --git a/modules/webaudio/AudioContext.idl b/modules/webaudio/AudioContext.idl index 0f6518e..cc74984 100644 --- a/modules/webaudio/AudioContext.idl +++ b/modules/webaudio/AudioContext.idl
@@ -24,7 +24,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, ActiveDOMObject, Conditional=WEB_AUDIO, Constructor,
diff --git a/modules/webaudio/AudioListener.idl b/modules/webaudio/AudioListener.idl index b9668f5..6f4645c 100644 --- a/modules/webaudio/AudioListener.idl +++ b/modules/webaudio/AudioListener.idl
@@ -27,7 +27,7 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, Conditional=WEB_AUDIO ] interface AudioListener { attribute float dopplerFactor; // same as OpenAL (default 1.0)
diff --git a/modules/webaudio/AudioNode.idl b/modules/webaudio/AudioNode.idl index 4ed4d40..41396a3 100644 --- a/modules/webaudio/AudioNode.idl +++ b/modules/webaudio/AudioNode.idl
@@ -38,7 +38,7 @@ [ Conditional=WEB_AUDIO, Custom=Wrap, - WillBeGarbageCollected, + GarbageCollected, ] interface AudioNode : EventTarget { // FIXME: AudioNode argument should not be nullable [RaisesException] void connect(AudioNode? destination, [Default=Undefined] optional unsigned long output, [Default=Undefined] optional unsigned long input);
diff --git a/modules/webaudio/AudioParam.idl b/modules/webaudio/AudioParam.idl index e612201..ce6ec86 100644 --- a/modules/webaudio/AudioParam.idl +++ b/modules/webaudio/AudioParam.idl
@@ -27,27 +27,27 @@ */ [ - WillBeGarbageCollected, + GarbageCollected, Conditional=WEB_AUDIO ] interface AudioParam { attribute float value; readonly attribute float defaultValue; // Parameter automation. - void setValueAtTime(float value, double time); - void linearRampToValueAtTime(float value, double time); + [RaisesException] void setValueAtTime(float value, double time); + [RaisesException] void linearRampToValueAtTime(float value, double time); [RaisesException] void exponentialRampToValueAtTime(float value, double time); // Exponentially approach the target with a rate having the given time constant. - void setTargetAtTime(float target, double time, double timeConstant); + [RaisesException] void setTargetAtTime(float target, double time, double timeConstant); // Sets an array of arbitrary parameter values starting at time for the given duration. // The number of values will be scaled to fit into the desired duration. // FIXMEDART(ager): Auto-generate this custom method when the info about // retaining typed arrays is in the IDL. - [DartCustom] void setValueCurveAtTime(Float32Array values, double time, double duration); + [RaisesException, DartCustom] void setValueCurveAtTime(Float32Array values, double time, double duration); // Cancels all scheduled parameter changes with times greater than or equal to startTime. - void cancelScheduledValues(double startTime); + [RaisesException] void cancelScheduledValues(double startTime); };
diff --git a/modules/webaudio/OfflineAudioContext.idl b/modules/webaudio/OfflineAudioContext.idl index 5d5ec0c..5f5f8ac 100644 --- a/modules/webaudio/OfflineAudioContext.idl +++ b/modules/webaudio/OfflineAudioContext.idl
@@ -23,7 +23,6 @@ */ [ - WillBeGarbageCollected, Conditional=WEB_AUDIO, Constructor(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate), ConstructorCallWith=ExecutionContext,
diff --git a/modules/webaudio/PeriodicWave.idl b/modules/webaudio/PeriodicWave.idl index 3dccbc7..46a5474 100644 --- a/modules/webaudio/PeriodicWave.idl +++ b/modules/webaudio/PeriodicWave.idl
@@ -24,7 +24,7 @@ // PeriodicWave represents a periodic audio waveform given by its Fourier coefficients. [ - WillBeGarbageCollected, + GarbageCollected, Conditional=WEB_AUDIO ] interface PeriodicWave {
diff --git a/modules/webdatabase/DatabaseCallback.idl b/modules/webdatabase/DatabaseCallback.idl index 807bd3f..dc1987d 100644 --- a/modules/webdatabase/DatabaseCallback.idl +++ b/modules/webdatabase/DatabaseCallback.idl
@@ -28,5 +28,4 @@ callback interface DatabaseCallback { boolean handleEvent(Database database); - boolean handleEvent(DatabaseSync database); };
diff --git a/modules/webdatabase/DatabaseSync.idl b/modules/webdatabase/DatabaseSync.idl deleted file mode 100644 index a558400..0000000 --- a/modules/webdatabase/DatabaseSync.idl +++ /dev/null
@@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - WillBeGarbageCollected, - NoInterfaceObject -] interface DatabaseSync { - readonly attribute DOMString version; - readonly attribute DOMString lastErrorMessage; - [RaisesException] void changeVersion(DOMString oldVersion, DOMString newVersion, optional SQLTransactionSyncCallback callback); - [RaisesException] void transaction(SQLTransactionSyncCallback callback); - [RaisesException] void readTransaction(SQLTransactionSyncCallback callback); -}; -
diff --git a/modules/webdatabase/SQLTransactionSync.idl b/modules/webdatabase/SQLTransactionSync.idl deleted file mode 100644 index 7cbb0e6..0000000 --- a/modules/webdatabase/SQLTransactionSync.idl +++ /dev/null
@@ -1,36 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -[ - WillBeGarbageCollected, - NoInterfaceObject, -] interface SQLTransactionSync { - [RaisesException, Custom] SQLResultSet executeSql(DOMString sqlStatement, object[] arguments); -};
diff --git a/modules/webdatabase/SQLTransactionSyncCallback.idl b/modules/webdatabase/SQLTransactionSyncCallback.idl deleted file mode 100644 index 08bd0b3..0000000 --- a/modules/webdatabase/SQLTransactionSyncCallback.idl +++ /dev/null
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -callback interface SQLTransactionSyncCallback { - boolean handleEvent(SQLTransactionSync transaction); -};
diff --git a/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl b/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl deleted file mode 100644 index 3e6fcfb..0000000 --- a/modules/webdatabase/WorkerGlobalScopeWebDatabase.idl +++ /dev/null
@@ -1,33 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -[ - RuntimeEnabled=Database, -] partial interface WorkerGlobalScope { - [RaisesException, DeprecateAs=OpenWebDatabaseInWorker] Database openDatabase(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); - - [RaisesException, DeprecateAs=OpenWebDatabaseSyncInWorker] DatabaseSync openDatabaseSync(DOMString name, DOMString version, DOMString displayName, unsigned long estimatedSize, optional DatabaseCallback creationCallback); -};
diff --git a/modules/webmidi/MIDIAccess.idl b/modules/webmidi/MIDIAccess.idl index 5ffcfac..19c18c6 100644 --- a/modules/webmidi/MIDIAccess.idl +++ b/modules/webmidi/MIDIAccess.idl
@@ -32,8 +32,8 @@ NoInterfaceObject, ActiveDOMObject ] interface MIDIAccess : EventTarget { - sequence<MIDIInput> inputs(); - sequence<MIDIOutput> outputs(); + readonly attribute MIDIInputMap inputs; + readonly attribute MIDIOutputMap outputs; readonly attribute boolean sysexEnabled;
diff --git a/modules/webmidi/MIDIInputMap.idl b/modules/webmidi/MIDIInputMap.idl new file mode 100644 index 0000000..e165c99 --- /dev/null +++ b/modules/webmidi/MIDIInputMap.idl
@@ -0,0 +1,22 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// FIXME: Implement forEach. +// callback ForEachCallback = void(DOMString id, MIDIInput port); + +[ + Iterable, + NoInterfaceObject, + GarbageCollected, +] interface MIDIInputMap { + readonly attribute unsigned long size; + Iterator keys(); + Iterator entries(); + Iterator values(); + // This function returns undefined if |!this->has(id)|. + [ImplementedAs=getForBinding, CallWith=ScriptState] any get(DOMString id); + boolean has(DOMString key); + // FIXME: Implement forEach. + // void forEach (ForEachCallback callback); +};
diff --git a/modules/webmidi/MIDIOptions.idl b/modules/webmidi/MIDIOptions.idl new file mode 100644 index 0000000..447e6cd --- /dev/null +++ b/modules/webmidi/MIDIOptions.idl
@@ -0,0 +1,11 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// http://www.w3.org/TR/webmidi/#midioptions-dictionary + +[ + GarbageCollected +] dictionary MIDIOptions { + boolean sysex; +};
diff --git a/modules/webmidi/MIDIOutputMap.idl b/modules/webmidi/MIDIOutputMap.idl new file mode 100644 index 0000000..eec7a88 --- /dev/null +++ b/modules/webmidi/MIDIOutputMap.idl
@@ -0,0 +1,22 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// FIXME: Implement forEach. +// callback ForEachCallback = void(DOMString id, MIDIOutput port); + +[ + Iterable, + NoInterfaceObject, + GarbageCollected, +] interface MIDIOutputMap { + readonly attribute unsigned long size; + Iterator keys(); + Iterator entries(); + Iterator values(); + // This function returns undefined if |!this->has(id)|. + [ImplementedAs=getForBinding, CallWith=ScriptState] any get(DOMString id); + boolean has(DOMString key); + // FIXME: Implement forEach. + // void forEach (ForEachCallback callback); +};
diff --git a/modules/webmidi/NavigatorWebMIDI.idl b/modules/webmidi/NavigatorWebMIDI.idl index d391e29..ba26473 100644 --- a/modules/webmidi/NavigatorWebMIDI.idl +++ b/modules/webmidi/NavigatorWebMIDI.idl
@@ -32,5 +32,5 @@ RuntimeEnabled=WebMIDI, ] partial interface Navigator { // FIXMEDART: Remove the DartSuppress once Dart support Blink Promises. - [CallWith=ScriptState, DartSuppress] Promise requestMIDIAccess(optional Dictionary options); + [CallWith=ScriptState, DartSuppress] Promise requestMIDIAccess(optional MIDIOptions options); };