LibWeb: Change attribute type to USVString where applicable

Also mark USVString attributes as containing a URL, where applicable.
This commit is contained in:
Tim Ledbetter 2024-08-08 10:35:57 +01:00 committed by Andreas Kling
commit 1369fc5069
Notes: github-actions[bot] 2024-08-17 05:59:13 +00:00
19 changed files with 66 additions and 23 deletions

View file

@ -1,2 +1,2 @@
../../Layout/input/120.png loaded 120.png loaded
file:///i-do-no-exist-i-swear.png failed file:///i-do-no-exist-i-swear.png failed

View file

@ -0,0 +1,14 @@
audio.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
embed.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
frame.longDesc final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
frame.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
iframe.longDesc final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
iframe.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
img.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
link.href final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
object.codeBase final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
object.data final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
script.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
source.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
track.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD
video.src final URL path segment: %EF%BF%BDa%EF%BF%BDb%EF%BF%BD

View file

@ -1 +1 @@
wfh file:///example/file/location/wfh

View file

@ -1,3 +1,3 @@
failed to load: "data:" failed to load: "data:"
failed to load: "file:///i-do-no-exist-i-swear" failed to load: "file:///i-do-no-exist-i-swear"
failed to load: "https://i-do-no-exist-i-swear.net.uk" failed to load: "https://i-do-no-exist-i-swear.net.uk/"

View file

@ -9,7 +9,8 @@
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
input.addEventListener("load", () => { input.addEventListener("load", () => {
resolve(`${input.src} loaded`); const filename = input.src.split('/').pop();
resolve(`${filename} loaded`);
}); });
input.addEventListener("error", () => { input.addEventListener("error", () => {
resolve(`${input.src} failed`); resolve(`${input.src} failed`);

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<script src="include.js"></script>
<script>
test(() => {
let elementList = [
{ "audio": "src" },
{ "embed": "src" },
{ "frame": "longDesc" },
{ "frame": "src" },
{ "iframe": "longDesc" },
{ "iframe": "src" },
{ "img": "src" },
{ "link": "href" },
{ "object": "codeBase" },
{ "object": "data" },
{ "script": "src" },
{ "source": "src" },
{ "track": "src" },
{ "video": "src" },
];
for (const elementDescriptor of elementList) {
[elementName, propertyName] = Object.entries(elementDescriptor)[0];
const element = document.createElement(elementName);
element[propertyName] = "\udddda\uddddb\udddd";
println(`${elementName}.${propertyName} final URL path segment: ${element[propertyName].split("/").pop()}`);
}
});
</script>

View file

@ -1,7 +1,7 @@
<script src="include.js"></script> <script src="include.js"></script>
<script type="text/javascript"> <script type="text/javascript">
function updateSrc() { function updateSrc() {
video.src = "wfh"; video.src = "file:///example/file/location/wfh";
} }
test(() => { test(() => {

View file

@ -10,7 +10,7 @@ interface HTMLAnchorElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString target; [CEReactions, Reflect] attribute DOMString target;
[CEReactions, Reflect] attribute DOMString download; [CEReactions, Reflect] attribute DOMString download;
[CEReactions, Reflect] attribute DOMString ping; [CEReactions, Reflect] attribute USVString ping;
[CEReactions, Reflect] attribute DOMString rel; [CEReactions, Reflect] attribute DOMString rel;
[SameObject, PutForwards=value] readonly attribute DOMTokenList relList; [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
[CEReactions, Reflect] attribute DOMString hreflang; [CEReactions, Reflect] attribute DOMString hreflang;

View file

@ -6,7 +6,7 @@ interface HTMLEmbedElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString type;
[CEReactions, Reflect] attribute DOMString width; [CEReactions, Reflect] attribute DOMString width;
[CEReactions, Reflect] attribute DOMString height; [CEReactions, Reflect] attribute DOMString height;

View file

@ -8,9 +8,9 @@ interface HTMLFrameElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString name; [CEReactions, Reflect] attribute DOMString name;
[CEReactions, Reflect] attribute DOMString scrolling; [CEReactions, Reflect] attribute DOMString scrolling;
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect=frameborder] attribute DOMString frameBorder; [CEReactions, Reflect=frameborder] attribute DOMString frameBorder;
[CEReactions, Reflect=longdesc] attribute DOMString longDesc; [CEReactions, Reflect=longdesc, URL] attribute USVString longDesc;
[CEReactions, Reflect=noresize] attribute boolean noResize; [CEReactions, Reflect=noresize] attribute boolean noResize;
[FIXME] readonly attribute Document? contentDocument; [FIXME] readonly attribute Document? contentDocument;
[FIXME] readonly attribute WindowProxy? contentWindow; [FIXME] readonly attribute WindowProxy? contentWindow;

View file

@ -8,7 +8,7 @@ interface HTMLIFrameElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString srcdoc; [CEReactions, Reflect] attribute DOMString srcdoc;
[CEReactions, Reflect] attribute DOMString name; [CEReactions, Reflect] attribute DOMString name;
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox; [FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList sandbox;
@ -26,7 +26,7 @@ interface HTMLIFrameElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString align;
[CEReactions, Reflect] attribute DOMString scrolling; [CEReactions, Reflect] attribute DOMString scrolling;
[CEReactions, Reflect=frameborder] attribute DOMString frameBorder; [CEReactions, Reflect=frameborder] attribute DOMString frameBorder;
[CEReactions, Reflect=longdesc] attribute USVString longDesc; [CEReactions, Reflect=longdesc, URL] attribute USVString longDesc;
[CEReactions, LegacyNullToEmptyString, Reflect=marginheight] attribute DOMString marginHeight; [CEReactions, LegacyNullToEmptyString, Reflect=marginheight] attribute DOMString marginHeight;
[CEReactions, LegacyNullToEmptyString, Reflect=marginwidth] attribute DOMString marginWidth; [CEReactions, LegacyNullToEmptyString, Reflect=marginwidth] attribute DOMString marginWidth;

View file

@ -9,7 +9,7 @@ interface HTMLImageElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString alt; [CEReactions, Reflect] attribute DOMString alt;
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString srcset; [CEReactions, Reflect] attribute DOMString srcset;
[CEReactions, Reflect] attribute DOMString sizes; [CEReactions, Reflect] attribute DOMString sizes;
[CEReactions, Enumerated=CORSSettingsAttribute, Reflect=crossorigin] attribute DOMString? crossOrigin; [CEReactions, Enumerated=CORSSettingsAttribute, Reflect=crossorigin] attribute DOMString? crossOrigin;
@ -34,7 +34,7 @@ interface HTMLImageElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString align; [CEReactions, Reflect] attribute DOMString align;
[CEReactions, Reflect] attribute unsigned long hspace; [CEReactions, Reflect] attribute unsigned long hspace;
[CEReactions, Reflect] attribute unsigned long vspace; [CEReactions, Reflect] attribute unsigned long vspace;
[CEReactions, Reflect=longdesc] attribute USVString longDesc; [CEReactions, Reflect=longdesc, URL] attribute USVString longDesc;
[CEReactions, LegacyNullToEmptyString, Reflect] attribute DOMString border; [CEReactions, LegacyNullToEmptyString, Reflect] attribute DOMString border;

View file

@ -36,7 +36,7 @@ interface HTMLInputElement : HTMLElement {
[CEReactions, Reflect=readonly] attribute boolean readOnly; [CEReactions, Reflect=readonly] attribute boolean readOnly;
[CEReactions, Reflect] attribute boolean required; [CEReactions, Reflect] attribute boolean required;
[CEReactions] attribute unsigned long size; [CEReactions] attribute unsigned long size;
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect] attribute USVString src;
[CEReactions, Reflect] attribute DOMString step; [CEReactions, Reflect] attribute DOMString step;
[CEReactions] attribute DOMString type; [CEReactions] attribute DOMString type;
[CEReactions, Reflect=value] attribute DOMString defaultValue; [CEReactions, Reflect=value] attribute DOMString defaultValue;

View file

@ -9,7 +9,7 @@ interface HTMLLinkElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString href; [CEReactions, Reflect, URL] attribute USVString href;
[CEReactions, Reflect=crossorigin, Enumerated=CORSSettingsAttribute] attribute DOMString? crossOrigin; [CEReactions, Reflect=crossorigin, Enumerated=CORSSettingsAttribute] attribute DOMString? crossOrigin;
[CEReactions, Reflect] attribute DOMString rel; [CEReactions, Reflect] attribute DOMString rel;
[CEReactions] attribute DOMString as; [CEReactions] attribute DOMString as;
@ -19,7 +19,7 @@ interface HTMLLinkElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString hreflang; [CEReactions, Reflect] attribute DOMString hreflang;
[CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString type;
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList sizes; [FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList sizes;
[CEReactions, Reflect=imagesrcset] attribute DOMString imageSrcset; [CEReactions, Reflect=imagesrcset] attribute USVString imageSrcset;
[CEReactions, Reflect=imagesizes] attribute DOMString imageSizes; [CEReactions, Reflect=imagesizes] attribute DOMString imageSizes;
[CEReactions, Reflect=referrerpolicy, Enumerated=ReferrerPolicy] attribute DOMString referrerPolicy; [CEReactions, Reflect=referrerpolicy, Enumerated=ReferrerPolicy] attribute DOMString referrerPolicy;
[FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList blocking; [FIXME, SameObject, PutForwards=value] readonly attribute DOMTokenList blocking;

View file

@ -30,7 +30,7 @@ interface HTMLMediaElement : HTMLElement {
readonly attribute MediaError? error; readonly attribute MediaError? error;
// network state // network state
[Reflect, CEReactions] attribute DOMString src; [Reflect, CEReactions, URL] attribute USVString src;
[FIXME] attribute MediaProvider? srcObject; [FIXME] attribute MediaProvider? srcObject;
readonly attribute USVString currentSrc; readonly attribute USVString currentSrc;
[Reflect=crossorigin, CEReactions, Enumerated=CORSSettingsAttribute] attribute DOMString? crossOrigin; [Reflect=crossorigin, CEReactions, Enumerated=CORSSettingsAttribute] attribute DOMString? crossOrigin;

View file

@ -7,7 +7,7 @@ interface HTMLObjectElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions] attribute DOMString data; [CEReactions, URL] attribute USVString data;
[CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString type;
[CEReactions, Reflect] attribute DOMString name; [CEReactions, Reflect] attribute DOMString name;
readonly attribute HTMLFormElement? form; readonly attribute HTMLFormElement? form;
@ -32,7 +32,7 @@ interface HTMLObjectElement : HTMLElement {
[CEReactions, Reflect] attribute unsigned long hspace; [CEReactions, Reflect] attribute unsigned long hspace;
[CEReactions, Reflect] attribute DOMString standby; [CEReactions, Reflect] attribute DOMString standby;
[CEReactions, Reflect] attribute unsigned long vspace; [CEReactions, Reflect] attribute unsigned long vspace;
[CEReactions, Reflect=codebase] attribute DOMString codeBase; [CEReactions, Reflect=codebase, URL] attribute USVString codeBase;
[CEReactions, Reflect=codetype] attribute DOMString codeType; [CEReactions, Reflect=codetype] attribute DOMString codeType;
[CEReactions, Reflect=usemap] attribute DOMString useMap; [CEReactions, Reflect=usemap] attribute DOMString useMap;

View file

@ -8,7 +8,7 @@ interface HTMLScriptElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString type;
[CEReactions, Reflect=nomodule] attribute boolean noModule; [CEReactions, Reflect=nomodule] attribute boolean noModule;
[CEReactions] attribute boolean async; [CEReactions] attribute boolean async;

View file

@ -6,9 +6,9 @@ interface HTMLSourceElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString type; [CEReactions, Reflect] attribute DOMString type;
[CEReactions, Reflect] attribute DOMString srcset; [CEReactions, Reflect] attribute USVString srcset;
[CEReactions, Reflect] attribute DOMString sizes; [CEReactions, Reflect] attribute DOMString sizes;
[CEReactions, Reflect] attribute DOMString media; [CEReactions, Reflect] attribute DOMString media;
[CEReactions, Reflect] attribute unsigned long width; [CEReactions, Reflect] attribute unsigned long width;

View file

@ -17,7 +17,7 @@ interface HTMLTrackElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();
[CEReactions, Enumerated=TrackKindAttribute, Reflect] attribute DOMString kind; [CEReactions, Enumerated=TrackKindAttribute, Reflect] attribute DOMString kind;
[CEReactions, Reflect] attribute DOMString src; [CEReactions, Reflect, URL] attribute USVString src;
[CEReactions, Reflect] attribute DOMString srclang; [CEReactions, Reflect] attribute DOMString srclang;
[CEReactions, Reflect] attribute DOMString label; [CEReactions, Reflect] attribute DOMString label;
[CEReactions, Reflect] attribute boolean default; [CEReactions, Reflect] attribute boolean default;