mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
script: Ensure EventSource
field value is ignored if the null character exists in the field name (#36854)
Spec has updated so that any null characters in the `id` field name would result in the value being ignored. Testing: Covered by `tests/wpt/tests/eventsource/format-field-id-null.window.js` Signed-off-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
parent
8608e328a1
commit
b3980dc2ee
2 changed files with 3 additions and 16 deletions
|
@ -183,7 +183,9 @@ impl EventSourceContext {
|
||||||
self.data.push_str(&self.value);
|
self.data.push_str(&self.value);
|
||||||
self.data.push('\n');
|
self.data.push('\n');
|
||||||
},
|
},
|
||||||
"id" => mem::swap(&mut self.last_event_id, &mut self.value),
|
"id" if !self.value.contains('\0') => {
|
||||||
|
mem::swap(&mut self.last_event_id, &mut self.value);
|
||||||
|
},
|
||||||
"retry" => {
|
"retry" => {
|
||||||
if let Ok(time) = u64::from_str(&self.value) {
|
if let Ok(time) = u64::from_str(&self.value) {
|
||||||
self.event_source
|
self.event_source
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
[format-field-id-null.window.html]
|
|
||||||
[EventSource: id field set to %00%00]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[EventSource: id field set to x%00]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[EventSource: id field set to %00x]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[EventSource: id field set to x%00x]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[EventSource: id field set to %20%00]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue