Commit Graph

5810 Commits

Author SHA1 Message Date
Linus Groh
1f7068ace9 LibJS: Remove unused TemporaryChange include from Object.cpp 2021-10-03 21:40:07 +01:00
Andreas Kling
ba0c907a6f LibWeb: Make the URL.port setter return after assigning the empty string
This matches the spec ("3. Otherwise, ...")
2021-10-03 21:31:46 +02:00
Andreas Kling
a7a3f41f67 LibWeb: Implement the HTMLHyperlinkElementUtils mixin
This is used by HTMLAnchorElement and HTMLAreaElement to share
functionality related to their href attribute.
2021-10-03 21:31:46 +02:00
Linus Groh
e5b8544762 LibJS: Convert enumerable_own_property_names() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
3af559ee8a LibJS: Convert test_integrity_level() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
ed5a9aa038 LibJS: Convert set_integrity_level() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
3be26f56db LibJS: Convert has_own_property() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
f38a5957bf LibJS: Convert has_property() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
a29b7a3ec7 LibJS: Convert delete_property_or_throw() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
fe86b04b42 LibJS: Convert define_property_or_throw() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
ebf57df431 LibJS: Convert create_non_enum_data_p_or_throw() to ThrowCompletionOr
The actual name is a bit longer, but you know what I mean :^)
2021-10-03 20:14:03 +01:00
Linus Groh
364dd42fc8 LibJS: Convert create_data_property_or_throw() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
bb2499cd7a LibJS: Convert create_method_property() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
fb443b3fb4 LibJS: Convert create_data_property() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
1d45541278 LibJS: Convert Object::set() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
b7e5f08e56 LibJS: Convert Object::get() to ThrowCompletionOr
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Linus Groh
9b6c09e2c4 LibJS: Convert is_extensible() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
fa2ac5b759 LibJS: Convert ordinary_to_primitive() to ThrowCompletionOr
Also add spec step comments to it while we're here.
2021-10-03 20:14:03 +01:00
Linus Groh
867b19affb LibJS: Convert install_error_cause() to ThrowCompletionOr 2021-10-03 20:14:03 +01:00
Linus Groh
4d5bd092ea LibJS: Use MUST() where applicable 2021-10-03 20:14:03 +01:00
Linus Groh
7cd3f7de61 LibJS: Add a MUST() macro, like TRY() but for the spec's ! shortcut 2021-10-03 20:14:03 +01:00
Ali Mohammad Pur
8f722302d9 LibRegex: Use a match table for character classes
Generate a sorted, compressed series of ranges in a match table for
character classes, and use a binary search to find the matches.
This is about a 3-4x speedup for character class match performance. :^)
2021-10-03 19:16:36 +02:00
Andreas Kling
478b36c37b LibWeb: Only auto-reschedule HTML::EventLoop when there are runnables
HTML::EventLoop tries to reschedule itself when there are more tasks in
any of its queues, but let's not do it if none of them are runnable.
2021-10-03 18:25:15 +02:00
Andreas Kling
9f886d499a LibWeb: Remove unnecessary this capture in RequestAnimationFrameDriver 2021-10-03 18:12:36 +02:00
Andreas Kling
c4be098b7d LibWeb: Remove pointless brackets from Length::to_string()
Since we expose these strings to web content via LengthStyleValue,
let's not have non-standard brackets in there to confuse anyone trying
to parse these values. :^)
2021-10-03 17:59:15 +02:00
Andreas Kling
956968d4b2 LibWeb: Make ColorStyleValue serialization spec compliant
[CSS Color 4] tells us to use either rgb() or rgba() notation, depending
on the color's alpha value.
2021-10-03 17:59:15 +02:00
davidot
04454efa72 LibJS: Fix improper usages of forward as flagged by SonarCloud 2021-10-03 17:42:05 +02:00
davidot
ac808a261f LibJS: Fix that the interpreter did not clear the unwind status
This meant that if some program threw an uncaught exception VM still
had unwind_until set. This caused any further programs to not execute
correctly.
This will be fixed more thoroughly once we use Completions in the AST.

Fixes #10323
2021-10-03 17:42:05 +02:00
davidot
f4f1397735 js: Allow for completion of lexically declared variables
This does require us to have a method which lists all the bindings in
a declarative environment which is not in the spec.
2021-10-03 17:42:05 +02:00
davidot
ac2c3a73b1 LibJS: Add a specific test for invalid unicode characters in the lexer
Also fixes that it tried to make substrings past the end of the source
if we overran the source length.
2021-10-03 17:42:05 +02:00
Andreas Kling
962298b040 LibWeb: Don't update rendering in BrowsingContexts without opportunity
This patch adds the "has a rendering opportunity" concept from the spec
to BrowsingContext and uses it to filter out contexts that are unable
to render right now when doing the event loop's rendering updates.

Note that we actually consider all contexts to have a rendering
opportunity at all times right now. Coming up with reasons to avoid
rendering is left as a FIXME. :^)
2021-10-03 17:39:13 +02:00
Andreas Kling
6e341cd696 LibWeb: Let HTML::EventLoop drive the firing of resize events 2021-10-03 16:42:34 +02:00
Andreas Kling
81ef2b646e LibWeb: Let HTML::EventLoop drive animation frame callbacks 2021-10-03 16:42:34 +02:00
Andreas Kling
ae71e5f99b LibWeb: Let HTML::EventLoop keep track of live DOM::Document objects
This will be used by the event loop processing model.
2021-10-03 16:42:34 +02:00
Andreas Kling
6f0d7245d7 LibWeb: Allow Document::ref() when ref-count is zero
DOM::Document has some special lifetime rules to support the DOM
lifetime semantics expected on the web. Any DOM node will keep its
document alive as well, even after the document's ref-count has reached
zero. This is achieved by the Document::m_referencing_node_count
counter.

Because of this mechanism, we can't VERIFY(m_ref_count) in TreeNode
where T may be a DOM::Document.
2021-10-03 16:42:34 +02:00
Andreas Kling
bbfde63f79 LibWeb: Only take runnable tasks from the HTML task queue
We were previously willing to execute tasks before they had become
runnable.
2021-10-03 16:42:34 +02:00
Andreas Kling
6283c098ad LibWeb: Improve HTML::EventLoop::spin_until()
This algorithm now saved and restores the JavaScript execution context
stack while performing a microtask checkpoint, as the spec mandates.
2021-10-03 16:42:34 +02:00
Andreas Kling
406d3199d0 LibJS: Add a way to save/restore the entire execution context stack
This will be used by LibWeb to squirrel away the stack while performing
a microtask checkpoint in some cases. VM will simply consider saved
execution context stacks as GC roots as well.
2021-10-03 16:42:34 +02:00
Luke Wilde
17e56661db LibWeb: Have CSSStyleRule inherit from CSSRule in IDL
This also allows removing the cssText attribute being on CSSStyleRule.
2021-10-03 16:39:17 +02:00
davidot
1bc945860d Everywhere: Use my awesome new serenityos email :^) 2021-10-03 13:53:47 +01:00
Andreas Kling
97ea277f8f LibWeb: Pass the correct timestamp to requestAnimationFrame callbacks
The timestamp needs to be consistent with the "current high resolution
time" as reflected by window.performance.now
2021-10-03 13:36:40 +02:00
Andreas Kling
5cf439cce0 LibWeb: Run setTimeout() and setInterval() callbacks as HTML tasks
We now invoke DOM timer callbacks via HTML tasks. This brings callback
sequencing closer to the spec, although there are still many
imperfections in this area.
2021-10-03 13:36:40 +02:00
Tim Schumacher
4ef3ed4ba3 LibC: Implement mbrtowc closer to POSIX 2021-10-03 11:13:50 +00:00
Tim Schumacher
212f9308d4 LibC: Specifically clear only stored bytes after successful mbrtowc 2021-10-03 11:13:50 +00:00
Tim Schumacher
06f30943ef LibC: Manually count stored bytes in mbstate_t
This is probably a bit faster than constantly having to look through all
stored bytes. It also helps when we are trying to store actual null
bytes.
2021-10-03 11:13:50 +00:00
Tim Schumacher
3c807402b3 LibC: Remove the mbstate_reset helper
A zero-initialized mbstate_t struct has to be a valid initial state, so
we can just zero-initialize it whenever we need to reset.

Having a helper function for resetting the struct might imply that you
can add additional setup operations afterwards, which is not the case.
2021-10-03 11:13:50 +00:00
Ali Mohammad Pur
ab46864674 LibTLS: Split large application data packets into chunks
Each TLS record has a limited max size, we should respect that and split
the packets.
Fixes RecordOverflow errors when a packet larger than 18432 bytes is
sent over.
2021-10-03 14:42:00 +03:30
Tim Schumacher
c3b14588ec LibC: Stub out swprintf 2021-10-03 05:28:51 +00:00
Tim Schumacher
e82dc7c77a LibC: Stub out wcstold 2021-10-03 05:28:51 +00:00
Tim Schumacher
893d9e8741 LibC: Stub out wcstod 2021-10-03 05:28:51 +00:00