When creating an inheritance stack, look up parent interfaces from the
parsed IDL context instead of the current interface's imported modules.
This removes a dependency on explicit #import directives during bindings
generation.
Import WebIDL/Function.idl where TimerHandler uses Function, and let the
bindings generator handle it through the normal callback-function path.
This removes the special C++ mapping for Function and makes TimerHandler
use GC::Root<CallbackType>, matching the generated binding type when IDL
files are parsed together.
Change the IDL parser entry point to a static factory returning an
IDL::Module. Modules now own the parsed file identity and import graph,
with an optional reference to the file's real interface when one exists.
This is a step towards running the IDL generator on files without
an interface defined.
Start making IDL::Context represent the shared IDL world used during
code generation.
Move globally visible parsed IDL such as dictionaries, enums,
typedefs, callbacks, mixins, and partial declarations out of individual
Interface objects and into Context.
The main goal of this change is a step towards invoking the IDL
generator on every IDL file at once, rather than per interface.
In the meantime as standalone improvements, this lets code generation
resolve imported IDL types through the shared Context without copying
imported declarations onto each Interface. It also makes duplicate
local declarations unnecessary for imported shared types, since an
interface can reference an enum or dictionary owned by another
parsed IDL module without re-emitting it itself.
Previously, the LibWeb bindings generator would output multiple per
interface files like Prototype/Constructor/Namespace/GlobalMixin
depending on the contents of that IDL file.
This complicates the build system as it means that it does not know
what files will be generated without knowledge of the contents of that
IDL file.
Instead, for each IDL file only generate a single Bindings/<IDLFile>.h
and Bindings/<IDLFile>.cpp.
Remove the special case assignment path for string dictionary members.
The old logic was using the outer dictionary conversion’s optional and
optional_default_value state to decide how to assign an individual
member, which was very confusing and not correct.
This was probably needed on earlier buggier versions of the IDL
generator working around the wrong problem.
Which would be required if we added, for example, IDL which had
the missing types as part of a sequence. Also arange them in
terms of size while we are here.
While this does add some extra cases into the function, this is
effectively a rename to better match how we were effectively already
doing this. Rename the function and link it to the right location in
the specification. Doing this also allows us to drop the FIXME as it
makes it clear what this hardcoded list is meant to achieve.
In other engines, the [CEReactions] extended attribute on an attribute
only applies to the setter steps. Attribute getters never fire custom
element reactions, yet our bindings generator was still pushing a new
element queue onto the custom element reactions stack on entry and
popping + invoking it on return for every single getter call on a
[CEReactions] attribute.
Per https://webidl.spec.whatwg.org/#interface-prototype-object any
global platform object should reject prototype changes (besides
from ShadowRealmGlobalScope), and interface prototype objects on
global prototype chains must be immutable.
We already handled parts of this on the globals themselves, but not
the full chain.
Also align some spec comments to the latest WebIDL spec.
The Cache and CacheStorage interfaces are quite intertwined. A Cache
object can only be created through CacheStorage, so the Cache interface
cannot be tested on its own. So adding just this stub will allow
implementing the CacheStorage interfaces that create Cache objects. We
can then implement the Cache interface piecemeal.
This IDL change is needed for webaudio's WaveShaperNode, where a
null BufferSource for a curve attribute results in a zero-length buffer.
WebGL also has a nullable BufferSource arg in bufferData(...). But
there, a null data/srcData value returns GL_INVALID_VALUE.
generate_to_cpp is called recursively, such as when generating
dictionary values. To support factoring this (massive) function
into functions, add a forward declaration.
Whether a converted value may be null should only depend on the presence
and value of an optional default, not the nullability of the type being
passed in.
[Unscopable] members should only affect the interface prototype’s
@@unscopables object. The bindings generator was also creating an empty
@@unscopables object in define_unforgeable_attributes(), installing it
as an own property on instances.