[whatwg/url] Add URL path equality and prefix comparison (PR #929)

Cookies needs to compare URL paths, both for equality and for whether one path
contains another. Comparing serializations is not right for either: an opaque
path can serialize identically to a list of URL path segments, and one path's
serialization can be a prefix of another's without covering whole segments.

Also let the URL path serializer take a URL path, so that callers holding one no
longer have to inline it, and record that a URL path segment never contains
U+002F (/), which is what makes the prefix comparison meaningful.

Closes #814.

Tests: https://github.com/web-platform-tests/wpt/pull/62165


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/url/929.html" title="Last updated on Aug 23, 2026, 5:46 PM UTC (a93e42b)">Preview</a> | <a href="https://whatpr.org/url/929/55d6699...a93e42b.html" title="Last updated on Aug 23, 2026, 5:46 PM UTC (a93e42b)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/url/pull/929

-- Commit Summary --

  * Add URL path equality and prefix comparison

-- File Changes --

    M url.bs (61)

-- Patch Links --

https://github.com/whatwg/url/pull/929.patch
https://github.com/whatwg/url/pull/929.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/929
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/pull/929@github.com>

Received on Sunday, 23 August 2026 17:46:29 UTC