| 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 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/loader/FormSubmission.h" | 32 #include "core/loader/FormSubmission.h" |
| 33 | 33 |
| 34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
| 37 #include "core/frame/LocalFrame.h" |
| 37 #include "core/html/DOMFormData.h" | 38 #include "core/html/DOMFormData.h" |
| 38 #include "core/html/HTMLFormControlElement.h" | 39 #include "core/html/HTMLFormControlElement.h" |
| 39 #include "core/html/HTMLFormElement.h" | 40 #include "core/html/HTMLFormElement.h" |
| 40 #include "core/html/HTMLInputElement.h" | 41 #include "core/html/HTMLInputElement.h" |
| 41 #include "core/html/parser/HTMLParserIdioms.h" | 42 #include "core/html/parser/HTMLParserIdioms.h" |
| 42 #include "core/loader/FrameLoadRequest.h" | 43 #include "core/loader/FrameLoadRequest.h" |
| 43 #include "core/loader/FrameLoader.h" | 44 #include "core/loader/FrameLoader.h" |
| 44 #include "platform/RuntimeEnabledFeatures.h" | 45 #include "platform/RuntimeEnabledFeatures.h" |
| 45 #include "platform/heap/Handle.h" | 46 #include "platform/heap/Handle.h" |
| 46 #include "platform/network/FormData.h" | 47 #include "platform/network/FormData.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (m_method == FormSubmission::PostMethod) | 257 if (m_method == FormSubmission::PostMethod) |
| 257 return m_action; | 258 return m_action; |
| 258 | 259 |
| 259 KURL requestURL(m_action); | 260 KURL requestURL(m_action); |
| 260 requestURL.setQuery(m_formData->flattenToString()); | 261 requestURL.setQuery(m_formData->flattenToString()); |
| 261 return requestURL; | 262 return requestURL; |
| 262 } | 263 } |
| 263 | 264 |
| 264 void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) | 265 void FormSubmission::populateFrameLoadRequest(FrameLoadRequest& frameRequest) |
| 265 { | 266 { |
| 267 LocalFrame* frame = frameRequest.originDocument()->frame(); |
| 268 if (frame) |
| 269 frameRequest.resourceRequest().initializeForMainResource(frame->isMainFr
ame()); |
| 270 |
| 266 if (!m_target.isEmpty()) | 271 if (!m_target.isEmpty()) |
| 267 frameRequest.setFrameName(m_target); | 272 frameRequest.setFrameName(m_target); |
| 268 | 273 |
| 269 if (!m_referrer.referrer.isEmpty()) | 274 if (!m_referrer.referrer.isEmpty()) |
| 270 frameRequest.resourceRequest().setHTTPReferrer(m_referrer); | 275 frameRequest.resourceRequest().setHTTPReferrer(m_referrer); |
| 271 | 276 |
| 272 if (m_method == FormSubmission::PostMethod) { | 277 if (m_method == FormSubmission::PostMethod) { |
| 273 frameRequest.resourceRequest().setHTTPMethod("POST"); | 278 frameRequest.resourceRequest().setHTTPMethod("POST"); |
| 274 frameRequest.resourceRequest().setHTTPBody(m_formData); | 279 frameRequest.resourceRequest().setHTTPBody(m_formData); |
| 275 | 280 |
| 276 // construct some user headers if necessary | 281 // construct some user headers if necessary |
| 277 if (m_boundary.isEmpty()) | 282 if (m_boundary.isEmpty()) |
| 278 frameRequest.resourceRequest().setHTTPContentType(m_contentType); | 283 frameRequest.resourceRequest().setHTTPContentType(m_contentType); |
| 279 else | 284 else |
| 280 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); | 285 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); |
| 281 } | 286 } |
| 282 | 287 |
| 283 frameRequest.resourceRequest().setURL(requestURL()); | 288 frameRequest.resourceRequest().setURL(requestURL()); |
| 284 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), AtomicStr
ing(m_origin)); | 289 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), AtomicStr
ing(m_origin)); |
| 285 } | 290 } |
| 286 | 291 |
| 287 } | 292 } |
| OLD | NEW |