bindings: Supports inheritance of [Unforgeable] attributes as accessor-type properties.

This CL makes it possible that we define [Unforgeable] attributes as
accessor-type JS properties, and child-interfaces inherit them from
parent-interfaces.

Note that Window and Location's attributes are still data-type properties.

Except for Event.isTrusted, there should be no behavioral change.
Event.isTrusted becomes accessor-type properties.

BUG=43394,491006,497616

Review URL: https://codereview.chromium.org/1257613003

git-svn-id: svn://svn.chromium.org/blink/trunk@199658 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 04832992
...@@ -245,10 +245,9 @@ class CodeGeneratorV8(CodeGeneratorBase): ...@@ -245,10 +245,9 @@ class CodeGeneratorV8(CodeGeneratorBase):
header_template_filename = 'interface.h' header_template_filename = 'interface.h'
cpp_template_filename = 'interface.cpp' cpp_template_filename = 'interface.cpp'
interface_context = v8_interface.interface_context interface_context = v8_interface.interface_context
header_template = self.jinja_env.get_template(header_template_filename)
cpp_template = self.jinja_env.get_template(cpp_template_filename)
template_context = interface_context(interface) template_context = interface_context(interface)
includes.update(interface_info.get('cpp_includes', {}).get(component, set()))
if not interface.is_partial and not is_testing_target(full_path): if not interface.is_partial and not is_testing_target(full_path):
template_context['header_includes'].add(self.info_provider.include_path_for_export) template_context['header_includes'].add(self.info_provider.include_path_for_export)
template_context['exported'] = self.info_provider.specifier_for_export template_context['exported'] = self.info_provider.specifier_for_export
...@@ -257,6 +256,9 @@ class CodeGeneratorV8(CodeGeneratorBase): ...@@ -257,6 +256,9 @@ class CodeGeneratorV8(CodeGeneratorBase):
template_context['header_includes'].add('core/dom/DOMTypedArray.h') template_context['header_includes'].add('core/dom/DOMTypedArray.h')
elif interface_info['include_path']: elif interface_info['include_path']:
template_context['header_includes'].add(interface_info['include_path']) template_context['header_includes'].add(interface_info['include_path'])
header_template = self.jinja_env.get_template(header_template_filename)
cpp_template = self.jinja_env.get_template(cpp_template_filename)
header_text, cpp_text = render_template( header_text, cpp_text = render_template(
include_paths, header_template, cpp_template, template_context, include_paths, header_template, cpp_template, template_context,
component) component)
......
...@@ -47,9 +47,10 @@ import os ...@@ -47,9 +47,10 @@ import os
import posixpath import posixpath
import sys import sys
from idl_compiler import idl_filename_to_interface_name
from idl_definitions import Visitor from idl_definitions import Visitor
from idl_reader import IdlReader from idl_reader import IdlReader
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 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, merge_dict_recursively
module_path = os.path.dirname(__file__) module_path = os.path.dirname(__file__)
source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir)) source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
...@@ -100,8 +101,7 @@ def include_path(idl_filename, implemented_as=None): ...@@ -100,8 +101,7 @@ def include_path(idl_filename, implemented_as=None):
relative_dir = relative_dir_posix(idl_filename) relative_dir = relative_dir_posix(idl_filename)
# IDL file basename is used even if only a partial interface file # 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_filename_to_interface_name(idl_filename)
cpp_class_name = implemented_as or idl_file_basename
return posixpath.join(relative_dir, cpp_class_name + '.h') return posixpath.join(relative_dir, cpp_class_name + '.h')
...@@ -130,6 +130,13 @@ def get_put_forward_interfaces_from_definition(definition): ...@@ -130,6 +130,13 @@ def get_put_forward_interfaces_from_definition(definition):
if 'PutForwards' in attribute.extended_attributes)) if 'PutForwards' in attribute.extended_attributes))
def get_unforgeable_attributes_from_definition(definition):
if 'Unforgeable' in definition.extended_attributes:
return sorted(definition.attributes)
return sorted(attribute for attribute in definition.attributes
if 'Unforgeable' in attribute.extended_attributes)
def collect_union_types_from_definitions(definitions): def collect_union_types_from_definitions(definitions):
"""Traverse definitions and collect all union types.""" """Traverse definitions and collect all union types."""
class UnionTypeCollector(Visitor): class UnionTypeCollector(Visitor):
...@@ -172,6 +179,34 @@ class InterfaceInfoCollector(object): ...@@ -172,6 +179,34 @@ class InterfaceInfoCollector(object):
def collect_info(self, idl_filename): def collect_info(self, idl_filename):
"""Reads an idl file and collects information which is required by the """Reads an idl file and collects information which is required by the
binding code generation.""" binding code generation."""
def collect_unforgeable_attributes(definition, idl_filename):
"""Collects [Unforgeable] attributes so that we can define them on
sub-interfaces later. The resulting structure is as follows.
interfaces_info[interface_name] = {
'unforgeable_attributes': {
'core': [IdlAttribute, ...],
'modules': [IdlAttribute, ...],
},
...
}
"""
interface_info = {}
unforgeable_attributes = get_unforgeable_attributes_from_definition(definition)
if not unforgeable_attributes:
return interface_info
if definition.is_partial:
interface_basename = idl_filename_to_interface_name(idl_filename)
# TODO(yukishiino): [PartialInterfaceImplementedAs] is treated
# in interface_dependency_resolver.transfer_extended_attributes.
# Come up with a better way to keep them consistent.
for attr in unforgeable_attributes:
attr.extended_attributes['PartialInterfaceImplementedAs'] = definition.extended_attributes.get('ImplementedAs', interface_basename)
component = idl_filename_to_component(idl_filename)
interface_info['unforgeable_attributes'] = {}
interface_info['unforgeable_attributes'][component] = unforgeable_attributes
return interface_info
definitions = self.reader.read_idl_file(idl_filename) definitions = self.reader.read_idl_file(idl_filename)
this_union_types = collect_union_types_from_definitions(definitions) this_union_types = collect_union_types_from_definitions(definitions)
...@@ -208,6 +243,15 @@ class InterfaceInfoCollector(object): ...@@ -208,6 +243,15 @@ class InterfaceInfoCollector(object):
else: else:
return return
if definition.name not in self.interfaces_info:
self.interfaces_info[definition.name] = {}
# Remember [Unforgeable] attributes.
if definitions.interfaces:
merge_dict_recursively(self.interfaces_info[definition.name],
collect_unforgeable_attributes(definition, idl_filename))
component = idl_filename_to_component(idl_filename)
extended_attributes = definition.extended_attributes extended_attributes = definition.extended_attributes
implemented_as = extended_attributes.get('ImplementedAs') implemented_as = extended_attributes.get('ImplementedAs')
full_path = os.path.realpath(idl_filename) full_path = os.path.realpath(idl_filename)
...@@ -219,10 +263,22 @@ class InterfaceInfoCollector(object): ...@@ -219,10 +263,22 @@ class InterfaceInfoCollector(object):
if this_include_path: if this_include_path:
partial_include_paths.append(this_include_path) partial_include_paths.append(this_include_path)
if this_union_types: if this_union_types:
component = idl_filename_to_component(idl_filename)
partial_include_paths.append( partial_include_paths.append(
'bindings/%s/v8/UnionTypes%s.h' % (component, component.capitalize())) 'bindings/%s/v8/UnionTypes%s.h' % (component, component.capitalize()))
self.add_paths_to_partials_dict(definition.name, full_path, partial_include_paths) self.add_paths_to_partials_dict(definition.name, full_path, partial_include_paths)
# Collects C++ header paths which should be included from generated
# .cpp files. The resulting structure is as follows.
# interfaces_info[interface_name] = {
# 'cpp_includes': {
# 'core': set(['core/foo/Foo.h', ...]),
# 'modules': set(['modules/bar/Bar.h', ...]),
# },
# ...
# }
if this_include_path:
merge_dict_recursively(
self.interfaces_info[definition.name],
{'cpp_includes': {component: set([this_include_path])}})
return return
# 'implements' statements can be included in either the file for the # 'implements' statements can be included in either the file for the
...@@ -246,7 +302,7 @@ class InterfaceInfoCollector(object): ...@@ -246,7 +302,7 @@ class InterfaceInfoCollector(object):
'parent': definition.parent, 'parent': definition.parent,
'relative_dir': relative_dir_posix(idl_filename), 'relative_dir': relative_dir_posix(idl_filename),
}) })
self.interfaces_info[definition.name] = interface_info merge_dict_recursively(self.interfaces_info[definition.name], interface_info)
def get_info_as_dict(self): def get_info_as_dict(self):
"""Returns info packaged as a dict.""" """Returns info packaged as a dict."""
......
...@@ -86,7 +86,7 @@ import cPickle as pickle ...@@ -86,7 +86,7 @@ import cPickle as pickle
import optparse import optparse
import sys import sys
from utilities import idl_filename_to_component, read_pickle_files, write_pickle_file from utilities import idl_filename_to_component, read_pickle_files, write_pickle_file, merge_dict_recursively
INHERITED_EXTENDED_ATTRIBUTES = set([ INHERITED_EXTENDED_ATTRIBUTES = set([
'ActiveDOMObject', 'ActiveDOMObject',
...@@ -206,8 +206,7 @@ def compute_interfaces_info_overall(info_individuals): ...@@ -206,8 +206,7 @@ def compute_interfaces_info_overall(info_individuals):
Information is stored in global interfaces_info. Information is stored in global interfaces_info.
""" """
for info in info_individuals: for info in info_individuals:
# No overlap between interface names, so ok to use dict.update merge_dict_recursively(interfaces_info, info['interfaces_info'])
interfaces_info.update(info['interfaces_info'])
# Interfaces in one component may have partial interfaces in # Interfaces in one component may have partial interfaces in
# another component. This is ok (not a layering violation), since # another component. This is ok (not a layering violation), since
# partial interfaces are used to *extend* interfaces. # partial interfaces are used to *extend* interfaces.
...@@ -313,7 +312,6 @@ def compute_interfaces_info_overall(info_individuals): ...@@ -313,7 +312,6 @@ def compute_interfaces_info_overall(info_individuals):
del interface_info['extended_attributes'] del interface_info['extended_attributes']
del interface_info['has_union_types'] del interface_info['has_union_types']
del interface_info['is_legacy_treat_as_partial_interface'] 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 # Compute global_type_info to interfaces_info so that idl_compiler does
# not need to always calculate the info in __init__. # not need to always calculate the info in __init__.
......
...@@ -37,7 +37,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC ...@@ -37,7 +37,7 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC
""" """
import os.path import os.path
from utilities import idl_filename_to_component, is_valid_component_dependency from utilities import idl_filename_to_component, is_valid_component_dependency, merge_dict_recursively
# The following extended attributes can be applied to a dependency interface, # The following extended attributes can be applied to a dependency interface,
# and are then applied to the individual members when merging. # and are then applied to the individual members when merging.
...@@ -119,6 +119,8 @@ class InterfaceDependencyResolver(object): ...@@ -119,6 +119,8 @@ class InterfaceDependencyResolver(object):
interface_info['dependencies_other_component_full_paths'], interface_info['dependencies_other_component_full_paths'],
self.reader) self.reader)
inherit_unforgeable_attributes(resolved_definitions, self.interfaces_info)
for referenced_interface_name in interface_info['referenced_interfaces']: for referenced_interface_name in interface_info['referenced_interfaces']:
referenced_definitions = self.reader.read_idl_definitions( referenced_definitions = self.reader.read_idl_definitions(
self.interfaces_info[referenced_interface_name]['full_path']) self.interfaces_info[referenced_interface_name]['full_path'])
...@@ -305,3 +307,42 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base ...@@ -305,3 +307,42 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base
update_attributes(constant.extended_attributes, merged_extended_attributes) update_attributes(constant.extended_attributes, merged_extended_attributes)
for operation in dependency_interface.operations: for operation in dependency_interface.operations:
update_attributes(operation.extended_attributes, merged_extended_attributes) update_attributes(operation.extended_attributes, merged_extended_attributes)
def inherit_unforgeable_attributes(resolved_definitions, interfaces_info):
"""Inherits [Unforgeable] attributes and updates the arguments accordingly.
For each interface in |resolved_definitions|, collects all [Unforgeable]
attributes in ancestor interfaces in the same component and adds them to
the interface. 'referenced_interfaces' and 'cpp_includes' in
|interfaces_info| are updated accordingly.
"""
def collect_unforgeable_attributes_in_ancestors(interface_name, component):
if not interface_name:
# unforgeable_attributes, referenced_interfaces, cpp_includes
return [], [], set()
interface = interfaces_info[interface_name]
unforgeable_attributes, referenced_interfaces, cpp_includes = collect_unforgeable_attributes_in_ancestors(interface.get('parent'), component)
this_unforgeable = interface.get('unforgeable_attributes', {}).get(component, [])
unforgeable_attributes.extend(this_unforgeable)
this_referenced = [attr.idl_type.base_type for attr in this_unforgeable
if attr.idl_type.base_type in
interface.get('referenced_interfaces', [])]
referenced_interfaces.extend(this_referenced)
cpp_includes.update(interface.get('cpp_includes', {}).get(component, {}))
return unforgeable_attributes, referenced_interfaces, cpp_includes
for component, definitions in resolved_definitions.iteritems():
for interface_name, interface in definitions.interfaces.iteritems():
interface_info = interfaces_info[interface_name]
inherited_unforgeable_attributes, referenced_interfaces, cpp_includes = collect_unforgeable_attributes_in_ancestors(interface_info.get('parent'), component)
# This loop may process the same interface many times, so it's
# possible that we're adding the same attributes twice or more.
# So check if there is a duplicate.
for attr in inherited_unforgeable_attributes:
if attr not in interface.attributes:
interface.attributes.append(attr)
referenced_interfaces.extend(interface_info.get('referenced_interfaces', []))
interface_info['referenced_interfaces'] = sorted(set(referenced_interfaces))
merge_dict_recursively(interface_info,
{'cpp_includes': {component: cpp_includes}})
...@@ -182,6 +182,26 @@ def load_interfaces_info_overall_pickle(info_dir): ...@@ -182,6 +182,26 @@ def load_interfaces_info_overall_pickle(info_dir):
return pickle.load(interface_info_file) return pickle.load(interface_info_file)
def merge_dict_recursively(target, diff):
"""Merges two dicts into one.
|target| will be updated with |diff|. Part of |diff| may be re-used in
|target|.
"""
for key, value in diff.iteritems():
if key not in target:
target[key] = value
elif type(value) == dict:
merge_dict_recursively(target[key], value)
elif type(value) == list:
target[key].extend(value)
elif type(value) == set:
target[key].update(value)
else:
# Testing IDLs want to overwrite the values. Production code
# doesn't need any overwriting.
target[key] = value
def create_component_info_provider_core(info_dir): def create_component_info_provider_core(info_dir):
interfaces_info = load_interfaces_info_overall_pickle(info_dir) interfaces_info = load_interfaces_info_overall_pickle(info_dir)
with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as component_info_file: with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as component_info_file:
......
...@@ -124,7 +124,7 @@ def attribute_context(interface, attribute): ...@@ -124,7 +124,7 @@ def attribute_context(interface, attribute):
'is_check_security_for_window': is_check_security_for_window, 'is_check_security_for_window': is_check_security_for_window,
'is_custom_element_callbacks': is_custom_element_callbacks, 'is_custom_element_callbacks': is_custom_element_callbacks,
# TODO(yukishiino): Make all DOM attributes accessor-type properties. # TODO(yukishiino): Make all DOM attributes accessor-type properties.
'is_data_type_property': constructor_type or interface.name == 'Window' or interface.name == 'Location' or (interface.name == 'Event' and attribute.name == 'isTrusted'), 'is_data_type_property': constructor_type or interface.name == 'Window' or interface.name == 'Location',
'is_getter_raises_exception': # [RaisesException] 'is_getter_raises_exception': # [RaisesException]
'RaisesException' in extended_attributes and 'RaisesException' in extended_attributes and
extended_attributes['RaisesException'] in (None, 'Getter'), extended_attributes['RaisesException'] in (None, 'Getter'),
......
...@@ -9,9 +9,15 @@ ...@@ -9,9 +9,15 @@
#include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8DOMConfiguration.h" #include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8Location.h"
#include "bindings/core/v8/V8ObjectConstructor.h" #include "bindings/core/v8/V8ObjectConstructor.h"
#include "core/animation/DocumentAnimation.h"
#include "core/css/DocumentFontFaceSet.h"
#include "core/dom/ContextFeatures.h" #include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h" #include "core/dom/Document.h"
#include "core/dom/DocumentFullscreen.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/xml/DocumentXPathEvaluator.h"
#include "platform/RuntimeEnabledFeatures.h" #include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h" #include "platform/TraceEvent.h"
#include "wtf/GetPtr.h" #include "wtf/GetPtr.h"
...@@ -37,8 +43,47 @@ const WrapperTypeInfo& TestInterfaceDocument::s_wrapperTypeInfo = V8TestInterfac ...@@ -37,8 +43,47 @@ const WrapperTypeInfo& TestInterfaceDocument::s_wrapperTypeInfo = V8TestInterfac
namespace TestInterfaceDocumentV8Internal { namespace TestInterfaceDocumentV8Internal {
static void locationAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceDocument* impl = V8TestInterfaceDocument::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->location()), impl);
}
static void locationAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
TestInterfaceDocumentV8Internal::locationAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void locationAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceDocument* proxyImpl = V8TestInterfaceDocument::toImpl(holder);
RefPtrWillBeRawPtr<Location> impl = WTF::getPtr(proxyImpl->location());
if (!impl)
return;
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setHref(callingDOMWindow(info.GetIsolate()), enteredDOMWindow(info.GetIsolate()), cppValue);
}
static void locationAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
TestInterfaceDocumentV8Internal::locationAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
} // namespace TestInterfaceDocumentV8Internal } // namespace TestInterfaceDocumentV8Internal
static const V8DOMConfiguration::AccessorConfiguration V8TestInterfaceDocumentAccessors[] = {
{"location", TestInterfaceDocumentV8Internal::locationAttributeGetterCallback, TestInterfaceDocumentV8Internal::locationAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::DontDelete), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder},
};
static void installV8TestInterfaceDocumentTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) static void installV8TestInterfaceDocumentTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{ {
functionTemplate->ReadOnlyPrototype(); functionTemplate->ReadOnlyPrototype();
...@@ -46,7 +91,7 @@ static void installV8TestInterfaceDocumentTemplate(v8::Local<v8::FunctionTemplat ...@@ -46,7 +91,7 @@ static void installV8TestInterfaceDocumentTemplate(v8::Local<v8::FunctionTemplat
v8::Local<v8::Signature> defaultSignature; v8::Local<v8::Signature> defaultSignature;
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterfaceDocument", V8Document::domTemplate(isolate), V8TestInterfaceDocument::internalFieldCount, defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "TestInterfaceDocument", V8Document::domTemplate(isolate), V8TestInterfaceDocument::internalFieldCount,
0, 0, 0, 0,
0, 0, V8TestInterfaceDocumentAccessors, WTF_ARRAY_LENGTH(V8TestInterfaceDocumentAccessors),
0, 0); 0, 0);
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate(); v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate); ALLOW_UNUSED_LOCAL(instanceTemplate);
......
...@@ -53,6 +53,20 @@ static void readonlyStringAttributeAttributeGetterCallback(const v8::FunctionCal ...@@ -53,6 +53,20 @@ static void readonlyStringAttributeAttributeGetterCallback(const v8::FunctionCal
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
} }
static void isTrustedAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
TestInterfaceEventInitConstructor* impl = V8TestInterfaceEventInitConstructor::toImpl(holder);
v8SetReturnValueBool(info, impl->isTrusted());
}
static void isTrustedAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
TestInterfaceEventInitConstructorV8Internal::isTrustedAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{ {
ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceEventInitConstructor", info.Holder(), info.GetIsolate()); ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceEventInitConstructor", info.Holder(), info.GetIsolate());
...@@ -119,6 +133,11 @@ static void installV8TestInterfaceEventInitConstructorTemplate(v8::Local<v8::Fun ...@@ -119,6 +133,11 @@ static void installV8TestInterfaceEventInitConstructorTemplate(v8::Local<v8::Fun
ALLOW_UNUSED_LOCAL(instanceTemplate); ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate(); v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
ALLOW_UNUSED_LOCAL(prototypeTemplate); ALLOW_UNUSED_LOCAL(prototypeTemplate);
if (RuntimeEnabledFeatures::trustedEventsEnabled()) {
static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = \
{"isTrusted", TestInterfaceEventInitConstructorV8Internal::isTrustedAttributeGetterCallback, 0, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::DontDelete), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOMConfiguration::CheckHolder};
V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessorConfiguration);
}
// Custom toString template // Custom toString template
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate()); functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
......
...@@ -26,11 +26,4 @@ ...@@ -26,11 +26,4 @@
// https://dom.spec.whatwg.org/#xmldocument // https://dom.spec.whatwg.org/#xmldocument
interface XMLDocument : Document { interface XMLDocument : Document {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that Document already defined 'location' attribute and this interface
// redefine it.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[PutForwards=href, Unforgeable] readonly attribute Location? location;
}; };
...@@ -24,14 +24,6 @@ ...@@ -24,14 +24,6 @@
// https://html.spec.whatwg.org/#the-window-object // https://html.spec.whatwg.org/#the-window-object
interface HTMLDocument : Document { interface HTMLDocument : Document {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that Document already defined 'location' attribute and this interface
// redefine it.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[PutForwards=href, Unforgeable] readonly attribute Location? location;
// https://html.spec.whatwg.org/#Document-partial // https://html.spec.whatwg.org/#Document-partial
// FIXME: *Color should have [TreatNullAs=EmptyString]. // FIXME: *Color should have [TreatNullAs=EmptyString].
......
// Copyright 2015 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/#self-caches
[
RuntimeEnabled=GlobalCacheStorage,
ImplementedAs=GlobalCacheStorage,
] partial interface CompositorWorkerGlobalScope {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that {,Dedicated,Shared,Compositor,Service}WorkerGlobalScope redefine
// 'caches' attribute.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches;
};
// Copyright 2015 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/#self-caches
[
RuntimeEnabled=GlobalCacheStorage,
ImplementedAs=GlobalCacheStorage,
] partial interface DedicatedWorkerGlobalScope {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that {,Dedicated,Shared,Compositor,Service}WorkerGlobalScope redefine
// 'caches' attribute.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches;
};
// Copyright 2015 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/#self-caches
[
RuntimeEnabled=GlobalCacheStorage,
ImplementedAs=GlobalCacheStorage,
] partial interface ServiceWorkerGlobalScope {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that {,Dedicated,Shared,Compositor,Service}WorkerGlobalScope redefine
// 'caches' attribute.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches;
};
// Copyright 2015 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/#self-caches
[
RuntimeEnabled=GlobalCacheStorage,
ImplementedAs=GlobalCacheStorage,
] partial interface SharedWorkerGlobalScope {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that {,Dedicated,Shared,Compositor,Service}WorkerGlobalScope redefine
// 'caches' attribute.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches;
};
...@@ -7,11 +7,5 @@ ...@@ -7,11 +7,5 @@
RuntimeEnabled=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage,
ImplementedAs=GlobalCacheStorage, ImplementedAs=GlobalCacheStorage,
] partial interface WorkerGlobalScope { ] partial interface WorkerGlobalScope {
// Inheritance of [Unforgeable] attributes is not supported. So we have to
// define the same unforgeable attributes in derived interfaces as well.
// See that {,Dedicated,Shared,Compositor,Service}WorkerGlobalScope redefine
// 'caches' attribute.
// Keep all the definitions consistent.
// TODO(yukishiino): Support inheritance of attributes defined on instance.
[Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches; [Unforgeable, MeasureAs=GlobalCacheStorage, RuntimeEnabled=GlobalCacheStorage, RaisesException] readonly attribute CacheStorage caches;
}; };
...@@ -299,10 +299,6 @@ ...@@ -299,10 +299,6 @@
'battery/NavigatorBattery.idl', 'battery/NavigatorBattery.idl',
'beacon/NavigatorBeacon.idl', 'beacon/NavigatorBeacon.idl',
'bluetooth/NavigatorBluetooth.idl', 'bluetooth/NavigatorBluetooth.idl',
'cachestorage/CompositorWorkerCacheStorage.idl',
'cachestorage/DedicatedWorkerCacheStorage.idl',
'cachestorage/ServiceWorkerCacheStorage.idl',
'cachestorage/SharedWorkerCacheStorage.idl',
'cachestorage/WindowCacheStorage.idl', 'cachestorage/WindowCacheStorage.idl',
'cachestorage/WorkerCacheStorage.idl', 'cachestorage/WorkerCacheStorage.idl',
'canvas2d/CanvasPathMethods.idl', 'canvas2d/CanvasPathMethods.idl',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment