def create_interface_context(self, interface, component, interfaces):
        '''Creates a Jinja context which is based on an interface.'''

        assert component in ['core', 'modules']

        name = '%s%s' % (v8_utilities.cpp_name(interface),
                         'Partial' if interface.is_partial else '')

        # Constructors
        has_constructor_callback = False
        if not interface.is_partial:
            constructors = any(constructor.name == 'Constructor'
                               for constructor in interface.constructors)
            custom_constructors = interface.custom_constructors
            html_constructor = 'HTMLConstructor' in interface.extended_attributes
            has_constructor_callback = constructors or custom_constructors or html_constructor

        attributes = []
        methods = []
        has_cross_origin_indexed_getter = False
        has_cross_origin_named_enum = False
        has_cross_origin_named_getter = False
        has_cross_origin_named_setter = False
        has_origin_safe_method_setter = False
        has_security_check = False
        indexed_property_getter = None
        is_global = False
        named_property_getter = None
        component_info = self._info_provider.component_info
        if interface.name in SNAPSHOTTED_INTERFACES:
            attributes = [
                v8_attributes.attribute_context(interface, attribute,
                                                interfaces, component_info)
                for attribute in interface.attributes
            ]
            methods = v8_interface.methods_context(interface,
                                                   component_info)['methods']
            is_global = 'Global' in interface.extended_attributes

            named_property_getter = v8_interface.property_getter(
                interface.named_property_getter, ['name'])
            indexed_property_getter = v8_interface.property_getter(
                interface.indexed_property_getter, ['index'])

            if not interface.is_partial:
                has_origin_safe_method_setter = is_global and any(
                    method['is_check_security_for_receiver']
                    and not method['is_unforgeable'] for method in methods)
                has_security_check = ('CheckSecurity'
                                      in interface.extended_attributes
                                      and interface.name != 'EventTarget')
                has_cross_origin_named_getter = (
                    any(method['is_cross_origin'] for method in methods)
                    or any(attribute['has_cross_origin_getter']
                           for attribute in attributes))
                has_cross_origin_named_setter = any(
                    attribute['has_cross_origin_setter']
                    for attribute in attributes)
                has_cross_origin_indexed_getter = indexed_property_getter and indexed_property_getter[
                    'is_cross_origin']
                has_cross_origin_named_enum = has_cross_origin_named_getter or has_cross_origin_named_setter
                if named_property_getter and named_property_getter[
                        'is_cross_origin']:
                    has_cross_origin_named_getter = True

        return {
            'attributes':
            attributes,
            'component':
            component,
            'has_origin_safe_method_setter':
            has_origin_safe_method_setter,
            'has_constructor_callback':
            has_constructor_callback,
            'has_cross_origin_named_getter':
            has_cross_origin_named_getter,
            'has_cross_origin_named_setter':
            has_cross_origin_named_setter,
            'has_cross_origin_named_enumerator':
            has_cross_origin_named_enum,
            'has_cross_origin_indexed_getter':
            has_cross_origin_indexed_getter,
            'has_security_check':
            has_security_check,
            'indexed_property_getter':
            indexed_property_getter,
            'indexed_property_setter':
            v8_interface.property_setter(interface.indexed_property_setter,
                                         interface),
            'indexed_property_deleter':
            v8_interface.property_deleter(interface.indexed_property_deleter),
            'internal_namespace':
            v8_interface.internal_namespace(interface),
            'is_partial':
            interface.is_partial,
            'methods':
            methods,
            'name':
            name,
            'named_constructor':
            v8_interface.named_constructor_context(interface),
            'named_property_getter':
            named_property_getter,
            'named_property_setter':
            v8_interface.property_setter(interface.named_property_setter,
                                         interface),
            'named_property_deleter':
            v8_interface.property_deleter(interface.named_property_deleter),
            'v8_class':
            v8_utilities.v8_class_name_or_partial(interface),
        }
    def create_interface_context(self, interface, interfaces):
        '''Creates a Jinja context which is based on an interface.'''

        name = '%s%s' % (v8_utilities.cpp_name(interface), 'Partial' if interface.is_partial else '')

        # Constructors
        constructors = any(constructor.name == 'Constructor' for constructor in interface.constructors)
        custom_constructors = interface.custom_constructors
        html_constructor = 'HTMLConstructor' in interface.extended_attributes
        has_constructor_callback = constructors or custom_constructors or html_constructor

        attributes = []
        methods = []
        has_cross_origin_indexed_getter = False
        has_cross_origin_named_enum = False
        has_cross_origin_named_getter = False
        has_cross_origin_named_setter = False
        has_origin_safe_method_setter = False
        has_security_check = False
        indexed_property_getter = None
        is_global = False
        named_property_getter = None
        if interface.name in SNAPSHOTTED_INTERFACES:
            attributes = [v8_attributes.attribute_context(interface, attribute, interfaces)
                          for attribute in interface.attributes]
            methods = v8_interface.methods_context(interface)['methods']
            is_global = ('PrimaryGlobal' in interface.extended_attributes or
                         'Global' in interface.extended_attributes)

            named_property_getter = v8_interface.property_getter(
                interface.named_property_getter, ['name'])
            indexed_property_getter = v8_interface.property_getter(
                interface.indexed_property_getter, ['index'])

            if not interface.is_partial:
                has_origin_safe_method_setter = is_global and any(
                    method['is_check_security_for_receiver'] and not method['is_unforgeable']
                    for method in methods)
                has_security_check = ('CheckSecurity' in interface.extended_attributes and
                                      interface.name != 'EventTarget')
                has_cross_origin_named_getter = (any(method['is_cross_origin'] for method in methods) or
                                                 any(attribute['has_cross_origin_getter'] for attribute in attributes))
                has_cross_origin_named_setter = any(attribute['has_cross_origin_setter'] for attribute in attributes)
                has_cross_origin_indexed_getter = indexed_property_getter and indexed_property_getter['is_cross_origin']
                has_cross_origin_named_enum = has_cross_origin_named_getter or has_cross_origin_named_setter
                if named_property_getter and named_property_getter['is_cross_origin']:
                    has_cross_origin_named_getter = True

        return {
            'attributes': attributes,
            'has_origin_safe_method_setter': has_origin_safe_method_setter,
            'has_constructor_callback': has_constructor_callback,
            'has_cross_origin_named_getter': has_cross_origin_named_getter,
            'has_cross_origin_named_setter': has_cross_origin_named_setter,
            'has_cross_origin_named_enumerator': has_cross_origin_named_enum,
            'has_cross_origin_indexed_getter': has_cross_origin_indexed_getter,
            'has_security_check': has_security_check,
            'indexed_property_getter': indexed_property_getter,
            'indexed_property_setter': v8_interface.property_setter(interface.indexed_property_setter, interface),
            'indexed_property_deleter': v8_interface.property_deleter(interface.indexed_property_deleter),
            'is_array_buffer_or_view': interface.idl_type.is_array_buffer_or_view,
            'is_callback': interface.is_callback,
            'is_partial': interface.is_partial,
            'is_snapshotted': interface in SNAPSHOTTED_INTERFACES,
            'methods': methods,
            'name': name,
            'named_constructor': v8_interface.named_constructor_context(interface),
            'named_property_getter': named_property_getter,
            'named_property_setter': v8_interface.property_setter(interface.named_property_setter, interface),
            'named_property_deleter': v8_interface.property_deleter(interface.named_property_deleter),
            'v8_name': v8_utilities.v8_class_name_or_partial(interface),
        }