Commit f904e6a0 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

Web IDL: Drop support of [PrimaryGlobal]

This CL drops support of an IDL extended attribute [PrimaryGlobal],
and cleans up some comments about it.


Bug: 792432
Change-Id: I6f476966e08a5dbd58aca5e72ad41bb9e8bb89bb
Reviewed-on: https://chromium-review.googlesource.com/c/1329709Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607163}
parent 91258a8f
......@@ -261,7 +261,7 @@ Calling the `[EnforceRange]` version of `setColorEnforced()` with an out of rang
Standard: [Exposed](http://heycam.github.io/webidl/#Exposed)
Summary: Indicates on which global object or objects (e.g., Window, WorkerGlobalScope) the interface property is generated, i.e., in which global scope or scopes an interface exists. This is primarily of interest for the constructor, i.e., the [interface object Call method](https://heycam.github.io/webidl/#es-interface-call). Global context defaults to Window (the primary global scope) if not present, overridden by standard extended attribute `[NoInterfaceObject]` (the value of the property on the global object corresponding to the interface is called the **interface object**), which results in no interface property being generated.
Summary: Indicates on which global object or objects (e.g., Window, WorkerGlobalScope) the interface property is generated, i.e., in which global scope or scopes an interface exists. This is primarily of interest for the constructor, i.e., the [interface object Call method](https://heycam.github.io/webidl/#es-interface-call). If `[Exposed]` is not present or overridden by a standard extended attribute `[NoInterfaceObject]` (the value of the property on the global object corresponding to the interface is called the **interface object**), which results in no interface property being generated.
As with `[NoInterfaceObject]` does not affect generated code for the interface itself, only the code for the corresponding global object. A partial interface is generated at build time, containing an attribute for each interface property on that global object.
......@@ -297,15 +297,15 @@ Exposed can also be specified with a method, attribute and constant.
As a Blink-specific extension, we allow `Exposed(Arguments)` form, such as `[Exposed(Window Feature1, DedicatedWorker Feature2)]`. You can use this form to vary the exposing global scope based on runtime enabled features. For example, `[Exposed(Window Feature1, Worker Feature2)]` exposes the qualified element to Window if "Feature1" is enabled and to Worker if "Feature2" is enabled.
### [Global] and [PrimaryGlobal] _(i)_
### [Global] _(i)_
Standard: [Global](http://heycam.github.io/webidl/#Global)
Summary: The `[Global]` and `[PrimaryGlobal]` extended attributes can be used to give a name to one or more global interfaces, which can then be referenced by the `[Exposed]` extended attribute.
Summary: The `[Global]` extended attribute can be used to give a name to one or more global interfaces, which can then be referenced by the `[Exposed]` extended attribute.
These extended attributes must either take no arguments or take an identifier list.
This extended attribute must either take an identifier or take an identifier list.
If the `[Global]` or `[PrimaryGlobal]` extended attribute is declared with an identifier list argument, then those identifiers are the interface’s global names; otherwise, the interface has a single global name, which is the interface's identifier.
The identifier argument or identifier list argument the `[Global]` extended attribute is declared with define the interface's global names
### [HTMLConstructor]
......
......@@ -79,7 +79,6 @@ OverrideBuiltins
PartialInterfaceImplementedAs=*
PermissiveDictionaryConversion
PerWorldBindings
PrimaryGlobal=|*
PutForwards=*
RaisesException=|Getter|Setter|Constructor
Reflect=|*
......
......@@ -6,7 +6,7 @@
"""Compute global objects.
Global objects are defined by interfaces with [Global] or [PrimaryGlobal] on
Global objects are defined by interfaces with [Global] on
their definition: http://heycam.github.io/webidl/#Global
Design document: http://www.chromium.org/developers/design-documents/idl-build
......@@ -25,11 +25,6 @@ from utilities import read_file_to_list
from utilities import read_pickle_files
from utilities import write_pickle_file
GLOBAL_EXTENDED_ATTRIBUTES = frozenset([
'Global',
'PrimaryGlobal',
])
def parse_options():
usage = 'Usage: %prog [options] [GlobalObjects.pickle]'
......@@ -57,29 +52,22 @@ def dict_union(dicts):
def idl_file_to_global_names(idl_filename):
"""Returns global names, if any, for an IDL file.
If the [Global] or [PrimaryGlobal] extended attribute is declared with an
identifier list argument, then those identifiers are the interface's global
names; otherwise, the interface has a single global name, which is the
interface's identifier (http://heycam.github.io/webidl/#Global).
The identifier argument or identifier list argument the [Global] extended
attribute is declared with define the interface's global names
(http://heycam.github.io/webidl/#Global).
"""
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)
interface_name = get_first_interface_name_from_idl(idl_file_contents)
global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(
extended_attributes.iterkeys())
if not global_keys:
if 'Global' not in extended_attributes:
return
if len(global_keys) > 1:
raise ValueError('The [Global] and [PrimaryGlobal] extended attributes '
'MUST NOT be declared on the same interface.')
global_key = next(iter(global_keys))
global_value = extended_attributes[global_key]
if global_value:
return global_value.strip('()').split(',')
return [interface_name]
global_value = extended_attributes['Global']
if not global_value:
raise ValueError('[Global] must take an indentifier or an identifier list.\n' +
full_path)
return global_value.strip('()').split(',')
def idl_files_to_interface_name_global_names(idl_files):
......
......@@ -175,8 +175,7 @@ def main():
if not exposed_global_names.issubset(known_global_names):
unknown_global_names = exposed_global_names.difference(known_global_names)
raise ValueError('The following global names were used in '
'[Exposed=xxx] but do not match any [Global] / '
'[PrimaryGlobal] interface: %s'
'[Exposed=xxx] but do not match any global names: %s'
% list(unknown_global_names))
# Write partial interfaces containing constructor attributes for each
......
......@@ -75,8 +75,7 @@ def read_idl_file(reader, idl_filename):
def interface_is_global(interface):
return ('Global' in interface.extended_attributes or
'PrimaryGlobal' in interface.extended_attributes)
return 'Global' in interface.extended_attributes
def origin_trial_features_info(info_provider, reader, idl_filenames, target_component):
......
......@@ -94,8 +94,7 @@ class InterfaceTemplateContextBuilder(object):
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)
is_global = 'Global' in interface.extended_attributes
named_property_getter = v8_interface.property_getter(
interface.named_property_getter, ['name'])
......
......@@ -248,9 +248,8 @@ def interface_context(interface, interfaces):
includes.add('bindings/core/v8/binding_security.h')
includes.add('core/frame/local_dom_window.h')
# [PrimaryGlobal] and [Global]
is_global = ('PrimaryGlobal' in extended_attributes or
'Global' in extended_attributes)
# [Global]
is_global = 'Global' in extended_attributes
# [ImmutablePrototype]
# TODO(littledan): Is it possible to deduce this based on inheritance,
......
......@@ -466,14 +466,14 @@ def is_legacy_interface_type_checking(interface, member):
'LegacyInterfaceTypeChecking' in member.extended_attributes)
# [Unforgeable], [Global], [PrimaryGlobal]
# [Unforgeable], [Global]
def on_instance(interface, member):
"""Returns True if the interface's member needs to be defined on every
instance object.
The following members must be defined on an instance object.
- [Unforgeable] members
- regular members of [Global] or [PrimaryGlobal] interfaces
- regular members of [Global] interfaces
"""
if member.is_static:
return False
......@@ -488,8 +488,7 @@ def on_instance(interface, member):
if is_constructor_attribute(member):
return True
if ('PrimaryGlobal' in interface.extended_attributes or
'Global' in interface.extended_attributes or
if ('Global' in interface.extended_attributes or
'Unforgeable' in member.extended_attributes):
return True
return False
......@@ -503,8 +502,8 @@ def on_prototype(interface, member):
follows.
- static members (optional)
- [Unforgeable] members
- members of [Global] or [PrimaryGlobal] interfaces
- named properties of [Global] or [PrimaryGlobal] interfaces
- members of [Global] interfaces
- named properties of [Global] interfaces
"""
if member.is_static:
return False
......@@ -519,8 +518,7 @@ def on_prototype(interface, member):
if is_constructor_attribute(member):
return False
if ('PrimaryGlobal' in interface.extended_attributes or
'Global' in interface.extended_attributes or
if ('Global' in interface.extended_attributes or
'Unforgeable' in member.extended_attributes):
return False
return True
......
......@@ -514,7 +514,7 @@ static void install{{v8_class}}Template(
{%+ if is_global %}instanceTemplate{% else %}prototypeTemplate{% endif %}->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum);
{% if iterable %}
{% if is_global %}
#error "iterable<V> on [Global] and [PrimaryGlobal] is currently unsupported."
#error "iterable<V> on [Global] is currently unsupported."
{% endif %}
// For value iterators, the properties below must originally be set to the corresponding ones in %ArrayPrototype%.
// See https://heycam.github.io/webidl/#es-iterators.
......
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