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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 isMultiPartForm = false; | 208 isMultiPartForm = false; |
209 } | 209 } |
210 } | 210 } |
211 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui
lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input
Encoding(), document.defaultCharset()); | 211 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui
lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input
Encoding(), document.defaultCharset()); |
212 RefPtrWillBeRawPtr<DOMFormData> domFormData = DOMFormData::create(dataEncodi
ng.encodingForFormSubmission()); | 212 RefPtrWillBeRawPtr<DOMFormData> domFormData = DOMFormData::create(dataEncodi
ng.encodingForFormSubmission()); |
213 Vector<pair<String, String> > formValues; | 213 Vector<pair<String, String> > formValues; |
214 | 214 |
215 bool containsPasswordData = false; | 215 bool containsPasswordData = false; |
216 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { | 216 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { |
217 FormAssociatedElement* control = form->associatedElements()[i]; | 217 FormAssociatedElement* control = form->associatedElements()[i]; |
218 HTMLElement* element = toHTMLElement(control); | 218 ASSERT(control); |
219 if (!element->isDisabledFormControl()) | 219 HTMLElement& element = toHTMLElement(*control); |
| 220 if (!element.isDisabledFormControl()) |
220 control->appendFormData(*domFormData, isMultiPartForm); | 221 control->appendFormData(*domFormData, isMultiPartForm); |
221 if (element->hasTagName(inputTag)) { | 222 if (isHTMLInputElement(element)) { |
222 HTMLInputElement* input = toHTMLInputElement(element); | 223 HTMLInputElement& input = toHTMLInputElement(element); |
223 if (input->isTextField()) | 224 if (input.isTextField()) |
224 formValues.append(pair<String, String>(input->name().string(), i
nput->value())); | 225 formValues.append(pair<String, String>(input.name().string(), in
put.value())); |
225 if (input->isPasswordField() && !input->value().isEmpty()) | 226 if (input.isPasswordField() && !input.value().isEmpty()) |
226 containsPasswordData = true; | 227 containsPasswordData = true; |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 RefPtr<FormData> formData; | 231 RefPtr<FormData> formData; |
231 String boundary; | 232 String boundary; |
232 | 233 |
233 if (isMultiPartForm) { | 234 if (isMultiPartForm) { |
234 formData = domFormData->createMultiPartFormData(domFormData->encoding())
; | 235 formData = domFormData->createMultiPartFormData(domFormData->encoding())
; |
235 boundary = formData->boundary().data(); | 236 boundary = formData->boundary().data(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 frameRequest.resourceRequest().setHTTPContentType(m_contentType); | 277 frameRequest.resourceRequest().setHTTPContentType(m_contentType); |
277 else | 278 else |
278 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); | 279 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); |
279 } | 280 } |
280 | 281 |
281 frameRequest.resourceRequest().setURL(requestURL()); | 282 frameRequest.resourceRequest().setURL(requestURL()); |
282 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), AtomicStr
ing(m_origin)); | 283 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), AtomicStr
ing(m_origin)); |
283 } | 284 } |
284 | 285 |
285 } | 286 } |
OLD | NEW |