From 23359c586871f4329115ee28c82a9274203456e6 Mon Sep 17 00:00:00 2001 From: glowe Date: Sat, 30 Nov 2019 21:53:53 -0500 Subject: [PATCH] Remove catch-all case for input sanitization Replaced catch-all with explicit case for inputs that do not have a value sanitization algorithm. This should prevent us from forgetting to implement a sanitization for an input, since they must all be accounted for in the match expression. --- components/script/dom/htmlinputelement.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 60b5cb9bcb1..04667659a33 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -1213,7 +1213,16 @@ impl HTMLInputElement { value.push_str(sanitized.as_str()); } }, - _ => (), + // The following inputs don't have a value sanitization algorithm. + // See https://html.spec.whatwg.org/multipage/#value-sanitization-algorithm + InputType::Button | + InputType::Checkbox | + InputType::File | + InputType::Hidden | + InputType::Image | + InputType::Radio | + InputType::Reset | + InputType::Submit => (), } }