Commit Graph

33184 Commits

Author SHA1 Message Date
Andreas Kling
9358f108c4 LibWeb: Add TreeNode<T>::next_in_pre_order(T* stay_within) variant
This is a scoped variant of the pre-order traversal helper that aborts
when attempting to leave the `stay_within` node.
2022-01-23 01:22:41 +01:00
Linus Groh
1ce6c49f5e LibJS: Make CreateTemporalDuration infallible in PlainYearMonthPrototype
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/05793a8
2022-01-23 00:22:10 +00:00
Linus Groh
e16821f460 LibJS: Avoid ambiguity in TimeZone production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/87a6b0d
2022-01-23 00:22:10 +00:00
Linus Groh
0e3def1d0b LibJS: Don't parse/re-format offset in parse_temporal_time_zone_string()
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6abe146
2022-01-23 00:22:10 +00:00
Linus Groh
31283b5e64 LibJS: Pass valid offset string directly to CreateTemporalTimeZone
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/75490b9
- https://github.com/tc39/proposal-temporal/commit/8b70e4b
2022-01-23 00:22:10 +00:00
Linus Groh
6d744eb4a7 LibJS: Use consistent name for offset strings
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/17f8cdb
2022-01-23 00:22:10 +00:00
Liav A
eb9c8f3895 Kernel/PCI: Add basic support for the VMD PCI bridge device 2022-01-23 01:12:55 +01:00
Jelle Raaijmakers
df73e8b46b Kernel: Allow program headers to align on multiples of PAGE_SIZE
These checks in `sys$execve` could trip up the system whenever you try
to execute an `.so` file. For example, double-clicking `libwasm.so` in
Terminal crashes the kernel.

This changes the program header alignment checks to reflect the same
checks in LibELF, and passes the requested alignment on to
`::try_allocate_range()`.
2022-01-23 00:11:56 +02:00
dayarthvader
67b7bbe1f6 ping: Handle optional field in the IPv4 header 2022-01-22 22:11:21 +00:00
Lady Gegga
194cad0fc1 Base: Update all Yak-emojis to high-res images 2022-01-22 22:05:48 +00:00
Lady Gegga
53be3b41a7 Base: Add 10CD19 & 10CD1A emojis to PUA codepoints
10CD19 (yaksticker), 10CD1A (yakkie)
2022-01-22 22:05:48 +00:00
Idan Horowitz
024ee0a99a CI: Fail Lagom linters step as soon as any linter fails
This prevents linters from covering the failure of previous linters by
overwriting the error code that Azure reads at the end of the step.
2022-01-22 21:40:09 +02:00
Idan Horowitz
bb340f1272 markdown-check: Ignore absolute icon paths
We have no good way to handle these yet, and there's no point in
forcing everyone to skip their pre-commit checks.
2022-01-22 21:40:09 +02:00
Federico Guerinoni
e37af0b073 umount: Port to LibMain 2022-01-22 13:31:52 +02:00
Federico Guerinoni
2291ef6c3c LibCore: Add syscall wrapper for umount() 2022-01-22 13:31:52 +02:00
Thitat Auareesuksakul
96d2c3a827 Keymaps: Add Thai keymap 2022-01-22 10:38:53 +01:00
Emanuele Torre
191566fc97 LibJS: Avoid potential signed integer overflow in CyclicModule.cpp
`auto count = 0;` will declare `count` as a `signed int`.

We don't want that since `count` is used to count the occurence of an
element in an `AK::Vector` that can have up to `SIZE_MAX` elements;
`SIZE_MAX` can overflow a `signed int` more than 4 billion times.
2022-01-22 10:38:41 +01:00
Lenny Maiorani
065525aba0 LibSoftGPU: Configure stats overlay period
Problem:
- The statistics overlay period is hardcoded to 500 ms. This time is
  very short and can result in the values being very "jumpy".

Solution:
- Increasing this value can result in more steady values which is
  useful when trying to evaluate the performance impact of a change. A
  new config value is offered in `Config.h` to let the developer
  change to any value desired.
2022-01-22 08:57:31 +03:30
Nico Weber
3831e5fcff Utilities+Lagom: Remove test-crypto
After 4d5ffd364a, Tests/{LibCrypto,LibTLS} test the same things
and test-crypto has been redundant since then.
2022-01-22 01:44:05 +00:00
Nico Weber
d670c13a3b LibWeb: Make attribute hidden have an effect; hide some other elements
This moves LibWeb to using the list of hidden elements from the spec.

Concretely, the following things are now explicitly marked
`display: none` in addition to before:

- elements with the `hidden` attribute
- area
- base
- basefont
- datalist
- param
- rp

The spec also wants `noframes` and `noembed` to be `display: none`,
but since support for frames and embeds doesn't exist yet, these
are omitted for now.

With this, everyone's favorite website http://45.33.8.238/ no longer
displays spans with attribute hidden. (Whitespace handling still
looks a bit off though.)
2022-01-22 01:28:42 +00:00
Nico Weber
a9c80ba33c LibHTTP: Move more happy-path logging behind CHTTPJOB_DEBUG 2022-01-22 01:28:01 +00:00
Nico Weber
46ffc98ebc LibHTTP: Move more happy-path logging behind HTTPSJOB_DEBUG 2022-01-22 01:28:01 +00:00
Nico Weber
6d532649d4 RequestServer+AK: Move happy-path logging behind REQUESTSERVER_DEBUG
vdbgln() was responsible for ~10% of samples on pv's flamegraph for
RequestServer (under request_did_finish) when loading github.com in
Browser and recording a whole-system profile. This makes that almost
completely disappear.
2022-01-22 01:28:01 +00:00
davidot
0e56dac51e js: Display a warning if multiple files are given
Also instead of making a frankenstein path with all the paths combined
just take the first one, this is needed for resolving modules.
2022-01-22 01:21:18 +00:00
davidot
2d4b345bb1 Spreadsheet: Enable dynamic import of javascript modules
This has some risks as it can (attempt to) load arbitrary files on the
filesystem but for now it can only load local files which do go through
normal file operations. But let's enable it for now to see what we can
do with it.
2022-01-22 01:21:18 +00:00
davidot
986ad3ccf0 LibJS: Use HostImportModuleDynamically in ShadowRealmImportValue
Now that module loading is implemented this just works :^).

Since ShadowRealm explicitly passed a null ScriptOrModule we attempt to
get the top most ScriptOrModule in HostImportModuleDynamically.
This won't work in general as the web specifies other behavior but for
LibJS there must always be an active script to call
HostImportModuleDynamically.
2022-01-22 01:21:18 +00:00
davidot
91b3e5b31f LibJS: Implement the ImportMeta MetaProperty
This "standard" implementation of this is to do nothing.
2022-01-22 01:21:18 +00:00
davidot
7cbf4b90e8 LibJS: Implement ImportCall and HostImportModuleDynamically
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.

This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
2022-01-22 01:21:18 +00:00
davidot
023968a489 LibJS: Implement evaluation of im- and exports statements 2022-01-22 01:21:18 +00:00
davidot
779e677467 LibJS: Implement HostResolveImportedModule for LibJS
This loads modules with relative paths from the referencing module.
In this commit the only way to run a module is via the interpreter
which can link and evaluate a module (and all its dependencies).
2022-01-22 01:21:18 +00:00
davidot
1b8ccf9a66 LibJS: Implement Module linking and evaluating 2022-01-22 01:21:18 +00:00
davidot
be9d478d92 LibJS: Add host layering point related to modules to VM
Also make HostResolveImportedModule fail on the browser to prevent
module loading for now.
2022-01-22 01:21:18 +00:00
davidot
0b89dbc529 Meta: Add JS_MODULE_DEBUG define flag 2022-01-22 01:21:18 +00:00
davidot
55366703d0 LibJS: Add Module Namespace Exotic Object 2022-01-22 01:21:18 +00:00
davidot
0cdbc03de0 LibJS: Add ModuleEnvironment 2022-01-22 01:21:18 +00:00
davidot
12c2f30c54 LibJS: Add filename tracking to Script and Module
This will allow us to resolve modules dynamically loaded from a script.
2022-01-22 01:21:18 +00:00
davidot
57c5a59cab LibJS: Add ScriptOrModule to execution context and track it everywhere 2022-01-22 01:21:18 +00:00
davidot
99edf5b25a LibJS: Track whether a program has a top level await statement 2022-01-22 01:21:18 +00:00
davidot
aca427fc8c LibJS: Make parsing import and export entries follow the spec
The big changes are:
- Allow strings as Module{Export, Import}Name
- Properly track declarations in default export statements

However, the spec is a little strange in that it allows function and
class declarations without a name in default export statements.
This is quite hard to fully implement without rewriting more of the
parser so for now this behavior is emulated by faking things with
function and class expressions. See the comments in
parse_export_statement for details on the hacks and where it goes wrong.
2022-01-22 01:21:18 +00:00
Luke Wilde
631bbcd00a LibJS: Refactor interpreter to use Script and Source Text Modules
This also refactors interpreter creation to follow
InitializeHostDefinedRealm, but I couldn't fit it in the title :^)

This allows us to follow the spec much more closely rather than being
completely ad-hoc with just the parse node instead of having all the
surrounding data such as the realm of the parse node.

The interpreter creation refactor creates the global execution context
once and doesn't take it off the stack. This allows LibWeb to take the
global execution context and manually handle it, following the HTML
spec. The HTML spec calls this the "realm execution context" of the
environment settings object.

It also allows us to specify the globalThis type, as it can be
different from the global object type. For example, on the web, Window
global objects use a WindowProxy global this value to enforce the same
origin policy on operations like [[GetOwnProperty]].

Finally, it allows us to directly call Program::execute in perform_eval
and perform_shadow_realm_eval as this moves
global_declaration_instantiation into Interpreter::run
(ScriptEvaluation) as per the spec.

Note that this doesn't evalulate Source Text Modules yet or refactor
the bytecode interpreter, that's work for future us :^)

This patch was originally build by Luke for the environment settings
object change but was also needed for modules. So I (davidot) have
modified it with the new completion changes and setup for that.

Co-authored-by: davidot <davidot@serenityos.org>
2022-01-22 01:21:18 +00:00
davidot
232a8432b7 LibJS: Move binding_class_declaration_evaluation out of ClassDeclaration 2022-01-22 01:21:18 +00:00
davidot
39b134e8c1 LibJS: Move async_block_start out of ECMAScriptFunctionObject 2022-01-22 01:21:18 +00:00
Ali Mohammad Pur
cd83325c7c LibRegex: Preserve capture groups and matches across ForkReplace
This makes the (flawed) ForkStay inserted as a loop header unnecessary,
and finally fixes LibRegex rewriting weird loops in weird ways.
2022-01-22 00:35:49 +00:00
Ali Mohammad Pur
bc20e4f71d LibRegex: Add some more information to Compare::Reference debug output 2022-01-22 00:35:49 +00:00
Ali Mohammad Pur
97dde09170 LibRegex: Allow ClearCaptureGroup to create new groups
Instead of leaking all capture groups and selectively clearing some,
simply avoid leaking things and only "define" the ones that need to
exist.
This *actually* implements the capture groups ECMA262 quirk.
Also adds the test removed in the previous commit (to avoid messing up
test runs across bisects).
2022-01-22 00:35:49 +00:00
Ali Mohammad Pur
704e0654b3 Revert "LibRegex: Implement an ECMA262 Regex quirk with negative loo..."
This partially reverts commit c11be92e23.
That commit fixes one thing and breaks many more, a next commit will
implement this quirk in a more sane way.
2022-01-22 00:35:49 +00:00
Maciej
e0d3a8f6ce LibGfx: Fix stylistic issues in BitmapFont
* Apply some clang-tidy suggestions
* Convert to east-const
2022-01-22 00:26:23 +00:00
Maciej
b6d6cc5de4 LibGUI: Use Font::glyph_or_emoji_width() in TextEditor
This fixes selection of text containing emoji when variable-width font
is set.
2022-01-22 00:26:23 +00:00
Maciej
8542d1da5a LibGfx: Always scale emojis to fit font height 2022-01-22 00:26:23 +00:00
kleines Filmröllchen
7a92842017 LibCore: Populate the read buffer of Core::Stream::BufferedHelper
Previously, we weren't ever populating the read buffer in read(), which
was making the BufferedHelper useless, how silly :^). This introduces
a buffer refill when we have run out of buffered samples, restoring
FlacLoader performance from the new low of 200% (directly before this
commit) to the old level of ~1400%.
2022-01-22 01:13:42 +03:30