https://bugs.webkit.org/show_bug.cgi?id=81003
Patch by Marja Hölttä <marja@google.com> on 2012-03-14
Reviewed by Darin Fisher.
This change enables Chrome to save HTTP bodies selectively, only
if they don't contain passwords.
Source/WebCore:
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create): Check if the data contains passwords.
* platform/network/FormData.cpp:
(WebCore::FormData::FormData): Added containsPasswordData, setContainsPasswordData.
* platform/network/FormData.h:
(WebCore::FormData::containsPasswordData): Added.
(WebCore::FormData::setHasPasswordData): Added.
(FormData):
Source/WebKit/chromium:
* public/platform/WebHTTPBody.h:
(WebHTTPBody): Added containsPasswordData, setContainsPasswordData.
* src/WebHTTPBody.cpp:
(WebKit::WebHTTPBody::containsPasswordData): Added.
(WebKit):
(WebKit::WebHTTPBody::setContainsPasswordData): Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110695
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-14 Marja Hölttä <marja@google.com>
+
+ WebHTTPBody: Keep track of whether the data includes passwords.
+ https://bugs.webkit.org/show_bug.cgi?id=81003
+
+ Reviewed by Darin Fisher.
+
+ This change enables Chrome to save HTTP bodies selectively, only
+ if they don't contain passwords.
+
+ * loader/FormSubmission.cpp:
+ (WebCore::FormSubmission::create): Check if the data contains passwords.
+ * platform/network/FormData.cpp:
+ (WebCore::FormData::FormData): Added containsPasswordData, setContainsPasswordData.
+ * platform/network/FormData.h:
+ (WebCore::FormData::containsPasswordData): Added.
+ (WebCore::FormData::setHasPasswordData): Added.
+ (FormData):
+
2012-03-14 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Add snippets tab to scripts navigator.
RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission());
Vector<pair<String, String> > formValues;
+ bool containsPasswordData = false;
for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
FormAssociatedElement* control = form->associatedElements()[i];
HTMLElement* element = toHTMLElement(control);
if (input->isSearchField())
input->addSearchResult();
}
+ if (input->isPasswordField() && !input->value().isEmpty())
+ containsPasswordData = true;
}
}
}
formData->setIdentifier(generateFormDataIdentifier());
+ formData->setContainsPasswordData(containsPasswordData);
String targetOrBaseTarget = copiedAttributes.target().isEmpty() ? document->baseTarget() : copiedAttributes.target();
RefPtr<FormState> formState = FormState::create(form, formValues, document->frame(), trigger);
return adoptRef(new FormSubmission(copiedAttributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event));
: m_identifier(0)
, m_hasGeneratedFiles(false)
, m_alwaysStream(false)
+ , m_containsPasswordData(false)
{
}
, m_identifier(data.m_identifier)
, m_hasGeneratedFiles(false)
, m_alwaysStream(false)
+ , m_containsPasswordData(data.m_containsPasswordData)
{
// We shouldn't be copying FormData that hasn't already removed its generated files
// but just in case, make sure the new FormData is ready to generate its own files.
void setIdentifier(int64_t identifier) { m_identifier = identifier; }
int64_t identifier() const { return m_identifier; }
+ bool containsPasswordData() const { return m_containsPasswordData; }
+ void setContainsPasswordData(bool containsPasswordData) { m_containsPasswordData = containsPasswordData; }
+
static EncodingType parseEncodingType(const String& type)
{
if (equalIgnoringCase(type, "text/plain"))
bool m_hasGeneratedFiles;
bool m_alwaysStream;
Vector<char> m_boundary;
+ bool m_containsPasswordData;
};
inline bool operator==(const FormData& a, const FormData& b)
+2012-03-14 Marja Hölttä <marja@google.com>
+
+ WebHTTPBody: Keep track of whether the data includes passwords.
+ https://bugs.webkit.org/show_bug.cgi?id=81003
+
+ Reviewed by Darin Fisher.
+
+ This change enables Chrome to save HTTP bodies selectively, only
+ if they don't contain passwords.
+
+ * public/platform/WebHTTPBody.h:
+ (WebHTTPBody): Added containsPasswordData, setContainsPasswordData.
+ * src/WebHTTPBody.cpp:
+ (WebKit::WebHTTPBody::containsPasswordData): Added.
+ (WebKit):
+ (WebKit::WebHTTPBody::setContainsPasswordData): Added.
+
2012-03-14 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed. Rolled DEPS.
WEBKIT_EXPORT long long identifier() const;
WEBKIT_EXPORT void setIdentifier(long long);
+ WEBKIT_EXPORT bool containsPasswordData() const;
+ WEBKIT_EXPORT void setContainsPasswordData(bool);
+
#if WEBKIT_IMPLEMENTATION
WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&);
WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&);
return m_private->setIdentifier(identifier);
}
+bool WebHTTPBody::containsPasswordData() const
+{
+ return m_private->containsPasswordData();
+}
+
+void WebHTTPBody::setContainsPasswordData(bool containsPasswordData)
+{
+ m_private->setContainsPasswordData(containsPasswordData);
+}
+
WebHTTPBody::WebHTTPBody(const PassRefPtr<FormData>& data)
: m_private(static_cast<WebHTTPBodyPrivate*>(data.leakRef()))
{