| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 class DOMFormDataIterationSource final : public PairIterable<String, FormDataEnt
ryValue>::IterationSource { | 45 class DOMFormDataIterationSource final : public PairIterable<String, FormDataEnt
ryValue>::IterationSource { |
| 46 public: | 46 public: |
| 47 DOMFormDataIterationSource(DOMFormData* formData) : m_formData(formData), m_
current(0) { } | 47 DOMFormDataIterationSource(DOMFormData* formData) : m_formData(formData), m_
current(0) { } |
| 48 | 48 |
| 49 bool next(ScriptState* scriptState, String& key, FormDataEntryValue& value,
ExceptionState& exceptionState) override | 49 bool next(ScriptState* scriptState, String& key, FormDataEntryValue& value,
ExceptionState& exceptionState) override |
| 50 { | 50 { |
| 51 if (m_current >= m_formData->size()) | 51 if (m_current >= m_formData->size()) |
| 52 return false; | 52 return false; |
| 53 | 53 |
| 54 const FormDataList::Entry entry = m_formData->getEntry(m_current++); | 54 const FormDataList::Item& entry = m_formData->items()[m_current++]; |
| 55 key = entry.name(); | 55 key = m_formData->decode(entry.key()); |
| 56 if (entry.isString()) | 56 if (entry.isString()) { |
| 57 value.setUSVString(entry.string()); | 57 value.setUSVString(m_formData->decode(entry.data())); |
| 58 else if (entry.isFile()) | 58 } else { |
| 59 ASSERT(entry.isFile()); |
| 59 value.setFile(entry.file()); | 60 value.setFile(entry.file()); |
| 60 else | 61 } |
| 61 ASSERT_NOT_REACHED(); | |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 DEFINE_INLINE_VIRTUAL_TRACE() | 65 DEFINE_INLINE_VIRTUAL_TRACE() |
| 66 { | 66 { |
| 67 visitor->trace(m_formData); | 67 visitor->trace(m_formData); |
| 68 PairIterable<String, FormDataEntryValue>::IterationSource::trace(visitor
); | 68 PairIterable<String, FormDataEntryValue>::IterationSource::trace(visitor
); |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 found = true; | 205 found = true; |
| 206 m_items[i] = item; | 206 m_items[i] = item; |
| 207 ++i; | 207 ++i; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 if (!found) | 210 if (!found) |
| 211 m_items.append(item); | 211 m_items.append(item); |
| 212 return; | 212 return; |
| 213 } | 213 } |
| 214 | 214 |
| 215 String DOMFormData::decode(const CString& data) const |
| 216 { |
| 217 return encoding().decode(data.data(), data.length()); |
| 218 } |
| 219 |
| 215 PairIterable<String, FormDataEntryValue>::IterationSource* DOMFormData::startIte
ration(ScriptState*, ExceptionState&) | 220 PairIterable<String, FormDataEntryValue>::IterationSource* DOMFormData::startIte
ration(ScriptState*, ExceptionState&) |
| 216 { | 221 { |
| 217 if (m_opaque) | 222 if (m_opaque) |
| 218 return new DOMFormDataIterationSource(new DOMFormData(nullptr)); | 223 return new DOMFormDataIterationSource(new DOMFormData(nullptr)); |
| 219 | 224 |
| 220 return new DOMFormDataIterationSource(this); | 225 return new DOMFormDataIterationSource(this); |
| 221 } | 226 } |
| 222 | 227 |
| 223 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |