Commit graph

42375 commits

Author SHA1 Message Date
Xexxa
0968501b62 Base: Add more emoji
🐕 - U+1F415 DOG
🐩 - U+1F429 POODLE
🦌 - U+1F98C DEER
🐖 - U+1F416 PIG
🐁 - U+1F401 MOUSE
🐀 - U+1F400 RAT
🐇 - U+1F407 RABBIT
🐿️ - U+1F43F CHIPMUNK
🦥 - U+1F9A5 SLOTH
🐣 - U+1F423 HATCHING CHICK
🐥 - U+1F425 FRONT-FACING BABY CHICK
🦎 - U+1F98E LIZARD
🦗 - U+1F997 CRICKET
🪳 - U+1FAB3 COCKROACH
🧮 - U+1F9EE ABACUS
2022-10-21 12:18:50 +02:00
Linus Groh
950d2fccf0 LibWeb: Remove workaround for nested BodyInit IDL union type 2022-10-21 12:11:24 +02:00
Linus Groh
775c12f60f LibIDL: Resolve typedefs in UnionType members recursively 2022-10-21 12:11:24 +02:00
Timon Kruiper
cede752cd1 Kernel/aarch64: Stub enough functions to build Random.cpp
Also update Random.cpp such that it builds for aarch64.
2022-10-20 23:26:32 +02:00
Timon Kruiper
a998bba73b Kernel/aarch64: Store a pointer to the current Thread on Processor
And also implemented and update the related functions.
2022-10-20 23:26:32 +02:00
Timon Kruiper
8fe3c50b30 Kernel/aarch64: Force kmalloc to return 16 byte aligned pointers
KUBSAN complained about a misaligned address when trying to construct
the Thread class.
2022-10-20 23:26:32 +02:00
Timon Kruiper
179cb7b2d0 Kernel/aarch64: Stub enough functions to build Process.cpp
ProcessProcFSTraits.cpp is also added the CMakeLists.
2022-10-20 23:26:32 +02:00
Timon Kruiper
84158a18d5 Kernel/aarch64: Stub WaitQueueBlocker::unblock to build WaitQueue.cpp 2022-10-20 23:26:32 +02:00
Timon Kruiper
b69a3ad51a Kernel/aarch64: Stub more functions to build Thread.cpp 2022-10-20 23:26:32 +02:00
grxnola
2c64f7f900 Toolchain: Fix nix-shell; fuse2fs is now part of e2fsprogs derivation 2022-10-20 22:51:11 +02:00
Linus Groh
3b2e5b08d9 LibWeb: Remove dbgln FIXME spam from BindingsGenerator 2022-10-20 22:34:55 +02:00
Sam Atkins
4d9c0c7b22 Browser: Add ability to delete cookies from Storage Inspector
Adds actions to delete either a single cookie, or all of them.

This looks weird, because the GUI doesn't update until you "Inspect >
Open Storage Inspector", but it does function. :^)
2022-10-20 21:52:44 +02:00
Tobias Christiansen
c11462f40e WebDriver: Introduce a WebDriverEndpoints class
This holds the Functions used by the WebDriver to not clutter up the
`Tab.h` file.
2022-10-20 21:48:12 +02:00
Tobias Christiansen
354a845d65 WebDriver: Implement GET /session/{id}/element/{id}/css/{name} 2022-10-20 21:26:10 +02:00
Tobias Christiansen
202b2be1f2 WebContent+Friends: Add IPC and plumbing for WebDriver endpoint
To use the `GET /session/{id}/element/{id}/css/{property name}`
WebDriver endpoint, two new IPC calls through the Browser are
implemented:
    - get_active_documents_type returns the type of the active document,
      which is either "xml" or "html"
    - get_computed_value_for_element returns the computed CSS value (as
      String) for the given element and CSS property name
2022-10-20 21:26:10 +02:00
Andreas Kling
eda566d112 LibWeb: Add GC finalizer to DOM::NodeIterator
It's potentially unsafe to access `m_root` in the destructor since it
may have been swept, so move unregistration of the NodeIterator into a
GC finalizer instead.
2022-10-20 19:46:39 +02:00
Andreas Kling
e7da96acaf LibWeb: Call superclass GC finalizer in DOM::Node::finalize()
There isn't actually anything important happening in the superclasses
right now, but let's be good citizens and call up.
2022-10-20 19:45:17 +02:00
Andreas Kling
1885fe529f LibWeb: Add GC finalizer to Layout::ImageBox
It's not safe to unregister ImageBox from the browsing context in the
destructor (since the browsing context may have already been swept and
destroyed).
2022-10-20 19:36:59 +02:00
Andreas Kling
c877eb47a2 LibWeb: Add GC finalizer for DOM::Node
Now that the layout tree is also GC-allocated, we can't be messing with
it from the DOM::Node destructor. Move everything to a GC finalizer
so we know it runs before the GC sweep phase.
2022-10-20 19:36:59 +02:00
Andreas Kling
07a36c8f80 LibJS: Add a finalization pass to the garbage collector
Doing things in the destructor of a GC-allocated object isn't always
safe, in case it involves accessing other GC-allocated objects.
If they were already swept by GC, we'd be poking into freed memory.

This patch adds a separate finalization pass where GC calls finalize()
on every unmarked cell that's about to be deleted.

It's safe to access other GC objects in finalize(), even if they're
also unmarked.
2022-10-20 19:36:59 +02:00
Andreas Kling
6d830e6335 LibWeb: Tie layout tree to a specific browsing context
Now that both the layout tree and browsing context are GC-allocated,
we can formalize their relationship a bit better by having layout
nodes keep a NonnullGCPtr to the browsing context.

This makes the previously-indirect link direct, removing an unpleasant
"how do we know the browsing context is alive" question when accessing
it from the layout tree.
2022-10-20 19:36:59 +02:00
Timothy Flynn
b9dc0b7d1b AK: Do not append string bytes as code points when title-casing a string
By appending individual bytes as code points, we were "breaking apart"
multi-byte UTF-8 code points. This now behaves the same way as the
invert_case() helper in StringUtils.
2022-10-20 18:55:43 +02:00
Aliaksandr Kalenik
66e424a084 LibWeb: Fix pointer-events check in hit_test 2022-10-20 17:58:16 +02:00
Kenneth Myhra
ebd93c8d57 LibWeb: Revert support for DOM::Document in XHR::send()
This is a manual revert of commit: 7831e62

Let's revert this until we got nested union support in our IDL
generator/parser.
2022-10-20 17:57:52 +02:00
Luke Wilde
645a64ef0f LibWeb: Don't get impl in document_tree_child_browsing_context_count
This caused `Object.getOwnPropertyNames(window)` to throw, as the
`this` value is `Object`.

All users of document_tree_child_browsing_context_count call it on an
existing Window impl, including WP::internal_own_property_keys, so
getting the impl from the JS VM is not necessary.
2022-10-20 17:57:45 +02:00
Andreas Kling
9abe3b0db5 LibWeb: Unbreak layout tree dumps after layout tree GC changes
Layout::Node::class_name() no longer includes the `Web::Layout::` prefix
and thus we don't need to be substringing them in dumps.
2022-10-20 16:06:26 +02:00
Andreas Kling
58522f5088 LibWeb: Make window.{window,self,frames} return the WindowProxy
These now follow the spec and return the WindowProxy rather than the
Window itself.
2022-10-20 16:01:26 +02:00
Andreas Kling
940b455ed0 LibWeb: Teach IDL generator to go from WindowProxy to EventTarget
This case requires some special handling, since there's no direct C++
inheritance relationship between HTML::WindowProxy and DOM::EventTarget.
2022-10-20 15:52:20 +02:00
Andreas Kling
8fd59fce9c LibWeb: Remove unnecessary hack in HTML::Window::initialize()
We don't need to force-set the realm's global object during
initialization anymore, now that intrinsics are set up elsewhere.
2022-10-20 15:31:12 +02:00
Andreas Kling
dc15cacfc3 LibWeb: Use OrderedHashMap to store pending idle callbacks
This removes the need for a separate IdleCallback object per
registration, since the handles are now used as map keys.
2022-10-20 15:16:23 +02:00
Andreas Kling
8875cd0c83 LibWeb: Prevent world leak when activating event handler
Since SafeFunction strongly protects all of its captures, we can't
capture `this` when activating an event handler since that creates a
reference cycle and we end up leaking the entire world.
2022-10-20 15:16:23 +02:00
Andreas Kling
268b9c5d90 LibWeb: Make the layout tree GC-allocated
This removes a set of complex reference cycles between DOM, layout tree
and browsing context.

It also makes lifetimes much easier to reason about, as the DOM and
layout trees are now free to keep each other alive.
2022-10-20 15:16:23 +02:00
Andreas Kling
83c5ff57d8 LibWeb: Make BrowsingContext GC-allocated
(And BrowsingContextGroup had to come along for the ride as well.)
This solves a number of nasty reference cycles between browsing
contexts, history items, and their documents.
2022-10-20 15:16:23 +02:00
Andreas Kling
2898701459 LibWeb: Hang on to the internal realm with a JS::Handle
This fixes an issue where GC would kill the internal realm if it ran at
the wrong time during startup. Found by aggressively GC'ing between
every allocation.
2022-10-20 15:16:23 +02:00
Andreas Kling
6e0f80fbe0 LibWeb: Make the HTMLParser GC-allocated
This prevents a reference cycle between a HTMLParser opened via
document.open() and the document. It was one of many things keeping
some documents alive indefinitely.
2022-10-20 15:16:23 +02:00
Andreas Kling
68452c749a LibWeb: Prevent GC from running during intrinsics allocation
Due to the way we lazily construct prototypes and constructors for web
platform interfaces, it's possible for nested GC allocation to occur
while GC objects have been allocated but not fully constructed.

If the garbage collector ends up running in this state, it may attempt
to call JS::Cell::visit_edges() on an object whose vtable pointer hasn't
been set up yet.

This patch works around the issue by deferring GC while intrinsics are
being brought up. Furthermore, we also create a dummy global object for
the internal realm, and populate it with intrinsics. This works around
the same issue happening when allocating something (like the default UA
stylesheets) in the internal realm.

These solutions are pretty hacky and sad, so I've left FIXMEs about
finding a nicer way.
2022-10-20 15:16:23 +02:00
Andreas Kling
8412206cb4 LibWeb: Cache pseudo element layout nodes weakly on DOM::Element
Having the cache be strong created a reference cycle between DOM nodes
and their pseudo elements.
2022-10-20 15:16:23 +02:00
Andreas Kling
e23fe8cf87 LibJS: Make define_native_foo() take SafeFunctions
We were taking AK::Function and then passing them along to
NativeFunction, which takes a SafeFunction. This works, since
SafeFunction will transparently wrap AK::Function in a CallableWrapper
when assigned, but it was causing us to accumulate thousands of
pointless wrappers around direct function pointers.

By using SafeFunction at every step of the setup call chain, we no
longer create any CallableWrappers for the majority of native functions
in LibJS. Also, the number of heap-registered SafeFunctions in a new
realm goes down from ~5000 to 5. :^)
2022-10-20 15:16:23 +02:00
Andreas Kling
202cc025e5 LibJS: Don't register SafeFunction-to-function-pointer with JS::Heap
Direct function pointers don't have captures, so we don't need to
register the SafeFunction with the Heap when it's just wrapping a
function pointer.
2022-10-20 15:16:23 +02:00
Andreas Kling
be5a39657e LibWeb: Only store one DOM pointer per Layout::Node
Instead of storing two JS::Handles into the DOM, we can combine them
into a single one.

If the layout node is anonymous, m_dom_node points to the DOM::Document.
Otherwise, m_dom_node points to the associated DOM node.

The anonymous state is moved to an m_anonymous boolean member.

This cuts the number of JS::Handles created by the layout tree in half
(and shrinks Layout::Node by 8 bytes).
2022-10-20 15:16:23 +02:00
Andreas Kling
18a5c56f14 LibWeb: Don't store JS::Handle<JS::Promise> in EnvironmentSettingsObject
Now that the ESO is a JS::Cell, we can just store them as NonnullGCPtr
and mark them in visit_edges().
2022-10-20 15:16:23 +02:00
Andreas Kling
dbee75af19 LibWeb: Tear down old layout tree when new document becomes active
When a new document becomes the active document of a browsing context,
we now notify the old document, allowing it to tear down its layout
tree. In the future, there might be more cleanups we'd like to do here.
2022-10-20 15:16:23 +02:00
Andreas Kling
94f0c34dfe LibWeb: Remove unnecessary WeakPtr in queue_microtask_impl()
Capturing a WeakPtr to a GC-allocated object in a JS::SafeFunction is
basically pointless, since the SafeFunction mechanism will then keep
the object alive anyway.
2022-10-20 15:16:23 +02:00
Andreas Kling
57f508f048 LibWeb: Use JS::SafeFunction in run_timer_initialization_steps() 2022-10-20 15:16:23 +02:00
Andreas Kling
a8bdf866d9 LibWeb: Discard old browsing context after obtaining a new one
Cleaning up an old FIXME from before discard was implemented.
2022-10-20 15:16:23 +02:00
Andreas Kling
24510b0845 LibWeb: Make window.parent and window.top return WindowProxy
These functions were previously ad-hoc and returned the active
document's window. They now correctly teturn the browsing context's
WindowProxy instead.
2022-10-20 15:16:23 +02:00
Andreas Kling
3c548adf9c LibWeb: Create and hook up a WindowProxy for each BrowsingContext
All the machinery for this was already in place, we just never created
the actual WindowProxy and installed it.
2022-10-20 15:16:23 +02:00
Andreas Kling
738e770fce LibJS: Remove unnecessary operator==() for ({Nonnull,}GCPtr<T>, T*)
These aren't necessary in the first place since {Nonnull,}GCPtr has
operator T*()
2022-10-20 15:16:23 +02:00
Xexxa
d87e2287dc Snake: Use emoji for in-game food graphics 2022-10-20 10:27:00 +02:00
Moustafa Raafat
8f964604f0 LibJS: Refactor CalendarFields for better linearity
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/9b139a1
2022-10-20 00:53:44 +02:00