Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/Headers.cpp

Issue 2587463002: [Fetch API] Appending headers of the same name should have their values (Closed)
Patch Set: Comment fix. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/Headers.h" 5 #include "modules/fetch/Headers.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/V8IteratorResultValue.h" 9 #include "bindings/core/v8/V8IteratorResultValue.h"
10 #include "core/dom/Iterator.h" 10 #include "core/dom/Iterator.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 m_headerList->remove(name); 170 m_headerList->remove(name);
171 } 171 }
172 172
173 String Headers::get(const String& name, ExceptionState& exceptionState) { 173 String Headers::get(const String& name, ExceptionState& exceptionState) {
174 // "The get(|name|) method, when invoked, must run these steps:" 174 // "The get(|name|) method, when invoked, must run these steps:"
175 // "1. If |name| is not a name, throw a TypeError." 175 // "1. If |name| is not a name, throw a TypeError."
176 if (!FetchHeaderList::isValidHeaderName(name)) { 176 if (!FetchHeaderList::isValidHeaderName(name)) {
177 exceptionState.throwTypeError("Invalid name"); 177 exceptionState.throwTypeError("Invalid name");
178 return String(); 178 return String();
179 } 179 }
180 // "2. Return the value of the first header in header list whose name is 180 // "2. If there is no header in header list whose name is |name|,
181 // |name|, and null otherwise." 181 // return null."
182 // "3. Return the combined value given |name| and header list."
182 String result; 183 String result;
183 m_headerList->get(name, result); 184 m_headerList->get(name, result);
184 return result; 185 return result;
185 } 186 }
186 187
187 Vector<String> Headers::getAll(const String& name, 188 Vector<String> Headers::getAll(const String& name,
188 ExceptionState& exceptionState) { 189 ExceptionState& exceptionState) {
189 // "The getAll(|name|) method, when invoked, must run these steps:" 190 // "The getAll(|name|) method, when invoked, must run these steps:"
190 // "1. If |name| is not a name, throw a TypeError." 191 // "1. If |name| is not a name, throw a TypeError."
191 if (!FetchHeaderList::isValidHeaderName(name)) { 192 if (!FetchHeaderList::isValidHeaderName(name)) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 visitor->trace(m_headerList); 321 visitor->trace(m_headerList);
321 } 322 }
322 323
323 PairIterable<String, String>::IterationSource* Headers::startIteration( 324 PairIterable<String, String>::IterationSource* Headers::startIteration(
324 ScriptState*, 325 ScriptState*,
325 ExceptionState&) { 326 ExceptionState&) {
326 return new HeadersIterationSource(m_headerList); 327 return new HeadersIterationSource(m_headerList);
327 } 328 }
328 329
329 } // namespace blink 330 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/FetchHeaderList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698