serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Ladybird: Implement `past-names-map`

Open fdellwing opened this issue 2 years ago • 3 comments

Minimal repro:

<form name="the_form"><input id="bar"></form>
<script>
alert(the_form.bar);
</script>

https://html.spec.whatwg.org/multipage/forms.html#past-names-map

See: https://discord.com/channels/830522505605283862/830525031720943627/1183758058426478632 ff


After #17970 was fixed, the login process is now able to start on https://world-of-dungeons.net/

But errors out directly without even sending a request with the following error:

HTMLScriptElement: Refusing to run script because the element's result is null.
Unhandled JavaScript exception: [TypeError] ToObject on null or undefined
    at submit
    at <unknown>
    at <unknown>

No valid credentials are needed to reproduce the error.

fdellwing avatar Dec 10 '23 07:12 fdellwing

I have minimized the problem to this:

<html>
<script>
    function do_login(world) {
        console.log(world)
        return false
    }
</script>
<form name="the_form" method="post" onsubmit="return do_login(the_form.bar.value)">
    <input id="bar" type="text" name="bar">
    <input type="submit" value="Log in">
</form>

It should just log your input to the console, but it does:

Unhandled JavaScript exception: [TypeError] ToObject on null or undefined
    at submit
    at <unknown>
    at <unknown>

Failed to submit form: Unknown scheme: file

fdellwing avatar Dec 11 '23 13:12 fdellwing

Just to be sure, using the window named property the_form works, right? and it's just the property access on the form element that fails?

ADKaster avatar Dec 11 '23 23:12 ADKaster

Just to be sure, using the window named property the_form works, right? and it's just the property access on the form element that fails?

Yes.

fdellwing avatar Dec 12 '23 06:12 fdellwing

In order for the live website to work, we also need to implement named property access on the document.

https://html.spec.whatwg.org/multipage/dom.html#dom-document-namedItem-which

This is because the website uses constructs like this:

var have_post_id = typeof document.the_form.wod_post_id != 'undefined'

to access named properties of the document.

ADKaster avatar Jan 10 '24 20:01 ADKaster