Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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, return null." |
|
yhirano
2016/12/19 11:43:05
whose name is |name|
| |
| 181 // |name|, and null otherwise." | 181 // "3. Return |result| as the combined header list." |
|
yhirano
2016/12/19 11:43:05
Where does this statement come from? Isn't it
"3.
| |
| 182 String result; | 182 String result; |
| 183 m_headerList->get(name, result); | 183 m_headerList->get(name, result); |
| 184 return result; | 184 return result; |
| 185 } | 185 } |
| 186 | 186 |
| 187 Vector<String> Headers::getAll(const String& name, | 187 Vector<String> Headers::getAll(const String& name, |
| 188 ExceptionState& exceptionState) { | 188 ExceptionState& exceptionState) { |
| 189 // "The getAll(|name|) method, when invoked, must run these steps:" | 189 // "The getAll(|name|) method, when invoked, must run these steps:" |
| 190 // "1. If |name| is not a name, throw a TypeError." | 190 // "1. If |name| is not a name, throw a TypeError." |
| 191 if (!FetchHeaderList::isValidHeaderName(name)) { | 191 if (!FetchHeaderList::isValidHeaderName(name)) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 visitor->trace(m_headerList); | 320 visitor->trace(m_headerList); |
| 321 } | 321 } |
| 322 | 322 |
| 323 PairIterable<String, String>::IterationSource* Headers::startIteration( | 323 PairIterable<String, String>::IterationSource* Headers::startIteration( |
| 324 ScriptState*, | 324 ScriptState*, |
| 325 ExceptionState&) { | 325 ExceptionState&) { |
| 326 return new HeadersIterationSource(m_headerList); | 326 return new HeadersIterationSource(m_headerList); |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |