Andreas Kling
0a09eaf3a1
LibJS+LibTest: Use JS::Script and JS::SourceTextModule in test-js
...
Instead of creating a Parser and Lexer manually in test-js, we now
use either JS::Script::parse() or JS::SourceTextModule::parse()
to load tests.
2021-09-14 21:41:51 +02:00
Andreas Kling
10c489713d
LibJS+LibWeb: Let JS::Script::parse() return a list of errors (on error)
...
These are really supposed to be a list of SyntaxError objects, but for
now we simply return all the Parser::Error objects we got from Parser.
2021-09-14 21:41:51 +02:00
Andreas Kling
5fa02b8a9e
LibJS: Add a barebones SourceTextModule class
...
This corresponds to "Source Text Module Record" from the spec.
2021-09-14 21:41:51 +02:00
Andreas Kling
405b8e7915
LibTest: Decorate cleanup_and_exit() with [[noreturn]]
2021-09-14 21:41:51 +02:00
Andreas Kling
f08a46bd9e
LibJS: Make JS::Script keep the VM alive
...
Script has a Handle member (m_realm), and for handles to remain valid,
the VM must stay alive.
2021-09-14 21:41:51 +02:00
Andreas Kling
d553fd7f4f
LibJS: Add a barebones Module class
...
This corresponds to the "Abstract Module Record" from the spec.
2021-09-14 21:41:51 +02:00
Andreas Kling
df5414f47f
LibJS: Reorganize ExecutionContext a little bit
...
- Move it to a separate header file
- Annotate the members that represent spec slots
- Reorganize the members (by spec vs non-spec)
2021-09-14 21:41:51 +02:00
Ali Mohammad Pur
72ddaa31e3
LibJS: Implement parsing and execution of optional chains
2021-09-14 20:03:27 +01:00
Ali Mohammad Pur
4f7e14e0aa
LibJS: Reorder the global eval function call detection conditions a bit
...
This just makes it clearer, since the actual check is off-screen, making
the reader wonder what that check is for.
2021-09-14 20:03:27 +01:00
Ali Mohammad Pur
f7a68ae998
LibJS: Mark two JS::Reference functions const
...
These two are inherently const, and the next commit needs to call them
on a const object, so let's just mark them const.
2021-09-14 20:03:27 +01:00
Ali Mohammad Pur
bf0315ff8f
LibRegex: Avoid excessive Vector copy when compiling regexps
...
Previously we would've copied the bytecode instead of moving the chunks
around, use the fancy new DisjointChunks<T> abstraction to make that
happen automagically.
This decreases vector copies and uses of memmove() by nearly 10x :^)
2021-09-14 21:33:15 +04:30
Andreas Kling
910de95e7a
LibJS: Add a fast failure path to try_parse_arrow_function_expression()
...
The save/load of parser state performed by lookahead parsing is quite
expensive so let's try to avoid it in the most common case.
This is a 15-20% speedup on various chunks of JS I've tested. :^)
2021-09-14 02:51:16 +02:00
Linus Groh
a50e33abe3
LibJS: Skip ID_{Start,Continue} property lookup for any ASCII characters
...
Before this change, Lexer::is_identifier_{start,middle}() would do a
Unicode property lookup via Unicode::code_point_has_property() quite
frequently, especially for common characters like .,;{}[]() etc.
Since these and any other ASCII characters not covered by the alpha /
alphanumeric check are known to not have the ID_Start / ID_Continue
(except '_', which is special-cased now) properties, we can easily
avoid this function call.
2021-09-14 02:48:57 +02:00
Luke Wilde
e4d97add3d
LibWeb: Implement ParentNode.children
...
Required by Web Platform Tests for the innerHTML/outerHTML tests.
2021-09-14 02:09:18 +02:00
Luke Wilde
8e0f3436a2
LibWeb: Make the innerHTML setter spec compliant
...
This adds innerHTML to ShadowRoot in the process.
2021-09-14 02:09:18 +02:00
Luke Wilde
f62477c093
LibWeb: Implement HTML fragment serialisation and use it in innerHTML
...
The previous implementation was about a half implementation and was
tied to Element::innerHTML. This separates it and puts it into
HTMLDocumentParser, as this is in the parsing section of the spec.
This provides a near finished HTML fragment serialisation algorithm,
bar namespaces in attributes and the `is` value.
2021-09-14 02:09:18 +02:00
Idan Horowitz
ed5128d759
LibWeb: Add the URL::{protocol, pathname, search, hash} attributes
2021-09-14 00:14:45 +02:00
Idan Horowitz
7f9818bcbc
LibWeb: Add the URL::host, URL::hostname & URL:port attributes
2021-09-14 00:14:45 +02:00
Idan Horowitz
e89320887e
LibWeb: Add the URL::username, URL::password & URL::origin attributes
2021-09-14 00:14:45 +02:00
Idan Horowitz
fe32c9c3bd
LibWeb: Add the URL::searchParams attribute
2021-09-14 00:14:45 +02:00
Idan Horowitz
1841fbd3e4
LibWeb: Add the URL::href attribute and URL::to_json method
2021-09-14 00:14:45 +02:00
Idan Horowitz
e6abc1b44e
LibWeb: Add a bare implementation of the URL built-in
...
This only has the constructor implemented for now.
2021-09-14 00:14:45 +02:00
Idan Horowitz
d6cfa34667
AK: Make URL::m_port an Optional<u16>, Expose raw port getter
...
Our current way of signalling a missing port with m_port == 0 was
lacking, as 0 is a valid port number in URLs.
2021-09-14 00:14:45 +02:00
Idan Horowitz
af5b62d8cd
LibWeb: Move url_{encode, decode} to URL/URLSearchParams.{h, cpp}
...
The new URL built-in that will reside in URL.{h, cpp} will have an
URLSearchParams member, which means it has to include its header, and
as such URLSearchParams.h can't include URL's header, which it needs as
it uses the url_{encode, decode} functions.
2021-09-14 00:14:45 +02:00
Mustafa Quraish
0f749681a9
Everywhere: Use my fancy new serenityos.org email :^)
2021-09-13 20:51:50 +00:00
Andreas Kling
bf86419979
LibWeb: Use ComputedCSSStyleDeclaration to generate data for inspector
2021-09-13 22:21:57 +02:00
Andreas Kling
3ca2e701e6
LibJS: Log scripts parsed by JS::Script::parse() and how long it took
2021-09-13 22:21:57 +02:00
Tobias Christiansen
416559414c
LibWeb: Use right dimension when positioning flex-items
...
Previously the cross-size was used to determine the position along the
main axis which is obviously wrong.
2021-09-13 21:20:35 +01:00
Linus Groh
8cd4a889fe
LibWeb: Stop dumping selectors in ParentNode::query_selector{,_all}()
...
This isn't particularly useful (anymore), especially without any context
about _why_ this output suddenly appears in the debug console.
2021-09-13 21:16:33 +01:00
Linus Groh
35cc579264
LibJS: Also set ExecutionContext::realm in Bytecode::Interpreter::run()
...
I forgot to consider the bytecode Interpreter when adding a Realm to the
ExecutionContext. This should make it a lot less crashy again :^)
2021-09-13 21:06:18 +01:00
Tobias Christiansen
1d47ec380f
LibWeb: FlexBox: Use correct source when querying for the main size
...
This was an error in understanding what calculated_values are and that
those are not what is wanted when getting the main available size of the
box in the FlexFormattingContext.
The calculation around the size calculation is still a bit wonky, but
this is definietly better.
2021-09-13 21:37:16 +02:00
Tobias Christiansen
4c1da4d43a
LibWeb: Fix opacity ComputedCSSStyleDeclaration
...
There was a classic copy&paste error, opacity wasn't getting the right
computed value to convert.
2021-09-13 21:26:31 +02:00
Tobias Christiansen
f160fe0407
LibWeb: Add support for a bunch of ComputedCSSStyleDeclarations
...
This patch adds support for a whole lot of other more easy
ComputedCSSStyleDeclararions.
2021-09-13 20:31:06 +02:00
Andreas Kling
daead75e9c
LibGfx/TTF: Ignore unsupported composite glyph flags
...
Replace some program-stopping TODO()'s with FIXME comments, since many
fonts actually render mostly fine without support for all features.
2021-09-13 20:12:58 +02:00
Linus Groh
7c39a5860d
LibJS: Convert Temporal.ZonedDateTime.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
297bf19508
LibJS: Convert Temporal.TimeZone.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
fdd26567c1
LibJS: Convert Temporal.PlainYearMonth.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
06f3defcf5
LibJS: Convert Temporal.PlainTime.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
6e5d6060fa
LibJS: Convert Temporal.PlainMonthDay.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
c47c660477
LibJS: Convert Temporal.PlainDateTime.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
0a30705cf2
LibJS: Convert Temporal.PlainDate.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
7314d05ca7
LibJS: Convert Temporal.Instant.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
a5f559f38a
LibJS: Convert Temporal.Duration.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
47bbdd157f
LibJS: Convert Temporal.Calendar.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
8253e14818
LibJS: Convert Intl.NumberFormat.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
b0c1179ff8
LibJS: Convert Intl.Locale.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
c277658ca6
LibJS: Convert Intl.ListFormat.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
b256b50476
LibJS: Convert Intl.DisplayNames.prototype to be a PrototypeObject
2021-09-13 19:07:26 +01:00
Linus Groh
a9c33b5bbd
LibJS: Remove leftover typed_this() declarations
2021-09-13 19:07:26 +01:00
Andreas Kling
5b19e9239a
LibC: Upgrade memmove() to memcpy() when possible
...
We were missing out on opportunities to use memcpy() instead of
memmove() when the source and destination don't overlap.
2021-09-13 19:11:33 +02:00