| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 append(object[i][0], object[i][1], exceptionState); | 278 append(object[i][0], object[i][1], exceptionState); |
| 279 if (exceptionState.hadException()) | 279 if (exceptionState.hadException()) |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void Headers::fillWith(const Dictionary& object, | 284 void Headers::fillWith(const Dictionary& object, |
| 285 ExceptionState& exceptionState) { | 285 ExceptionState& exceptionState) { |
| 286 ASSERT(!m_headerList->size()); | 286 ASSERT(!m_headerList->size()); |
| 287 Vector<String> keys; | 287 const Vector<String>& keys = object.getPropertyNames(exceptionState); |
| 288 object.getPropertyNames(keys); | 288 if (exceptionState.hadException() || !keys.size()) |
| 289 if (!keys.size()) | |
| 290 return; | 289 return; |
| 291 | 290 |
| 292 // "3. Otherwise, if |object| is an open-ended dictionary, then for each | 291 // "3. Otherwise, if |object| is an open-ended dictionary, then for each |
| 293 // |header| in object, run these substeps: | 292 // |header| in object, run these substeps: |
| 294 // 1. Set |header|'s key to |header|'s key, converted to ByteString. | 293 // 1. Set |header|'s key to |header|'s key, converted to ByteString. |
| 295 // Rethrow any exception. | 294 // Rethrow any exception. |
| 296 // 2. Append |header|'s key/|header|'s value to |headers|. Rethrow any | 295 // 2. Append |header|'s key/|header|'s value to |headers|. Rethrow any |
| 297 // exception." | 296 // exception." |
| 298 // FIXME: Support OpenEndedDictionary<ByteString>. | 297 // FIXME: Support OpenEndedDictionary<ByteString>. |
| 299 for (size_t i = 0; i < keys.size(); ++i) { | 298 for (size_t i = 0; i < keys.size(); ++i) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 318 visitor->trace(m_headerList); | 317 visitor->trace(m_headerList); |
| 319 } | 318 } |
| 320 | 319 |
| 321 PairIterable<String, String>::IterationSource* Headers::startIteration( | 320 PairIterable<String, String>::IterationSource* Headers::startIteration( |
| 322 ScriptState*, | 321 ScriptState*, |
| 323 ExceptionState&) { | 322 ExceptionState&) { |
| 324 return new HeadersIterationSource(m_headerList); | 323 return new HeadersIterationSource(m_headerList); |
| 325 } | 324 } |
| 326 | 325 |
| 327 } // namespace blink | 326 } // namespace blink |
| OLD | NEW |