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 "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/Headers.h" | 6 #include "modules/serviceworkers/Headers.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "core/dom/Iterator.h" | 10 #include "core/dom/Iterator.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 append(object[i][0], object[i][1], exceptionState); | 299 append(object[i][0], object[i][1], exceptionState); |
300 if (exceptionState.hadException()) | 300 if (exceptionState.hadException()) |
301 return; | 301 return; |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 void Headers::fillWith(const Dictionary& object, ExceptionState& exceptionState) | 305 void Headers::fillWith(const Dictionary& object, ExceptionState& exceptionState) |
306 { | 306 { |
307 ASSERT(!m_headerList->size()); | 307 ASSERT(!m_headerList->size()); |
308 Vector<String> keys; | 308 Vector<String> keys; |
309 object.getOwnPropertyNames(keys); | 309 object.getPropertyNames(keys); |
310 if (!keys.size()) | 310 if (!keys.size()) |
311 return; | 311 return; |
312 | 312 |
313 // "3. Otherwise, if |object| is an open-ended dictionary, then for each | 313 // "3. Otherwise, if |object| is an open-ended dictionary, then for each |
314 // |header| in object, run these substeps: | 314 // |header| in object, run these substeps: |
315 // 1. Set |header|'s key to |header|'s key, converted to ByteString. | 315 // 1. Set |header|'s key to |header|'s key, converted to ByteString. |
316 // Rethrow any exception. | 316 // Rethrow any exception. |
317 // 2. Append |header|'s key/|header|'s value to |headers|. Rethrow any | 317 // 2. Append |header|'s key/|header|'s value to |headers|. Rethrow any |
318 // exception." | 318 // exception." |
319 // FIXME: Support OpenEndedDictionary<ByteString>. | 319 // FIXME: Support OpenEndedDictionary<ByteString>. |
(...skipping 25 matching lines...) Expand all Loading... |
345 { | 345 { |
346 return new HeadersIterator(m_headerList, HeadersIterator::KeyValue); | 346 return new HeadersIterator(m_headerList, HeadersIterator::KeyValue); |
347 } | 347 } |
348 | 348 |
349 void Headers::trace(Visitor* visitor) | 349 void Headers::trace(Visitor* visitor) |
350 { | 350 { |
351 visitor->trace(m_headerList); | 351 visitor->trace(m_headerList); |
352 } | 352 } |
353 | 353 |
354 } // namespace blink | 354 } // namespace blink |
OLD | NEW |