-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<a>/<area>'s protocol setter incorrectly works for non-parsable URLs
https://bugs.webkit.org/show_bug.cgi?id=260653 rdar://114371380 Reviewed by Chris Dumez. We cannot use URLDecomposition's protocol setter directly as it does not account for non-parsable URLs (not even indirectly, as most other getter/setters do). Therefore check for non-parsable URLs in HTMLAnchorElement before calling it. New tests are being upstreamed through web-platform-tests/wpt#41614. * LayoutTests/imported/w3c/resources/import-expectations.json: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js: Added. (string_appeared_here.forEach.name.get if.set test): (string_appeared_here.forEach.name.get if): (forEach.set string_appeared_here): * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window.js: Added. (string_appeared_here.forEach.name.get if.set test): (string_appeared_here.forEach.name.get if): (get string_appeared_here): * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-special-url-getter-setter.window.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/non-special-url-getter-setter.window.js: Added. (string_appeared_here.forEach.name.get if.set test): (string_appeared_here.forEach.name.get if): (set string_appeared_here): * LayoutTests/imported/w3c/web-platform-tests/html/semantics/links/links-created-by-a-and-area-elements/w3c-import.log: * Source/WebCore/html/HTMLAnchorElement.cpp: (WebCore::HTMLAnchorElement::setProtocol): * Source/WebCore/html/HTMLAnchorElement.h: Canonical link: https://commits.webkit.org/267265@main
- Loading branch information
Showing
13 changed files
with
312 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...s/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
PASS <a href="http://test:test/">.origin getter | ||
PASS <area href="http://test:test/">.origin getter | ||
PASS <a href="http://test:test/">.protocol getter | ||
PASS <a href="http://test:test/">.protocol setter | ||
PASS <area href="http://test:test/">.protocol getter | ||
PASS <area href="http://test:test/">.protocol setter | ||
PASS <a href="http://test:test/">.username getter | ||
PASS <a href="http://test:test/">.username setter | ||
PASS <area href="http://test:test/">.username getter | ||
PASS <area href="http://test:test/">.username setter | ||
PASS <a href="http://test:test/">.password getter | ||
PASS <a href="http://test:test/">.password setter | ||
PASS <area href="http://test:test/">.password getter | ||
PASS <area href="http://test:test/">.password setter | ||
PASS <a href="http://test:test/">.host getter | ||
PASS <a href="http://test:test/">.host setter | ||
PASS <area href="http://test:test/">.host getter | ||
PASS <area href="http://test:test/">.host setter | ||
PASS <a href="http://test:test/">.hostname getter | ||
PASS <a href="http://test:test/">.hostname setter | ||
PASS <area href="http://test:test/">.hostname getter | ||
PASS <area href="http://test:test/">.hostname setter | ||
PASS <a href="http://test:test/">.port getter | ||
PASS <a href="http://test:test/">.port setter | ||
PASS <area href="http://test:test/">.port getter | ||
PASS <area href="http://test:test/">.port setter | ||
PASS <a href="http://test:test/">.pathname getter | ||
PASS <a href="http://test:test/">.pathname setter | ||
PASS <area href="http://test:test/">.pathname getter | ||
PASS <area href="http://test:test/">.pathname setter | ||
PASS <a href="http://test:test/">.search getter | ||
PASS <a href="http://test:test/">.search setter | ||
PASS <area href="http://test:test/">.search getter | ||
PASS <area href="http://test:test/">.search setter | ||
PASS <a href="http://test:test/">.hash getter | ||
PASS <a href="http://test:test/">.hash setter | ||
PASS <area href="http://test:test/">.hash getter | ||
PASS <area href="http://test:test/">.hash setter | ||
|
1 change: 1 addition & 0 deletions
1
...ics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- This file is required for WebKit test infrastructure to run the templated test --> |
54 changes: 54 additions & 0 deletions
54
...ntics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[ | ||
{ | ||
"property": "origin", | ||
"set": null | ||
}, | ||
{ | ||
"property": "protocol", | ||
"get": ":", | ||
"set": "https" | ||
}, | ||
{ | ||
"property": "username" | ||
}, | ||
{ | ||
"property": "password" | ||
}, | ||
{ | ||
"property": "host" | ||
}, | ||
{ | ||
"property": "hostname" | ||
}, | ||
{ | ||
"property": "port", | ||
"set": "8000" | ||
}, | ||
{ | ||
"property": "pathname" | ||
}, | ||
{ | ||
"property": "search" | ||
}, | ||
{ | ||
"property": "hash" | ||
} | ||
].forEach(({ property, get = "", set = "string" }) => { | ||
["a", "area"].forEach(name => { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "http://test:test/"; // non-parsable URL | ||
assert_equals(link[property], get); | ||
}, `<${name} href="http://test:test/">.${property} getter`); | ||
|
||
if (set !== null) { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "http://test:test/"; // non-parsable URL | ||
link[property] = set; | ||
assert_equals(link[property], get); | ||
assert_equals(link.href, "http://test:test/"); | ||
}, `<${name} href="http://test:test/">.${property} setter`); | ||
} | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...ated-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
PASS <a href="non-special:opaque">.origin getter | ||
PASS <area href="non-special:opaque">.origin getter | ||
PASS <a href="non-special:opaque">.protocol getter | ||
PASS <a href="non-special:opaque">.protocol setter | ||
PASS <area href="non-special:opaque">.protocol getter | ||
PASS <area href="non-special:opaque">.protocol setter | ||
PASS <a href="non-special:opaque">.username getter | ||
PASS <a href="non-special:opaque">.username setter | ||
PASS <area href="non-special:opaque">.username getter | ||
PASS <area href="non-special:opaque">.username setter | ||
PASS <a href="non-special:opaque">.password getter | ||
PASS <a href="non-special:opaque">.password setter | ||
PASS <area href="non-special:opaque">.password getter | ||
PASS <area href="non-special:opaque">.password setter | ||
PASS <a href="non-special:opaque">.host getter | ||
PASS <a href="non-special:opaque">.host setter | ||
PASS <area href="non-special:opaque">.host getter | ||
PASS <area href="non-special:opaque">.host setter | ||
PASS <a href="non-special:opaque">.hostname getter | ||
PASS <a href="non-special:opaque">.hostname setter | ||
PASS <area href="non-special:opaque">.hostname getter | ||
PASS <area href="non-special:opaque">.hostname setter | ||
PASS <a href="non-special:opaque">.port getter | ||
PASS <a href="non-special:opaque">.port setter | ||
PASS <area href="non-special:opaque">.port getter | ||
PASS <area href="non-special:opaque">.port setter | ||
PASS <a href="non-special:opaque">.pathname getter | ||
PASS <a href="non-special:opaque">.pathname setter | ||
PASS <area href="non-special:opaque">.pathname getter | ||
PASS <area href="non-special:opaque">.pathname setter | ||
PASS <a href="non-special:opaque">.search getter | ||
PASS <a href="non-special:opaque">.search setter | ||
PASS <area href="non-special:opaque">.search getter | ||
PASS <area href="non-special:opaque">.search setter | ||
PASS <a href="non-special:opaque">.hash getter | ||
PASS <a href="non-special:opaque">.hash setter | ||
PASS <area href="non-special:opaque">.hash getter | ||
PASS <area href="non-special:opaque">.hash setter | ||
|
1 change: 1 addition & 0 deletions
1
...inks-created-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- This file is required for WebKit test infrastructure to run the templated test --> |
59 changes: 59 additions & 0 deletions
59
.../links-created-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[ | ||
{ | ||
"property": "origin", | ||
"get": "null", | ||
"set": null | ||
}, | ||
{ | ||
"property": "protocol", | ||
"get": "non-special:", | ||
"set": "super-special", | ||
"setget": "super-special:" | ||
}, | ||
{ | ||
"property": "username" | ||
}, | ||
{ | ||
"property": "password" | ||
}, | ||
{ | ||
"property": "host", | ||
}, | ||
{ | ||
"property": "hostname", | ||
}, | ||
{ | ||
"property": "port", | ||
"set": "8000" | ||
}, | ||
{ | ||
"property": "pathname", | ||
"get": "opaque", | ||
"setget": "opaque" | ||
}, | ||
{ | ||
"property": "search", | ||
"setget": "?string" | ||
}, | ||
{ | ||
"property": "hash", | ||
"setget": "#string" | ||
} | ||
].forEach(({ property, get = "", set = "string", setget = get }) => { | ||
["a", "area"].forEach(name => { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "non-special:opaque"; | ||
assert_equals(link[property], get); | ||
}, `<${name} href="non-special:opaque">.${property} getter`); | ||
|
||
if (set !== null) { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "non-special:opaque"; | ||
link[property] = set; | ||
assert_equals(link[property], setget); | ||
}, `<${name} href="non-special:opaque">.${property} setter`); | ||
} | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...ks/links-created-by-a-and-area-elements/non-special-url-getter-setter.window-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
PASS <a href="non-special://test:9001/">.origin getter | ||
PASS <area href="non-special://test:9001/">.origin getter | ||
PASS <a href="non-special://test:9001/">.protocol getter | ||
PASS <a href="non-special://test:9001/">.protocol setter | ||
PASS <area href="non-special://test:9001/">.protocol getter | ||
PASS <area href="non-special://test:9001/">.protocol setter | ||
PASS <a href="non-special://test:9001/">.username getter | ||
PASS <a href="non-special://test:9001/">.username setter | ||
PASS <area href="non-special://test:9001/">.username getter | ||
PASS <area href="non-special://test:9001/">.username setter | ||
PASS <a href="non-special://test:9001/">.password getter | ||
PASS <a href="non-special://test:9001/">.password setter | ||
PASS <area href="non-special://test:9001/">.password getter | ||
PASS <area href="non-special://test:9001/">.password setter | ||
PASS <a href="non-special://test:9001/">.host getter | ||
PASS <a href="non-special://test:9001/">.host setter | ||
PASS <area href="non-special://test:9001/">.host getter | ||
PASS <area href="non-special://test:9001/">.host setter | ||
PASS <a href="non-special://test:9001/">.hostname getter | ||
PASS <a href="non-special://test:9001/">.hostname setter | ||
PASS <area href="non-special://test:9001/">.hostname getter | ||
PASS <area href="non-special://test:9001/">.hostname setter | ||
PASS <a href="non-special://test:9001/">.port getter | ||
PASS <a href="non-special://test:9001/">.port setter | ||
PASS <area href="non-special://test:9001/">.port getter | ||
PASS <area href="non-special://test:9001/">.port setter | ||
PASS <a href="non-special://test:9001/">.pathname getter | ||
PASS <a href="non-special://test:9001/">.pathname setter | ||
PASS <area href="non-special://test:9001/">.pathname getter | ||
PASS <area href="non-special://test:9001/">.pathname setter | ||
PASS <a href="non-special://test:9001/">.search getter | ||
PASS <a href="non-special://test:9001/">.search setter | ||
PASS <area href="non-special://test:9001/">.search getter | ||
PASS <area href="non-special://test:9001/">.search setter | ||
PASS <a href="non-special://test:9001/">.hash getter | ||
PASS <a href="non-special://test:9001/">.hash setter | ||
PASS <area href="non-special://test:9001/">.hash getter | ||
PASS <area href="non-special://test:9001/">.hash setter | ||
|
1 change: 1 addition & 0 deletions
1
...tics/links/links-created-by-a-and-area-elements/non-special-url-getter-setter.window.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- This file is required for WebKit test infrastructure to run the templated test --> |
63 changes: 63 additions & 0 deletions
63
...antics/links/links-created-by-a-and-area-elements/non-special-url-getter-setter.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[ | ||
{ | ||
"property": "origin", | ||
"get": "null", | ||
"set": null | ||
}, | ||
{ | ||
"property": "protocol", | ||
"get": "non-special:", | ||
"set": "super-special", | ||
"setget": "super-special:" | ||
}, | ||
{ | ||
"property": "username" | ||
}, | ||
{ | ||
"property": "password" | ||
}, | ||
{ | ||
"property": "host", | ||
"get": "test:9001", | ||
"setget": "string:9001" | ||
}, | ||
{ | ||
"property": "hostname", | ||
"get": "test" | ||
}, | ||
{ | ||
"property": "port", | ||
"get": "9001", | ||
"set": "8000" | ||
}, | ||
{ | ||
"property": "pathname", | ||
"get": "/", | ||
"setget": "/string" | ||
}, | ||
{ | ||
"property": "search", | ||
"setget": "?string" | ||
}, | ||
{ | ||
"property": "hash", | ||
"setget": "#string" | ||
} | ||
].forEach(({ property, get = "", set = "string", setget = set }) => { | ||
["a", "area"].forEach(name => { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "non-special://test:9001/"; | ||
assert_equals(link[property], get); | ||
}, `<${name} href="non-special://test:9001/">.${property} getter`); | ||
|
||
if (set !== null) { | ||
test(() => { | ||
const link = document.createElement(name); | ||
link.href = "non-special://test:9001/"; | ||
link[property] = set; | ||
assert_equals(link[property], setget); | ||
}, `<${name} href="non-special://test:9001/">.${property} setter`); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters