Commit graph

47751 commits

Author SHA1 Message Date
Luke Wilde
90cc45b7ec LibWeb: Convert Platform::Timer to JS::SafeFunction 2023-03-07 11:51:12 +00:00
Luke Wilde
4bc0d8e4c8 LibJS: Fix compilation of operator= for JS::SafeFunction
operator= for JS::SafeFunction was missing the CallableKind parameter
in the call to init_with_callable. This was not picked up before as
nothing used operator= on JS::SafeFunction.
2023-03-07 11:51:12 +00:00
Luke Wilde
80fad65e5b LibWeb: Add function to EventTarget that says if it has any listeners
Required by XHR to determine if it should use CORS-preflight if its
upload object has any event listeners.
2023-03-07 11:51:12 +00:00
Luke Wilde
acd5382924 LibWeb/Fetch: Set length synchronously in extract_body
Since we don't currently have streams, we didn't set length anywhere.
However, this is required by XHR's reliance on Fetch to get the total
number of bytes for the progress events.
2023-03-07 11:51:12 +00:00
Luke Wilde
e557602d34 LibWeb: Fully read body if there is one in fetch response handover
Required by XHR's reliance on Fetch.
2023-03-07 11:51:12 +00:00
Luke Wilde
cfbd0bbe0a LibWeb/Fetch: Implement Header's "extract a length" function
Required by XHR's reliance on Fetch.
2023-03-07 11:51:12 +00:00
Luke Wilde
ccdb1bcc4e LibWeb/Fetch: Implement Body's "fully read" function from the spec
Required by XHR's reliance on Fetch.
2023-03-07 11:51:12 +00:00
Luke Wilde
9aca54091a LibWeb: Remove the dummy execution context 2023-03-07 11:51:12 +00:00
Luke Wilde
a1f7186153 LibWeb: Make BC::set_system_visibility_state use the active doc's global
Using main_thread_vm().current_realm() will rely on the dummy execution
context if the visibility state changes when no JavaScript is running.
2023-03-07 11:51:12 +00:00
Luke Wilde
9acc542059 LibWeb: Propagate Realm instead of VM more through Fetch
This makes Fetch rely less on using main_thread_vm().current_realm(),
which relies on the dummy execution context if no JavaScript is
currently running.
2023-03-07 11:51:12 +00:00
Luke Wilde
f7ff1fd985 LibWeb: Remove CSS::Parser::ParsingContext's default constructor
This relied on pulling the current realm from the main thread VM, which
requires an execution context to be on the VM's stack. This heavily
relied on the dummy execution context that is always on the stack, for
example, when parsing the UA style sheets where no JavaScript is
running.
2023-03-07 11:51:12 +00:00
Aliaksandr Kalenik
54a1ec2f10 Browser: Handle close event in WebContentView 2023-03-07 11:34:11 +00:00
Aliaksandr Kalenik
59752807c4 Ladybird: Handle close event in WebContentView 2023-03-07 11:34:11 +00:00
Aliaksandr Kalenik
cc41233be4 LibWebView+WebContent: Propagate close from WebContent to LibWebView 2023-03-07 11:34:11 +00:00
Mathis Wiehl
f276e70ac9 Help: Don't defer tree view selection updates
It is unsafe to defer this selection update, because ::open_url itself
is called when users make selection updates, creating a race.

This fixes and infinite selection change loop one could easily reproduce
by holding an up or down arrow key in the tree view while clicking on a
tree view item a couple of times.
2023-03-07 09:50:50 +01:00
Andreas Kling
4797fad91c Shell: Fix bogus C-style casts from NonnullOwnPtr<T>* to T*
Thanks UBSAN for spotting this!
2023-03-07 09:42:20 +01:00
Linus Groh
2258fc273c LibWeb/HighResolutionTime: Add IDL typedef for DOMHighResTimeStamp
We already have this for C++ code in DOMHighResTimeStamp.h, but let's
also avoid using plain 'double' in IDL code.
2023-03-06 23:57:25 +00:00
Sam Atkins
ca30914fe9 LibWeb: Propagate errors from CSS Parser construction
This requires Parser to be movable, so we remove the `default`
destructors from Parser and TokenStream, and give them both move
constructors. Since TokenStream only holds a reference to its tokens,
(and it needs to, to avoid copying when given eg a function's contents,)
we add a manual move constructor for Parser which creates a new
TokenStream from the new Parser's tokens, and then manually copies the
old TokenStream's state.
2023-03-07 00:43:36 +01:00
Sam Atkins
235018046e LibWeb: Use free functions for parsing in @Supports 2023-03-07 00:43:36 +01:00
Sam Atkins
84af8dd9ed LibWeb: Propagate errors from CSS Tokenizer 2023-03-07 00:43:36 +01:00
Sam Atkins
17618989a3 LibWeb: Propagate errors from CSS Tokenizer construction
Instead of constructing a Tokenizer and then calling parse() on it, we
now call `Tokenizer::tokenize(...)` directly. (Renamed from `parse()`
because this is a Tokenizer, not a Parser.)
2023-03-07 00:43:36 +01:00
Mathis Wiehl
98ee2fcd1b man: Skip shellrc when invoking pager using sh
man invokes the pager command via `sh` which, since
beaae6b420 launches `Shell` in posix mode.
As the referenced commits message indicates, launching `Shell` in posix
mode while interactive, makes it choke on the default `.shellrc`. This
made `man` spew out some shell syntax errors to stderr every time it
invoked the pager.

To fix that, invoke `sh` with `--skip-shellrc` for now as suggested by
the aforementioned commit.
2023-03-07 00:42:32 +01:00
Andreas Kling
d1371d66f7 Kernel: Use non-locking {Nonnull,}RefPtr for OpenFileDescription
This patch switches away from {Nonnull,}LockRefPtr to the non-locking
smart pointers throughout the kernel.

I've looked at the handful of places where these were being persisted
and I don't see any race situations.

Note that the process file descriptor table (Process::m_fds) was already
guarded via MutexProtected.
2023-03-07 00:30:12 +01:00
Andreas Kling
36b0ecfe9e Kernel: Remove two outdated FIXMEs about the file descriptor table mutex
These functions cannot be called without already holding the relevant
mutex these days, since m_fds is a MutexProtected object. :^)
2023-03-06 23:46:36 +01:00
Andreas Kling
5aa12da959 AK+Kernel: Remove all the Nonnull*PtrVector classes 2023-03-06 23:46:36 +01:00
Andreas Kling
be91020d0b Settings: Remove outdated comment about NonnullPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling
2973298df1 Assistant: Remove outdated comment about NonnullPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling
b4022dc844 Screensaver: Remove outdated comment about NonnullPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling
f484952167 LibCpp: Remove Nonnull*PtrVector from list of known SerenityOS types 2023-03-06 23:46:36 +01:00
Andreas Kling
d57b09b7cf AK: Remove specialized shuffle for NonnullPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling
7369d0ab5f Kernel: Stop using NonnullLockRefPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling
21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling
689ca370d4 Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
4c75d4af28 LibWeb: Stop using NonnullRefPtrVector for StyleValueVector 2023-03-06 23:46:35 +01:00
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Sam Atkins
104be6c8ac less: Stop adding extra blank lines
Each time we wrapped a line, we were appending an extra blank span which
wasn't needed. This was leading to an extra blank line after every
single line.
2023-03-06 21:44:28 +01:00
timre13
eef07a411b VideoPlayer: Create submenu to set sizing mode
Also add icon to the sizing mode cycling button.
2023-03-06 20:28:22 +00:00
Matthew Olsson
b33b950e45 Lagom: Add a tool to verify correctness of the LibJS GC
This is implemented as a Clang frontend tool, and currently does two
things:
  - Ensure for all fields wrapped in {Nonnull,}GCPtr<T>, T inherits from
    JS::Cell
  - Ensure for all fields not wrapped in {Nonnull,}GCPtr, that the type
    does not inherit from JS::Cell (otherwise it should be wrapped in a
    Ptr class).

In the future, this tool could be extended further. For example, we may
consider validating all implementations of Cell::visit_impl.
2023-03-06 13:05:43 +00:00
Matthew Olsson
176beeb08e LibJS: Enforce proper const-propogation with {Nonnull,}GCPtr 2023-03-06 13:05:43 +00:00
Matthew Olsson
c0b2fa74ac LibWeb: Fix a few const-ness issues 2023-03-06 13:05:43 +00:00
Matthew Olsson
70a2ca7fc0 LibJS: Handle both const and non-const Ts in Handle<T>::create()
Again, the const-ness only really involves Heap-internal metadata, so
the callers shouldn't care about mutations here.
2023-03-06 13:05:43 +00:00
Matthew Olsson
74e93a46ea LibJS: Fix a few const-ness issues 2023-03-06 13:05:43 +00:00
Matthew Olsson
5f0ccfb499 LibJS: Accept const GCPtrs in Cell::Visitor
The const_cast in these methods should be fine since the object really
only needs to be mutable so it's Heap-internal metadata can be altered.
2023-03-06 13:05:43 +00:00
Matthew Olsson
d4b08b7196 LibJS: Use a forwarding reference in ThrowCompletion constructor
This avoids compiler complaints when trying to use const types
2023-03-06 13:05:43 +00:00
Matthew Olsson
17a528c49e LibJS: Temporarily disambiguate const-ness of GCPtr constructors
Without this change, using {Nonnull,}GCPtr<T const> would complain that
there are multiple constructors which resolve to the same type (T& and
T const&). This removes that disambiguation and allows us to slowly fix
all of the constness issues surrounding GCPtrs. This change will not be
necessary in the future as we will be able to remove all of the const
qualifiers from the Ptr classes (they'll be in the template type
instead).
2023-03-06 13:05:43 +00:00
Matthew Olsson
a9372de972 WebContent: Add missing LibGfx include 2023-03-06 13:05:43 +00:00
Matthew Olsson
6003bcfd2d Browser: Add a missing include in InspectorWidget 2023-03-06 13:05:43 +00:00
Matthew Olsson
bab883bf8e LibJS+LibWeb: Add a bunch of missing includes 2023-03-06 13:05:43 +00:00
Matthew Olsson
8dc7810976 LibGfx: Remove unnecessary AK:: prefix in VectorN.h 2023-03-06 13:05:43 +00:00