Commit Graph
6752 Commits
Author SHA1 Message Date
Karl Seguin 3dcdea77eb Merge pull request #2739 from navidemad/fix-select-type-option-label
webapi: implement HTMLSelectElement.type and HTMLOptionElement.label
2026-06-14 13:38:38 +08:00
Navid EMAD a66c13ecf3 webapi: implement HTMLSelectElement.type and HTMLOptionElement.label
Both IDL attributes were unimplemented and evaluated to `undefined`.
`select.type` reflects the element's mode: "select-multiple" when the
`multiple` attribute is present, "select-one" otherwise (derived from the
existing `getMultiple()`). `option.label` returns the `label` content
attribute when present and non-empty, otherwise the value of the `text`
IDL attribute. Both match the HTML Living Standard.

Select-enhancement libraries branch on `select.type` to choose single- vs
multi-select code paths; reading `undefined` there made them take a dead
path and throw during initialization.

Closes #2738
2026-06-13 15:12:17 +02:00
Karl Seguin ab53f92a11 Merge pull request #2731 from navidemad/fix-a48-console-log-warning-types
cdp: report console.log/console.warn with their own consoleAPICalled types
2026-06-13 12:22:34 +08:00
Karl Seguin ead5000048 Merge pull request #2726 from navidemad/fix-navigator-gpc-default
webapi: default navigator.globalPrivacyControl to false
2026-06-13 11:42:34 +08:00
Navid EMAD b136b3a84d cdp: report console.log/console.warn with their own consoleAPICalled types
console.log and console.warn were both dispatched as .info, so
Runtime.consoleAPICalled (and Console.messageAdded) reported type
"info" for all three of log/info/warn — clients filtering console
output by severity saw them collapsed into one bucket.

Add log/warning members to ConsoleMessageType (the protocol's wire
values — "warning", not "warn") and map console.log -> log,
console.warn -> warning. info/error/debug/trace already matched.

Closes #2730
2026-06-12 19:22:24 +02:00
Navid EMAD 66bbce21e0 webapi: default navigator.globalPrivacyControl to false
Per https://w3c.github.io/gpc/#javascript-property the GPC signal
reflects an explicit user preference to opt out of tracking, and no
such preference is configured anywhere. Firefox defaults the property
to false; Chrome doesn't expose it at all. Returning true made
GPC-compliant consent managers treat every page load as an automated
reject-all and skip their consent UI entirely, diverging from every
default-config real browser.

Adds a value assertion next to the existing doNotTrack check in the
navigator fixture (the accessor-shape walk already covered the
property, but not its value).

Closes #2725
2026-06-12 17:46:18 +02:00
Karl Seguin 1fae856330 Merge pull request #2721 from rohitsux/feat/html-source-reflection
feat(webapi): reflect attributes on HTMLSourceElement
2026-06-12 18:54:18 +08:00
Karl SeguinandClaude Fable 5 67f947f606 Reflect source width/height as unsigned long per spec
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 18:29:46 +08:00
Rohit 7835f133fe feat(webapi): reflect attributes on HTMLSourceElement
Add the reflected IDL attributes to the existing HTMLSourceElement,
which previously reflected none: src (resolved as a URL like
HTMLEmbedElement.src), srcset, sizes, media, type, width and height.

Mirrors the reflection idiom used by HTMLEmbedElement. width and height
are reflected as strings, matching the sibling HTMLEmbedElement
accessors. Adds element/html/source.html covering parse-from-markup,
property/attribute round-trips and src URL resolution.
2026-06-12 11:04:21 +05:30
Karl Seguin 70a70815e4 Merge pull request #2695 from lightpanda-io/offsetParent
webapi: Implement Element.offsetParent getter
2026-06-12 13:01:00 +08:00
Karl Seguin e1851309f0 Merge pull request #2714 from navidemad/fix-a43-redirect-no-location
http: deliver 3xx responses without a Location header as final responses
2026-06-12 12:44:15 +08:00
Karl Seguin 3686fd2600 Stricter redirect status code check
Single Location header lookup
2026-06-12 11:47:27 +08:00
Karl Seguin 9302b31f2d Merge pull request #2712 from navidemad/fix-b17-has-relative-selectors
selector: support relative :has() arguments (:has(> div), :has(~ p))
2026-06-12 11:30:02 +08:00
Karl Seguin 63665f8180 Merge pull request #2710 from navidemad/websocket-origin-header
websocket: send Origin header on upgrade requests
2026-06-12 11:02:30 +08:00
Karl Seguin 64238b3af4 Merge pull request #2708 from navidemad/fix-document-readystatechange
webapi: fire readystatechange at document on readiness changes
2026-06-12 10:48:11 +08:00
Karl Seguin e7e605b65b Merge pull request #2694 from rohitsux/feature/centralize-viewport-default
refactor(viewport): source hardcoded 1920x1080 from MediaQuery.Viewport.default
2026-06-12 09:51:37 +08:00
Karl Seguin 10a35af941 Merge pull request #2658 from lightpanda-io/nikneym/rust-url
`URL`: Rework URL web API with rust-url
2026-06-12 09:33:05 +08:00
Karl Seguin 18fcb089cc Merge pull request #2715 from lightpanda-io/improve_name_test
minor: remove 'leak' word from test name
2026-06-12 09:21:54 +08:00
Karl Seguin 2babfad486 minor: Create ViewPort type
Move logic that was added to MediaQuery into its own ViewPort.
2026-06-12 09:19:48 +08:00
Karl Seguin 01ff034bf4 minor: remove 'leak' word from test name
Keep ability to grep for 'leak' meaningful by not having it show up on success.
The assertion is redundant anyways, presumably no test leaks.
2026-06-12 08:58:19 +08:00
Navid EMAD 6665684abe http: deliver 3xx responses without a Location header as final responses
Every 300-399 status was routed into the redirect path, where the missing
Location header fails the transfer with error.LocationNotFound — the old
document is destroyed and nothing replaces it. Per the fetch standard's
HTTP-redirect fetch ("If locationURL is null, then return response") and
RFC 9110 §15.4, a 3xx without Location is a normal final response whose
body must be delivered. Guard both the redirect dispatch and the 3xx
skip-body branch on the header's presence so such responses fall through
to the regular completion path.

Closes #2713
2026-06-12 02:23:10 +02:00
Navid EMAD 25077d8ddc selector: support relative :has() arguments per Selectors Level 4
:has() arguments may start with an explicit combinator (":has(> div)",
":has(~ p)", ":has(+ span)") and are anchored at the element being
matched. Absolutize each argument at parse time by prepending a :scope
anchor segment, then match candidates with :scope bound to the element,
searching the parent's subtree for sibling-anchored arguments. This also
anchors plain arguments at the element, so ":has(span p)" no longer
false-positives when the span is an ancestor of the element.

Closes #2711
2026-06-12 00:57:57 +02:00
Navid EMAD 9b101a7009 websocket: send Origin header on upgrade requests
The WebSocket opening handshake must carry the document's origin in an
Origin header when initiated from a browser client (RFC 6455 §4.1), and
origin-checking endpoints (CSRF protection on WS servers) reject
upgrades that arrive without it. WebSocket.init already assembles extra
upgrade headers (Sec-WebSocket-Protocol, Cookie) but never added Origin.

Serialize the executing document's origin via URL.getOrigin next to the
existing header setup — "null" for opaque origins (about:blank, data:),
matching what Chrome sends. The TestWSServer captures the upgrade's
Origin header and exposes it via a new get-origin command; an
origin_on_upgrade fixture in websocket.html asserts the served page's
origin arrives on the upgrade.

Closes #2709
2026-06-12 00:27:25 +02:00
Navid EMAD 6b90a7be49 webapi: fire readystatechange at document on readiness changes
Per the HTML Standard's "update the current document readiness" steps,
every change to document.readyState must fire a readystatechange event
at the Document - twice during a normal load: when readiness becomes
interactive (before DOMContentLoaded) and when it becomes complete
(before the load event). The readiness flips in Frame.zig updated
_ready_state but never dispatched the event, so page scripts driving
their lifecycle off readystatechange never observed any transition.

Dispatch the event (non-bubbling, non-cancelable, trusted) right after
each flip, mirroring how DOMContentLoaded is emitted.

Closes #2707
2026-06-11 23:31:36 +02:00
Halil Durak 97cf961d9c Frame: remove incorrect releaseRef calls for Location 2026-06-11 19:18:23 +03:00
Halil Durak 0bb2d1cf53 Frame: change Location reference release order 2026-06-11 19:18:22 +03:00
Halil Durak e57b2c258e URL: U_ -> U 2026-06-11 19:18:22 +03:00
Halil Durak 728080d2e4 History: prefer setHref instead of new URL in replaceState
This is what spec recommends, `pushState` was updated in commits before.
2026-06-11 19:18:22 +03:00
Halil Durak a307833e5a URL: introduce url_parse_with_base
This results in creating one less `Box`; hence should be the preferred way when creating a URL object from a base.
2026-06-11 19:18:22 +03:00
Halil Durak c03569dcb3 Location: update tests 2026-06-11 19:18:21 +03:00
Halil Durak eb6321c61a Document: remove dead Location accessor
The one coming from `Window` is the single source of truth now.
2026-06-11 19:18:21 +03:00
Halil Durak d9731ad6d7 Location: acquire and release Location references properly 2026-06-11 19:18:21 +03:00
Halil Durak 0761ede5ab Location: track lifetime of Location
This is a requirement because of URL object.
2026-06-11 19:18:20 +03:00
Halil Durak 0c15d289e0 URL: track lifetime of the URL object
This essentially holds a Rust Box; so, we deinitialize it when there are no references left.
2026-06-11 19:18:20 +03:00
Halil Durak 88db71221d URL: update tests
Also fixes an FTP related test we had.
2026-06-11 19:18:20 +03:00
Halil Durak 2a6a098001 Frame: adapt to new URL implementation for Location
Now that URL initialization heap-allocates and calls extern functions, this can't happen in comptime.
2026-06-11 19:18:20 +03:00
Halil Durak f5b4370505 Location: expect []const u8 (no-sentinel) for URL-related strings 2026-06-11 19:18:19 +03:00
Halil Durak 0942b16595 URL: migrate search getter/setter, setHref and toString 2026-06-11 19:18:19 +03:00
Halil Durak 6dfeabc999 spread new implementation (phase 1)
Will have to come up with a solution for search getter/setter and URLSearchParams still; We've also encountered with a bug in URLSearchParams, a fix for it will also be included in the second phase.
2026-06-11 19:18:19 +03:00
Halil Durak 12b3d2c9f4 bind & implement more rust-url utilities 2026-06-11 19:18:19 +03:00
Halil Durak 3f006bf912 add rust-url dependency and bindings for it 2026-06-11 19:18:18 +03:00
Karl Seguin e667e279fb webapi: Implement Element.offsetParent getter
Saw this missing API on in the wild, wasn't breaking there.
2026-06-11 15:00:23 +08:00
Rohit 331aa6a71a refactor(viewport): source hardcoded 1920x1080 from MediaQuery.Viewport.default
The default viewport dimensions were duplicated across six independent
sites. Point window.innerWidth/innerHeight, screen.width/height/availWidth,
visualViewport.width/height, Page.getLayoutMetrics and the
IntersectionObserver root rect at the single MediaQuery.Viewport.default
(which already documents itself as the rewire point).

No behavior change: every site keeps the same 1920x1080 values, now from
one source. This is the groundwork requested on #2664 so a future
Emulation.setDeviceMetricsOverride can move all of them together.
2026-06-11 11:59:51 +05:30
Karl Seguin d695ce10c3 Merge pull request #2690 from lightpanda-io/log_shrink
log, mem: Reduce generated code size of logger
2026-06-11 13:52:38 +08:00
Karl Seguin b145519fc3 Merge pull request #2688 from lightpanda-io/script_reentrency_too_strict
script: Force pending script evaluation after evalutate finishes
2026-06-11 12:32:13 +08:00
Karl Seguin 93346ef5a6 mem: reduce generic use in log
Experiment to see if this shrinks the build by any significant amount. Some
investigation did surface this as some of the code we control directly which
did stand out.
2026-06-11 10:21:57 +08:00
Karl Seguin 96becbd296 log, mem: Make scope and msg runtime values to shrink generated code size 2026-06-11 08:41:57 +08:00
Karl Seguin def62ebfa0 Apply endEvaluationWindow in more places 2026-06-11 07:18:14 +08:00
Karl Seguin b0426bab9b Merge pull request #2685 from lightpanda-io/shadow-dom
wpt, shadowdom: Improve shadowdom
2026-06-11 06:45:24 +08:00
Karl Seguin e8e9b0356a script: Force pending script evaluation after evalutate finishes
This commit is in the same vein as 0d9482ccbf. A
dynamic async script which completes during an evalute() does not evaluate if
`is_evaluating == true`. That's good, but we need to make sure that it _does_
eventually get evaluated. As-is, we rely on a done callback to call evaluate()
again which works for all but the last script.

This commit creates a more robust reentrancy flow. is_evaluating still guards
against reentrancy, but a new flag, `evaluate_pending` is set to true. Whenever
`is_evaluating` is set to false if `evaluate_pending` is true, we evaluate().

Similalry, during evaluate(), we better handle completed scripts during
evaluate() and process them immediately (via an outer loop).
2026-06-10 20:14:05 +08:00