Commit Graph

21 Commits

Author SHA1 Message Date
Linus Groh
c756585deb LibWeb: Ignore -Wshadow in TRY_OR_RETURN_OOM() 2022-12-06 21:31:00 +00:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Andreas Kling
9d4e0ba442 LibWeb: Fix WebIDL overload resolution with platform object arguments
We now check if an argument value is a platform object that implements
the relevant IDL interface when resolving overloads.

This makes passing a Path2D object to CanvasRenderingContext2D.fill()
actually choose the Path2D overload. :^)
2022-11-30 14:43:22 +01:00
Andreas Kling
71067cbc6c LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h
This led to considerable fallout and many files had to be patched with
now-missing include statements.
2022-11-23 16:05:59 +00:00
Linus Groh
a80da456a5 LibWeb: Mark WebIDL::ExceptionOr<T> as [[nodiscard]] 2022-10-31 14:12:44 +00:00
Andrew Kaster
67ceba2e6a LibWeb: Add Exposed attribute and IDL spec links where missing
The intent is to use these to autogenerate prototype declarations for
Window and WorkerGlobalScope classes.

And the spec links are just nice to have :^)
2022-10-09 10:14:57 +02:00
Linus Groh
fc9d587e39 LibJS: Make PromiseCapability GC-allocated
A struct with three raw pointers to other GC'd types is a pretty big
liability, let's just turn this into a Cell itself.
This comes with the additional benefit of being able to capture it in
a lambda effortlessly, without having to create handles for individual
members.
2022-10-02 23:02:27 +01:00
Linus Groh
c2326ec95a LibJS: Move PromiseCapability into its own cpp/h file
This is not strictly connected to PromiseReaction in any way.
Preparation before doing some actual work on it :^)
2022-10-02 23:02:27 +01:00
Andrew Kaster
56b381aac0 LibWeb: Cleanup unecessary uses and includes of HTML::Window
The big global refactor left some stragglers behind for atomicity.

Clean up the rest, and remove a ton of includes of LibWeb/HTML/Window.h
2022-10-01 21:05:32 +01:00
Andrew Kaster
8de7e49a56 LibWeb: Remove unecessary dependence on Window from DOM and WebIDL
These classes only needed Window to get at its realm. Pass a realm
directly to construct DOM and WebIDL classes.

This change importantly removes the guarantee that a Document will
always have a non-null Window object. Only Documents created by a
BrowsingContext will have a non-null Window object. Documents created by
for example, DocumentFragment, will not have a Window (soon).

This incremental commit leaves some workarounds in place to keep other
parts of the code building.
2022-10-01 21:05:32 +01:00
Andrew Kaster
c61a4f35dc LibWeb: Move Web prototypes and constructors to new Intrinsics object
This Intrinsics object hangs off of a new HostDefined struct that takes
the place of EnvironmentSettingsObject as the true [[HostDefined]] slot
on JS::Realm objects created by LibWeb.

This gets the intrinsics off of the GlobalObject, Window, similar to the
previous refactor of LibJS to move the intrinsics into the Realm's
[[Intrinics]] internal slot.

A side effect of this change is that we cannot fully initialize a Window
object until the [[HostDefined]] slot has been installed into the realm,
which happens with the creation of the WindowEnvironmentSettingsObject.

As such, any Window usage that has not been funned through a WindowESO
will not have any cached Web prototyped or constructors, and will not
have Window APIs available to javascript code. Currently this seems
limited to usage of Window in the CSS parser, but a subsequent commit
will clean those up to take Realm as well. However, this commit compiles
so let's cut it off here :^).
2022-10-01 21:05:32 +01:00
Linus Groh
426e32e5c0 LibWeb: Add WebIDL::ExceptionOr constructor for wrapped ValueType
This is copied from JS::ThrowCompletionOr and will allow using them
interchangeably with types wrapped by JS::Value such as JS::Object*.
2022-09-27 14:56:17 +01:00
Linus Groh
4461234898 LibWeb: Support plain (throw) JS::Completion in WebIDL::ExceptionOr
This makes it possible to propagate exceptions from a function that
returns JS::ThrowCompletionOr via TRY() in another function that returns
WebIDL::ExceptionOr.
2022-09-27 14:56:17 +01:00
Linus Groh
37972e9f0c LibWeb: Implement most WebIDL promise operations 2022-09-27 14:56:17 +01:00
Linus Groh
bbaa05fcf9 LibWeb: Move DOMException from DOM/ to WebIDL/ 2022-09-25 19:13:31 +01:00
Linus Groh
ad04d7ac9b LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong
in the DOM directory/namespace - not even DOMException, despite the name
:^)
2022-09-25 19:13:31 +01:00
Linus Groh
2b2ccb3815 LibWeb: Replace 'heycam.github.io' links with 'webidl.spec.whatwg.org' 2022-09-24 19:32:09 +01:00
Linus Groh
86f68eb3c3 LibWeb: Move IDLOverloadResolution from Bindings/ to WebIDL/ 2022-09-24 19:31:39 +01:00
Linus Groh
6480faacb6 LibWeb: Move IDLAbstractOperations from Bindings/ to WebIDL/ 2022-09-24 19:31:39 +01:00
Linus Groh
4f73851afc LibWeb: Move CallbackType from Bindings/ to WebIDL/
Let's stop putting generic types and AOs from the Web IDL spec into
the Bindings namespace and directory in LibWeb, and instead follow our
usual naming rules of 'directory = namespace = spec name'. The IDL
namespace is already used by LibIDL, so Web::WebIDL seems like a good
choice.
2022-09-24 19:31:39 +01:00