servo: Merge #13004 - Update DOM headers `append` and `delete` (from jeenalee:combine-headers); r=jdm
authorJeena Lee <ijeenalee@gmail.com>
Mon, 12 Sep 2016 09:21:52 -0500
changeset 339680 7ae899a83e4dff68a289995c405f0ba2ec1d43c0
parent 339679 95b2294ee103a8d1537dad756b9404d2070d34da
child 339681 b37cf0deb644fc8fd16654d5cc588ddeac596483
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #13004 - Update DOM headers `append` and `delete` (from jeenalee:combine-headers); r=jdm <!-- Please describe your changes on the following line: --> Two changes are included in this PR: 1. A resolved TODO comment in `delete` is removed. 2. `append` method adds a space after a comma when combining header values. Expected wpt results are updated with this change. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 72645923972aab03e589510b252abcff13ec5b9b
servo/components/script/dom/headers.rs
--- a/servo/components/script/dom/headers.rs
+++ b/servo/components/script/dom/headers.rs
@@ -82,17 +82,17 @@ impl HeadersMethods for Headers {
         // Step 6
         if self.guard.get() == Guard::Response && is_forbidden_response_header(&valid_name) {
             return Ok(());
         }
         // Step 7
         let mut combined_value: Vec<u8> = vec![];
         if let Some(v) = self.header_list.borrow().get_raw(&valid_name) {
             combined_value = v[0].clone();
-            combined_value.push(b","[0]);
+            combined_value.push(b',');
         }
         combined_value.extend(valid_value.iter().cloned());
         self.header_list.borrow_mut().set_raw(valid_name, vec![combined_value]);
         Ok(())
     }
 
     // https://fetch.spec.whatwg.org/#dom-headers-delete
     fn Delete(&self, name: ByteString) -> ErrorResult {
@@ -102,18 +102,16 @@ impl HeadersMethods for Headers {
         if self.guard.get() == Guard::Immutable {
             return Err(Error::Type("Guard is immutable".to_string()));
         }
         // Step 3
         if self.guard.get() == Guard::Request && is_forbidden_header_name(&valid_name) {
             return Ok(());
         }
         // Step 4
-        // TODO: Requires clarification from the Fetch spec:
-        // ... https://github.com/whatwg/fetch/issues/372
         if self.guard.get() == Guard::RequestNoCors &&
             !is_cors_safelisted_request_header(&valid_name, &b"invalid".to_vec()) {
                 return Ok(());
             }
         // Step 5
         if self.guard.get() == Guard::Response && is_forbidden_response_header(&valid_name) {
             return Ok(());
         }