Skip to content

Commit 9aa13c3

Browse files
mikewestchromium-wpt-export-bot
authored andcommitted
[Origin API] Drop string parsers beyond .from(...).
Earlier versions of this API parsed strings into `Origin` objects via the constructor, `fromURL()` and `parse()`. We've since coalesced all of these into `Origin.from(...)` after discussion in [1]. This CL removes these variants from our implementation, and adjusts tests accordingly. [1]: whatwg/html#11846 Bug: 434131026 Change-Id: I8be1e1a0923b2cd48dcc7a0f80358237ecc9b88c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7204253 Commit-Queue: Mike West <[email protected]> Reviewed-by: Antonio Sartori <[email protected]> Cr-Commit-Position: refs/heads/main@{#1550470}
1 parent 218e07d commit 9aa13c3

File tree

4 files changed

+12
-163
lines changed

4 files changed

+12
-163
lines changed

html/browsers/origin/tentative/api/origin-comparison.any.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// META: title=`Origin` comparison
22

33
test(t => {
4-
const opaqueA = new Origin("null");
5-
const opaqueB = new Origin("null");
4+
const opaqueA = new Origin();
5+
const opaqueB = new Origin();
6+
assert_true(opaqueA.opaque);
7+
assert_true(opaqueB.opaque);
68

79
assert_true(opaqueA.isSameOrigin(opaqueA), "Opaque origin should be same-origin with itself.");
810
assert_true(opaqueA.isSameSite(opaqueA), "Opaque origin should be same-site with itself.");
@@ -11,11 +13,11 @@ test(t => {
1113
}, "Comparison of opaque origins.");
1214

1315
test(t => {
14-
const a = new Origin("https://a.example");
15-
const a_a = new Origin("https://a.a.example");
16-
const b_a = new Origin("https://b.a.example");
17-
const b = new Origin("https://b.example");
18-
const b_b = new Origin("https://b.b.example");
16+
const a = Origin.from("https://a.example");
17+
const a_a = Origin.from("https://a.a.example");
18+
const b_a = Origin.from("https://b.a.example");
19+
const b = Origin.from("https://b.example");
20+
const b_b = Origin.from("https://b.b.example");
1921

2022
assert_true(a.isSameOrigin(a), "Origin should be same-origin with itself.");
2123
assert_false(a.isSameOrigin(a_a), "Origins with different subdomains should not be same-origin.");
@@ -37,8 +39,8 @@ test(t => {
3739
}, "Comparison of tuple origins.");
3840

3941
test(t => {
40-
const http = new Origin("http://a.example");
41-
const https = new Origin("https://a.example");
42+
const http = Origin.from("http://a.example");
43+
const https = Origin.from("https://a.example");
4244

4345
assert_false(http.isSameOrigin(https), "http is not same-site with https");
4446
assert_false(https.isSameOrigin(http), "https is not same-site with http");

html/browsers/origin/tentative/api/origin-fromURL.any.js

Lines changed: 0 additions & 71 deletions
This file was deleted.

html/browsers/origin/tentative/api/origin.any.js

Lines changed: 0 additions & 80 deletions
This file was deleted.

interfaces/origin.tentative.idl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
[Exposed=*]
33
interface Origin {
44
constructor();
5-
constructor(USVString serializedOrigin);
65

7-
static Origin? parse(USVString serializedOrigin);
8-
static Origin? fromURL(USVString serializedURL);
6+
static Origin from(any value);
97

108
readonly attribute boolean opaque;
119

0 commit comments

Comments
 (0)