This fixes 2 separate issues, driven by the [very] broken
/dom/ranges/Range-insertNode.html WPT test.
The first, and simplest, is that when a script element is cloned, its executing
_executed and _force_async flags need to be copied. This prevents double-
execution.
The second is more complicated: dom version tracking (as a caching mechanism
used in various live collection) has to be against the node's owning frame, not
the frame that's executing the JavaScript. This includes both the version
checking and version change (on dom mutation). This introduces a relatively
expensive node -> document -> frame on every mutation and cache read. This is
potentially worth optimizing somehow, in a follow up PR. Two options come to
mind:
1 - Track a single dom version on the Page. Mutation in frame1 invalidates
frame2.
2 - Optimize for the frame-less case. If a page has no frame, then the calling
context should be equal to the owning document's frame.
When Fetch.httpErrorCallback rejects the promise, microtasks are run. Those
microtasks could do anything, including triggering a frame shutdown (e.g. via
a navigation event). The result is that we end up with
httpErrorCallback
httpShutdownCallback
And the code simply isn't designed to handle that. httpErrorCallback now takes
control of the cleanup, capturing the `self._owns_response` in a local, and
disabling so that any nested `httpShutdownCallback` are noops.
Add worker.setInterval, clearInterval, setTimeout, clearTimeout by extracting
the scheduling logic from Window and making it use Execution rather than Frame.
The `pattern` IDL attribute had no accessor registered on
`HTMLInputElement.prototype` (returned undefined despite getAttribute
working), and `Input.suffersPatternMismatch` was a TODO stub returning
false. As a result, `validity.patternMismatch` never fired for
`<input pattern="…">` and `validationMessage` was always empty for
pattern violations.
This change registers `pattern = bridge.accessor(Input.getPattern,
Input.setPattern, .{})` and rewrites `suffersPatternMismatch` to
evaluate `new RegExp("^(?:" + pattern + ")$", "v").test(value)` via
`ls.local.exec` on the owner frame. Strings are JSON-encoded for safe
interpolation. Per HTML §4.10.5.3.5, the constraint applies only to
text-like input types and skips empty values; an unparseable pattern
is ignored. `ValidityState.getPatternMismatch` now takes a `*Frame` so
the regex evaluation can reach the owner frame's V8 scope.
Closes#2351
We want to take in account the pending frame in Runner._tick to continue
to process. If we use only the current frame, we will immediately return
in case of navigation.
During a root navigation, we keep the existing page active until we get
the headers callback from the pending page. Then
Session.commitPendingPage makes the switch.
It delays the deinit of CPD execution context to handle JS execution in
the meantime.
Now session has an array of two pages, _active_idx points to the main
page.
Both active and pending pages share the same frame_id, it must remains
stable. So this PR adds a Request.protect_from_abort to avoid removing
the request form the pending page when deinit the previous active page.