From c6b665792f80d697df8d59c7c75ee782655fa025 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 21 Jun 2014 11:08:20 +0200 Subject: [PATCH] servo: Merge #2631 - Fix field-value checking to not throw for lone spaces; r=jdm (from Manishearth:xhr-spaces) Source-Repo: https://github.com/servo/servo Source-Revision: ab711fcf0cb0071a9df26af5aac4762a1281dc69 --- servo/src/components/script/dom/bindings/str.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/servo/src/components/script/dom/bindings/str.rs b/servo/src/components/script/dom/bindings/str.rs index ae6c721abea9..6db3f6c1f975 100644 --- a/servo/src/components/script/dom/bindings/str.rs +++ b/servo/src/components/script/dom/bindings/str.rs @@ -94,7 +94,21 @@ impl ByteString { false } }, - 32 | 9 => { // SP | HT + 32 => { // SP + if prev == LF || prev == SPHT { + prev = SPHT; + true + } else if prev == Other { + // Counts as an Other here, since it's not preceded by a CRLF + // SP is not a CTL, so it can be used anywhere + // though if used immediately after a CR the CR is invalid + // We don't change prev since it's already Other + true + } else { + false + } + }, + 9 => { // HT if prev == LF || prev == SPHT { prev = SPHT; true