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

Unified Diff: Source/core/loader/FormSubmission.cpp

Issue 311033003: Implementing mixed content for forms posting to insecure location from secure ones (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed the error when action attribute is empty. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FormSubmission.h ('k') | Source/core/loader/MixedContentChecker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FormSubmission.cpp
diff --git a/Source/core/loader/FormSubmission.cpp b/Source/core/loader/FormSubmission.cpp
index 283b54c19f6819f3b71f61b1b3b3f151780c8fd3..d3266fee4828fe7950365c17a111789c9dbc8d58 100644
--- a/Source/core/loader/FormSubmission.cpp
+++ b/Source/core/loader/FormSubmission.cpp
@@ -83,10 +83,9 @@ static void appendMailtoPostFormDataToURL(KURL& url, const FormData& data, const
url.setQuery(query.toString());
}
-void FormSubmission::Attributes::parseAction(const String& action)
+void FormSubmission::Attributes::parseAction(const Document& document, const String& action)
{
- // FIXME: Can we parse into a KURL?
- m_action = stripLeadingAndTrailingHTMLSpaces(action);
+ m_action = action.isEmpty() ? KURL() : document.completeURL(stripLeadingAndTrailingHTMLSpaces(action));
}
AtomicString FormSubmission::Attributes::parseEncodingType(const String& type)
@@ -180,7 +179,7 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
if (submitButton) {
AtomicString attributeValue;
if (!(attributeValue = submitButton->fastGetAttribute(formactionAttr)).isNull())
- copiedAttributes.parseAction(attributeValue);
+ copiedAttributes.parseAction(form->document(), attributeValue);
if (!(attributeValue = submitButton->fastGetAttribute(formenctypeAttr)).isNull())
copiedAttributes.updateEncodingType(attributeValue);
if (!(attributeValue = submitButton->fastGetAttribute(formmethodAttr)).isNull())
@@ -196,7 +195,7 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
}
Document& document = form->document();
- KURL actionURL = document.completeURL(copiedAttributes.action().isEmpty() ? document.url().string() : copiedAttributes.action());
+ KURL actionURL = copiedAttributes.action().isEmpty() ? document.url() : copiedAttributes.action();
bool isMailtoForm = actionURL.protocolIs("mailto");
bool isMultiPartForm = false;
AtomicString encodingType = copiedAttributes.encodingType();
« no previous file with comments | « Source/core/loader/FormSubmission.h ('k') | Source/core/loader/MixedContentChecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698