From 8c6a1f037f18d30f4126f6f3950a468dc1e49f85 Mon Sep 17 00:00:00 2001 From: Mike West Date: Fri, 7 Nov 2025 06:24:42 -0800 Subject: [PATCH] [Origin API] Verify that comparisons are schemeful. https://github.com/whatwg/html/pull/11846#discussion_r2500197421 noted that we should verify schemeful same-site comparison; this CL adds that test. Bug: 434131026 Change-Id: I48878979fc0f8c3dab2caefbe788a14d367e053b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7130621 Reviewed-by: Antonio Sartori Commit-Queue: Mike West Cr-Commit-Position: refs/heads/main@{#1541759} --- .../origin/tentative/api/origin-comparison.any.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/html/browsers/origin/tentative/api/origin-comparison.any.js b/html/browsers/origin/tentative/api/origin-comparison.any.js index e5857675227a0b..f03532b99b4fd7 100644 --- a/html/browsers/origin/tentative/api/origin-comparison.any.js +++ b/html/browsers/origin/tentative/api/origin-comparison.any.js @@ -35,3 +35,14 @@ test(t => { assert_false(a_a.isSameSite(b), "Origins with different registrable domains should not be same-site."); assert_false(a_a.isSameSite(b_b), "Origins with different registrable domains should not be same-site."); }, "Comparison of tuple origins."); + +test(t => { + const http = new Origin("http://a.example"); + const https = new Origin("https://a.example"); + + assert_false(http.isSameOrigin(https), "http is not same-site with https"); + assert_false(https.isSameOrigin(http), "https is not same-site with http"); + + assert_false(http.isSameSite(https), "http is not same-site with https"); + assert_false(https.isSameSite(http), "https is not same-site with http"); +}, "Comparisons are schemeful.");