Repository navigation
Implement value sanitization on HTMLInputElement - #18262
Conversation
a1e26c5 to
a81a95c
Compare
|
@bors-servo try |
Implement value sanitization on HTMLInputElement https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18262) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-wpt1 |
a81a95c to
a188073
Compare
|
Ok, so the timeouts are actually moving us in the correct direction, the problem is simply that we have a buggy selection algorithm, causing |
a188073 to
835c244
Compare
|
r? @nox |
| } | ||
|
|
||
| // https://html.spec.whatwg.org/multipage/#input-type-attr-summary | ||
| // https://html.spec.whatwg.org/multipage/#common-input-element-apis |
There was a problem hiding this comment.
Because the old link doesn't point to somewhere that can explain value modes.
There was a problem hiding this comment.
| match self.value_mode() { | ||
| ValueMode::Value => { | ||
| // Step 1. | ||
| let old_value = self.textinput.borrow().get_content(); |
There was a problem hiding this comment.
Merge these 2 steps together so that the older value doesn't get cloned.
There was a problem hiding this comment.
We need to clone the old value so that we may compare it in step 5.
There was a problem hiding this comment.
No you don't, merge these two steps and use mem::replace and you don't need the clone.
| // Step 4. | ||
| self.sanitize_value(); | ||
| // Step 5. | ||
| if self.textinput.borrow().get_content() != old_value { |
There was a problem hiding this comment.
This clones the new value for no reason.
There was a problem hiding this comment.
Which method call is a clone?
There was a problem hiding this comment.
Then I'm not sure which other method gets the content of the text input without using get_content.
| fn sanitize_value(&self) { | ||
| let new_value = match self.type_() { | ||
| atom!("text") | atom!("search") | atom!("tel") | atom!("password") => { | ||
| DOMString::from(self.textinput.borrow().get_content() |
There was a problem hiding this comment.
Make a helper function for https://infra.spec.whatwg.org/#strip-newlines.
| .collect::<String>()) | ||
| } | ||
| atom!("url") => { | ||
| DOMString::from(self.textinput.borrow().get_content() |
There was a problem hiding this comment.
| .chars() | ||
| .filter(|&c| c != '\r' && c != '\n') | ||
| .collect::<String>() | ||
| .trim_matches(char::is_whitespace)) |
There was a problem hiding this comment.
This is wrong, that should trim only ASCII whitespace.
There was a problem hiding this comment.
Your suggestion doesn't match up with the spec: https://html.spec.whatwg.org/multipage/input.html#url-state-(type=url).
There was a problem hiding this comment.
What?
The value sanitization algorithm is as follows: Strip newlines from the value, then strip leading and trailing ASCII whitespace from the value.
| fn sanitize_value(&self) { | ||
| let new_value = match self.type_() { | ||
| atom!("text") | atom!("search") | atom!("tel") | atom!("password") => { | ||
| DOMString::from(self.textinput.borrow().get_content() |
There was a problem hiding this comment.
This clones the current value for no reason.
There was a problem hiding this comment.
Which method call is a clone?
| .collect::<String>()) | ||
| } | ||
| atom!("url") => { | ||
| DOMString::from(self.textinput.borrow().get_content() |
There was a problem hiding this comment.
This clones the current value for no reason.
There was a problem hiding this comment.
Which method call is a clone?
835c244 to
1cafcc4
Compare
|
@bors-servo try |
Implement value sanitization on HTMLInputElement https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18262) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
1cafcc4 to
2b3e94f
Compare
|
📌 Commit cf1bd6b has been approved by |
Implement value sanitization on HTMLInputElement https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18262) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
So the test harness does actually timeout on this test... will investigate. |
Implement value sanitization on HTMLInputElement https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18262) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
cf1bd6b to
d53a729
Compare
|
Ok, so it looks like the test SHOULD time out with these changes, because our |
|
Filed #19171 for the problem I mentioned above. |
|
@bors-servo r=nox |
|
📌 Commit 8203605 has been approved by |
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm
This change is