Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: Source/core/loader/FormSubmission.cpp

Issue 25417007: Handle crash when submitting an injected form on an "image page". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test cleanup and rebase code. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 bool isMultiPartForm = false; 196 bool isMultiPartForm = false;
197 String encodingType = copiedAttributes.encodingType(); 197 String encodingType = copiedAttributes.encodingType();
198 198
199 if (copiedAttributes.method() == PostMethod) { 199 if (copiedAttributes.method() == PostMethod) {
200 isMultiPartForm = copiedAttributes.isMultiPartForm(); 200 isMultiPartForm = copiedAttributes.isMultiPartForm();
201 if (isMultiPartForm && isMailtoForm) { 201 if (isMultiPartForm && isMailtoForm) {
202 encodingType = "application/x-www-form-urlencoded"; 202 encodingType = "application/x-www-form-urlencoded";
203 isMultiPartForm = false; 203 isMultiPartForm = false;
204 } 204 }
205 } 205 }
206 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input Encoding()); 206 WTF::TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBui lder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document.input Encoding(), document.defaultCharset());
207 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF orFormSubmission()); 207 RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingF orFormSubmission());
208 Vector<pair<String, String> > formValues; 208 Vector<pair<String, String> > formValues;
209 209
210 bool containsPasswordData = false; 210 bool containsPasswordData = false;
211 for (unsigned i = 0; i < form->associatedElements().size(); ++i) { 211 for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
212 FormAssociatedElement* control = form->associatedElements()[i]; 212 FormAssociatedElement* control = form->associatedElements()[i];
213 HTMLElement* element = toHTMLElement(control); 213 HTMLElement* element = toHTMLElement(control);
214 if (!element->isDisabledFormControl()) 214 if (!element->isDisabledFormControl())
215 control->appendFormData(*domFormData, isMultiPartForm); 215 control->appendFormData(*domFormData, isMultiPartForm);
216 if (element->hasTagName(inputTag)) { 216 if (element->hasTagName(inputTag)) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 frameRequest.resourceRequest().setHTTPContentType(m_contentType); 271 frameRequest.resourceRequest().setHTTPContentType(m_contentType);
272 else 272 else
273 frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary); 273 frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary);
274 } 274 }
275 275
276 frameRequest.resourceRequest().setURL(requestURL()); 276 frameRequest.resourceRequest().setURL(requestURL());
277 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin) ; 277 FrameLoader::addHTTPOriginIfNeeded(frameRequest.resourceRequest(), m_origin) ;
278 } 278 }
279 279
280 } 280 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/images/image-page-injected-script-crash-expected.txt ('k') | Source/core/platform/network/FormDataBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698