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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 UseCounter::count(context, UseCounter::FormDataAppendBlob); | 113 UseCounter::count(context, UseCounter::FormDataAppendBlob); |
114 else | 114 else |
115 UseCounter::count(context, UseCounter::FormDataAppendBlobWithFil ename); | 115 UseCounter::count(context, UseCounter::FormDataAppendBlobWithFil ename); |
116 } | 116 } |
117 } else { | 117 } else { |
118 UseCounter::count(context, UseCounter::FormDataAppendNull); | 118 UseCounter::count(context, UseCounter::FormDataAppendNull); |
119 } | 119 } |
120 appendBlob(name, blob, filename); | 120 appendBlob(name, blob, filename); |
121 } | 121 } |
122 | 122 |
123 void DOMFormData::deleteEntry(const String& name) | |
124 { | |
125 const CString keyData = encodeAndNormalize(name); | |
126 size_t i = 0; | |
127 while (i < m_items.size()) { | |
128 if (m_items[i].key() == keyData) { | |
keishi
2015/09/09 04:18:16
nit: extra brackets
| |
129 m_items.remove(i); | |
130 } else { | |
131 ++i; | |
132 } | |
133 } | |
134 } | |
135 | |
123 void DOMFormData::get(const String& name, FormDataEntryValue& result) | 136 void DOMFormData::get(const String& name, FormDataEntryValue& result) |
124 { | 137 { |
125 if (m_opaque) | 138 if (m_opaque) |
126 return; | 139 return; |
127 Entry entry = getEntry(name); | 140 Entry entry = getEntry(name); |
128 if (entry.isString()) | 141 if (entry.isString()) |
129 result.setUSVString(entry.string()); | 142 result.setUSVString(entry.string()); |
130 else if (entry.isFile()) | 143 else if (entry.isFile()) |
131 result.setFile(entry.file()); | 144 result.setFile(entry.file()); |
132 else | 145 else |
(...skipping 20 matching lines...) Expand all Loading... | |
153 results.append(value); | 166 results.append(value); |
154 } | 167 } |
155 ASSERT(results.size() == entries.size()); | 168 ASSERT(results.size() == entries.size()); |
156 return results; | 169 return results; |
157 } | 170 } |
158 | 171 |
159 bool DOMFormData::has(const String& name) | 172 bool DOMFormData::has(const String& name) |
160 { | 173 { |
161 if (m_opaque) | 174 if (m_opaque) |
162 return false; | 175 return false; |
163 return hasEntry(name); | 176 const CString keyData = encodeAndNormalize(name); |
177 for (const Item& item : items()) { | |
178 if (item.key() == keyData) | |
179 return true; | |
180 } | |
181 return false; | |
164 } | 182 } |
165 | 183 |
166 void DOMFormData::set(const String& name, const String& value) | 184 void DOMFormData::set(const String& name, const String& value) |
167 { | 185 { |
168 setEntry(Item(encodeAndNormalize(name), encodeAndNormalize(value))); | 186 setEntry(Item(encodeAndNormalize(name), encodeAndNormalize(value))); |
169 } | 187 } |
170 | 188 |
171 void DOMFormData::set(const String& name, Blob* blob, const String& filename) | 189 void DOMFormData::set(const String& name, Blob* blob, const String& filename) |
172 { | 190 { |
173 setEntry(Item(encodeAndNormalize(name), blob, filename)); | 191 setEntry(Item(encodeAndNormalize(name), blob, filename)); |
(...skipping 22 matching lines...) Expand all Loading... | |
196 | 214 |
197 PairIterable<String, FormDataEntryValue>::IterationSource* DOMFormData::startIte ration(ScriptState*, ExceptionState&) | 215 PairIterable<String, FormDataEntryValue>::IterationSource* DOMFormData::startIte ration(ScriptState*, ExceptionState&) |
198 { | 216 { |
199 if (m_opaque) | 217 if (m_opaque) |
200 return new DOMFormDataIterationSource(new DOMFormData(nullptr)); | 218 return new DOMFormDataIterationSource(new DOMFormData(nullptr)); |
201 | 219 |
202 return new DOMFormDataIterationSource(this); | 220 return new DOMFormDataIterationSource(this); |
203 } | 221 } |
204 | 222 |
205 } // namespace blink | 223 } // namespace blink |
OLD | NEW |