Timothy Flynn
4cfeb41c4b
LibWebView+WebContent: Add APIs to manipulate DOM nodes
...
This adds APIs to allow Ispector clients to:
* Change a DOM text or comment node's text data.
* Add, replace, or remove a DOM element's attribute.
* Change a DOM element's tag.
2023-12-04 01:33:57 +01:00
Timothy Flynn
18a4455d43
LibWeb: Do not assume a shadow root has a host
...
After commit ff48b7333c
, we remove shadow
roots from elements that are removed from the DOM. Setting a node's
shadow root to null also sets that shadow root's host to null. Thus, the
comment in Node::is_shadow_including_descendant_of that assumes the host
is always non-null is not true.
The test added here would previously crash when interacting with a node
that is a descendant of a removed shadow root.
2023-12-04 01:33:57 +01:00
Timothy Flynn
fd297a3248
LibWeb: Run the unfocusing steps when a click does not focus anything
...
For example, when clicking the document body outside of a focused input
element, we should unfocus that element.
2023-12-04 01:33:57 +01:00
Timothy Flynn
48240a6fc3
LibWeb: Focus the document element when unfocusing an element
...
Otherwise, the currently focused element remains focused.
2023-12-04 01:33:57 +01:00
Timothy Flynn
3c0c300039
LibWeb: Check all entries in the focus chain when unfocusing a node
...
The way this step was currently implemented, we would bail the unfocus
steps if the node isn't the first entry in the chain.
2023-12-04 01:33:57 +01:00
Timothy Flynn
08ee48606d
LibWeb: Fire a change event on input elements in the focus update steps
...
This ensures the change event is received before the blur event.
2023-12-04 01:33:57 +01:00
Timothy Flynn
301d58e2d9
LibWeb: Fire the change
event synchronously when committing changes
...
The spec does not say to do this asynchronously on a task queue.
2023-12-04 01:33:57 +01:00
Idan Horowitz
b749167506
LibCompress: Fix off-by-one error in generate_huffman_lengths
...
Previously we would calculate the index of the first parent node as
heap.size() (which is initialized to non_zero_freqs), so in the edge
case in which all symbols had a non-zero frequency, we would use the
Size-index entry in the array for both the first symbol's leaf node,
and the first parent node.
The result would either be a non-optimal huffman code (bad), or an
illegal huffman code that would then go on to crash due to an error
check in CanonicalCode::from_bytes. (worse)
We now store parent nodes starting at heap.size() - 1, which eliminates
the potential overlap, and resolves the issue.
2023-12-04 00:06:38 +01:00
Andreas Kling
ec081a2ef5
LibWeb: Don't crash on FormData.append() with emoji in name
...
If you can believe it, we were once again using StringBuilder's append()
when we really wanted append_code_point().
2023-12-04 00:04:04 +01:00
Andreas Kling
0d74ced9b5
LibWeb: Don't crash on Document.createElement() with emoji in tag name
...
Once again, we were mistakenly using StringBuilder's append(char) when
we really wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
1b81e0081d
LibWeb: Don't crash on Element.setAttribute() with emoji in name
...
We were mistakenly using StringBuilder's append(char) when we really
wanted append_code_point(u32).
2023-12-04 00:04:04 +01:00
Andreas Kling
dbca63a1db
LibWeb: Don't get stuck in TreeWalker.nextNode() when current detached
...
This fixes a hang on https://reddit.com/
Spec bug: https://github.com/whatwg/dom/issues/1102
2023-12-03 23:16:26 +01:00
Aliaksandr Kalenik
f93cab7679
LibWeb/Painting: Use scaled font for selected text
...
Fixes regression introduced in:
681771d210
2023-12-03 23:16:17 +01:00
Timothy Flynn
b7c0815469
LibWeb: Remove DeprecatedString usage from HTMLScriptElement's text
...
There was some awkward timing between these APIs being added and the
methods they use being ported to String.
2023-12-03 14:48:36 -05:00
Andreas Kling
c0bacc6c4b
LibWeb: Fix two bad capture-by-reference bugs caught by ASAN
...
In both cases, related to fetching/loading modules.
2023-12-03 20:46:55 +01:00
Andreas Kling
62361e40a1
LibWeb: Set a TemporaryExecutionContext when finishing module loads
...
I'm not entirely sure why this is needed, but it's the same ol'
workaround we're using in a bazillion places where we get caught trying
to do JavaScripty things without a running execution context.
2023-12-03 20:46:55 +01:00
Andreas Kling
58294db294
LibJS: Add successfully loaded modules to the VM's stored module list
...
This ensures that repeated loads of the same module succeed. (There is a
specific criteria where the same exact module object has to be returned
for multiple loads of the same referrer + specifier.)
Note that we don't check the referrer at the moment, that's a FIXME.
2023-12-03 20:46:55 +01:00
Andreas Kling
99106df834
LibJS: Update import referrer's [[LoadedModules]] in place
...
We were previously updating a copy of the list, which meant loading
could not proceed even after a module was loaded.
2023-12-03 20:46:55 +01:00
Andreas Kling
5e67853b49
LibJS: Fix logic typo in ContinueModuleLoading
2023-12-03 20:46:55 +01:00
Andreas Kling
fc31a0d506
LibJS: Support LoadRequestedModule AO on SyntheticModule records
...
This allows test-js to run all the module tests in the new world.
2023-12-03 20:46:55 +01:00
Andreas Kling
4b1053e327
LibJS: Fix logic typo in CyclicModule::inner_module_linking()
...
The comment was right, but the code didn't match.
2023-12-03 20:46:55 +01:00
Andreas Kling
8b7d27b349
LibJS+LibWeb: More bringing module loading closer to spec
...
In particular, this patch removes three host hooks on JS::VM in favor
of the new JS-side module loading stuff.
2023-12-03 20:46:55 +01:00
Andreas Kling
07f567cd9f
LibJS+LibWeb: Another round of bringing module loading closer to spec
...
In particular, this patch focuses on:
- Updating the old "import assertions" to the new "import attributes"
- Allowing realms as module import referrer
2023-12-03 20:46:55 +01:00
Andreas Kling
82977ab44b
LibJS: Implement GetImportedModule and call it where appropriate
...
This breaks module loading temporarily while transitioning.
2023-12-03 20:46:55 +01:00
Andreas Kling
a24c543921
LibJS: Update spec steps & add missing assertions in ResolveExport
2023-12-03 20:46:55 +01:00
Andreas Kling
40d2560a93
LibJS: Update spec steps & add missing assertions in GetExportedNames
2023-12-03 20:46:55 +01:00
Andreas Kling
467a5ceb18
LibJS: Split big VERIFY conditions into smaller ones in CyclicModule
...
This makes assertion failures here more informative.
2023-12-03 20:46:55 +01:00
Andreas Kling
b08683e588
LibWeb: Don't capture stack variables by reference in MainThreadVM hooks
2023-12-03 20:46:55 +01:00
Andreas Kling
0817d8bda6
LibJS+LibWeb: Make CyclicModule & GraphLoadingState GC-allocated
...
This allows them to participate in the ownership graph and fixes a
lifetime issue in module loading found by ASAN.
Co-Authored-By: networkException <networkexception@serenityos.org>
2023-12-03 20:46:55 +01:00
Andreas Kling
aa7501a66a
LibJS: Set initial state of CyclicModule.[[Status]] to NEW
...
This is what the specification tells us to do:
https://tc39.es/ecma262/#cyclic-module-record
Co-Authored-By: networkException <networkexception@serenityos.org>
2023-12-03 20:46:55 +01:00
Bastiaan van der Plaat
01f000acb0
LibWeb: Add HTML col element span attribute
2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
7e6fc9c26e
LibWeb: Add textarea cols and rows attribute
2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
f3db0003c2
LibWeb: Add script element text getter setter
2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
529fd0a65c
LibWeb: Add HTML legend element form getter
2023-12-03 20:29:14 +01:00
Bastiaan van der Plaat
fb7b03d162
LibWeb: Add support for the input size attribute
2023-12-03 20:29:14 +01:00
Kenneth Myhra
d9fb116bcc
Tests/LibWeb: Initialize Blob with string and read it from arrayBuffer()
2023-12-03 20:28:10 +01:00
Kenneth Myhra
b72489409a
Tests/LibWeb: Initialize Blob with string and read it from text()
2023-12-03 20:28:10 +01:00
Kenneth Myhra
000ea9d73b
LibWeb: Avoid crashing because of empty incumbent settings object stack
...
This fixes an issue where we end up in a state where we have no
execution context + a main thread event loop with an empty incumbent
settings object stack.
2023-12-03 20:28:10 +01:00
Lucas CHOLLET
0a80daef90
LibGfx/TIFF: Don't include the null-byte terminator when reading strings
2023-12-03 20:27:00 +01:00
Lucas CHOLLET
a382ea7c1f
LibGfx/TIFF: Consider ASCII and UTF-8 as containers
...
The generator will now create APIs that return a single `String`
instead of a `Vector<String>`.
2023-12-03 20:27:00 +01:00
Shannon Booth
a8caa3edbc
LibWeb/Tests: Add a test to cover byte stream enqueue and respond
2023-12-03 20:26:14 +01:00
Shannon Booth
48aa9fbe07
LibWeb: Implement ReadableByteStreamController.enqueue
2023-12-03 20:26:14 +01:00
Shannon Booth
feb7fbb95d
LibWeb: Implement ReadableStreamBYOBRequest.respond
...
The parameter in IDL is left as an unsigned long instead of an unsigned
long long as the IDL generator does not currently support that.
2023-12-03 20:26:14 +01:00
Shannon Booth
08be5deb3f
LibWeb: Implement AO ReadableByteStreamControllerRespond
2023-12-03 20:26:14 +01:00
Shannon Booth
2ab933e534
LibWeb: Implement AO ReadableByteStreamControllerRespondInternal
2023-12-03 20:26:14 +01:00
Shannon Booth
426cbd8ed3
LibWeb: Implement AO ReadableByteStreamControllerRespondInClosedState
2023-12-03 20:26:14 +01:00
Shannon Booth
be2195cb8c
LibWeb: Implement AO ReadableByteStreamControllerRespondInReadableState
2023-12-03 20:26:14 +01:00
Shannon Booth
0245be70d8
LibWeb: Implement Streams AO CanTransferArrayBuffer
2023-12-03 20:26:14 +01:00
Shannon Booth
9d0700e770
LibWeb: Fix IDL getter for ReadableByteStreamController byobRequest
...
We were previously only returning the controllers current
[[byobRequest]] instead of taking into account pending pull intos.
Rename the getter function which would return the controllers
[[byobRequest]] slot to `raw_byob_request` to differentiate it from
the IDL getter.
This also leaves a FIXME for a spec step which we are also not currently
implementing correctly.
2023-12-03 20:26:14 +01:00
Shannon Booth
1e607f5775
LibWeb: Fix some missing initialize overrides for some Streams classes
...
This is some more motivation for me to get around to automatically
generate these initialize calls at some point.
2023-12-03 20:26:14 +01:00