From 4d5dc5950a0895c1b8b405883c689496fb5a2394 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 4 May 2020 18:22:40 -0400 Subject: [PATCH] LibWeb: Improve
submit method handling The spec defines the only valid methods to be get, post, and dialog. Post and dialog are currently unhandled and do nothing, any other value (or no value specified) is defined by the spec to use the get method. --- Libraries/LibWeb/DOM/HTMLFormElement.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Libraries/LibWeb/DOM/HTMLFormElement.cpp b/Libraries/LibWeb/DOM/HTMLFormElement.cpp index 8cfc15e96b..1d87f18017 100644 --- a/Libraries/LibWeb/DOM/HTMLFormElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLFormElement.cpp @@ -48,9 +48,13 @@ void HTMLFormElement::submit() return; } - if (method().to_lowercase() != "get") { - dbg() << "Unsupported form method '" << method() << "'"; - return; + auto effective_method = method().to_lowercase(); + if (effective_method != "get") { + if (effective_method == "post" || effective_method == "dialog") { + dbg() << "Unsupported form method '" << method() << "'"; + return; + } + effective_method = "get"; } URL url(document().complete_url(action()));