mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
LibWeb: Include submitter name and value when constructing FormData
This fixes the SSO buttons on OpenAI's login page giving "Unknown error"
This commit is contained in:
parent
144eac44fb
commit
d9cb8185cc
Notes:
github-actions[bot]
2025-07-15 18:51:17 +00:00
Author: https://github.com/Lubrsi
Commit: d9cb8185cc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5460
Reviewed-by: https://github.com/gmta ✅
4 changed files with 23 additions and 7 deletions
|
@ -43,8 +43,8 @@ WebIDL::ExceptionOr<GC::Ref<FormData>> FormData::construct_impl(JS::Realm& realm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Let list be the result of constructing the entry list for form.
|
// 2. Let list be the result of constructing the entry list for form and submitter.
|
||||||
auto entry_list = TRY(construct_entry_list(realm, *form));
|
auto entry_list = TRY(construct_entry_list(realm, *form, submitter));
|
||||||
// 3. If list is null, then throw an "InvalidStateError" DOMException.
|
// 3. If list is null, then throw an "InvalidStateError" DOMException.
|
||||||
if (!entry_list.has_value())
|
if (!entry_list.has_value())
|
||||||
return WebIDL::InvalidStateError::create(realm, "Form element does not contain any entries."_string);
|
return WebIDL::InvalidStateError::create(realm, "Form element does not contain any entries."_string);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
'test-button-name' = 'test-button-value'
|
|
@ -2,14 +2,13 @@ Harness status: OK
|
||||||
|
|
||||||
Found 9 tests
|
Found 9 tests
|
||||||
|
|
||||||
6 Pass
|
9 Pass
|
||||||
3 Fail
|
|
||||||
Pass FormData construction should allow a null submitter
|
Pass FormData construction should allow a null submitter
|
||||||
Pass FormData construction should allow an undefined form and an undefined submitter
|
Pass FormData construction should allow an undefined form and an undefined submitter
|
||||||
Pass FormData construction should allow an undefined form and a null submitter
|
Pass FormData construction should allow an undefined form and a null submitter
|
||||||
Pass FormData construction should throw a TypeError if a non-null submitter is not a submit button
|
Pass FormData construction should throw a TypeError if a non-null submitter is not a submit button
|
||||||
Pass FormData construction should throw a 'NotFoundError' DOMException if a non-null submitter is not owned by the form
|
Pass FormData construction should throw a 'NotFoundError' DOMException if a non-null submitter is not owned by the form
|
||||||
Fail The constructed FormData object should contain an in-tree-order entry for a named submit button submitter
|
Pass The constructed FormData object should contain an in-tree-order entry for a named submit button submitter
|
||||||
Pass The constructed FormData object should not contain an entry for an unnamed submit button submitter
|
Pass The constructed FormData object should not contain an entry for an unnamed submit button submitter
|
||||||
Fail The constructed FormData object should contain in-tree-order entries for an activated Image Button submitter
|
Pass The constructed FormData object should contain in-tree-order entries for an activated Image Button submitter
|
||||||
Fail The constructed FormData object should contain in-tree-order entries for an unactivated Image Button submitter
|
Pass The constructed FormData object should contain in-tree-order entries for an unactivated Image Button submitter
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<form id="test-form">
|
||||||
|
<button id="test-button" name="test-button-name" value="test-button-value"></button>
|
||||||
|
</form>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const testForm = document.getElementById("test-form");
|
||||||
|
const testButton = document.getElementById("test-button");
|
||||||
|
const formData = new FormData(testForm, testButton);
|
||||||
|
|
||||||
|
for (const [name, value] of formData.entries()) {
|
||||||
|
println(`'${name}' = '${value}'`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue