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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 1039833002: [Password Manager] Unify action and origin detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 years, 9 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
Index: components/autofill/content/renderer/password_autofill_agent.cc
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 357ab1e8eca3ca228c39e42d00296a617b46bb5b..16b612e0a1b81d7ef26363322e8ccc4f06a321bf 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -188,16 +188,11 @@ void FindFormElements(content::RenderFrame* render_frame,
FormElementsList* results) {
DCHECK(results);
- GURL::Replacements rep;
- rep.ClearQuery();
- rep.ClearRef();
-
blink::WebDocument doc = render_frame->GetWebFrame()->document();
if (!doc.isHTMLDocument())
return;
- GURL full_origin(doc.url());
- if (data.origin != full_origin.ReplaceComponents(rep))
+ if (data.origin != GetCanonicalOriginForDocument(doc))
return;
blink::WebVector<blink::WebFormElement> forms;
@@ -206,14 +201,8 @@ void FindFormElements(content::RenderFrame* render_frame,
for (size_t i = 0; i < forms.size(); ++i) {
blink::WebFormElement fe = forms[i];
- GURL full_action(doc.completeURL(fe.action()));
- if (full_action.is_empty()) {
- // The default action URL is the form's origin.
- full_action = full_origin;
- }
-
// Action URL must match.
- if (data.action != full_action.ReplaceComponents(rep))
+ if (data.action != GetCanonicalActionForForm(fe))
continue;
scoped_ptr<FormElements> curr_elements(new FormElements);

Powered by Google App Engine
This is Rietveld 408576698