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

Side by Side Diff: Source/core/html/HTMLFormElement.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: Addressed reviewers comments and fixed formatting. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 20 matching lines...) Expand all
31 #include "bindings/v8/ScriptController.h" 31 #include "bindings/v8/ScriptController.h"
32 #include "bindings/v8/ScriptEventListener.h" 32 #include "bindings/v8/ScriptEventListener.h"
33 #include "core/dom/Attribute.h" 33 #include "core/dom/Attribute.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/ElementTraversal.h" 35 #include "core/dom/ElementTraversal.h"
36 #include "core/dom/IdTargetObserverRegistry.h" 36 #include "core/dom/IdTargetObserverRegistry.h"
37 #include "core/events/AutocompleteErrorEvent.h" 37 #include "core/events/AutocompleteErrorEvent.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/events/GenericEventQueue.h" 39 #include "core/events/GenericEventQueue.h"
40 #include "core/events/ScopedEventQueue.h" 40 #include "core/events/ScopedEventQueue.h"
41 #include "core/frame/DOMWindow.h"
42 #include "core/frame/LocalFrame.h"
43 #include "core/frame/UseCounter.h"
44 #include "core/frame/csp/ContentSecurityPolicy.h"
41 #include "core/html/HTMLCollection.h" 45 #include "core/html/HTMLCollection.h"
42 #include "core/html/HTMLDialogElement.h" 46 #include "core/html/HTMLDialogElement.h"
43 #include "core/html/HTMLImageElement.h" 47 #include "core/html/HTMLImageElement.h"
44 #include "core/html/HTMLInputElement.h" 48 #include "core/html/HTMLInputElement.h"
45 #include "core/html/HTMLObjectElement.h" 49 #include "core/html/HTMLObjectElement.h"
46 #include "core/html/RadioNodeList.h" 50 #include "core/html/RadioNodeList.h"
47 #include "core/html/forms/FormController.h" 51 #include "core/html/forms/FormController.h"
48 #include "core/loader/FrameLoader.h" 52 #include "core/loader/FrameLoader.h"
49 #include "core/loader/FrameLoaderClient.h" 53 #include "core/loader/FrameLoaderClient.h"
50 #include "core/frame/DOMWindow.h" 54 #include "core/loader/MixedContentChecker.h"
51 #include "core/frame/LocalFrame.h"
52 #include "core/frame/UseCounter.h"
53 #include "core/frame/csp/ContentSecurityPolicy.h"
54 #include "core/rendering/RenderTextControl.h" 55 #include "core/rendering/RenderTextControl.h"
55 #include "platform/UserGestureIndicator.h" 56 #include "platform/UserGestureIndicator.h"
56 57
57 using namespace std; 58 using namespace std;
58 59
59 namespace WebCore { 60 namespace WebCore {
60 61
61 using namespace HTMLNames; 62 using namespace HTMLNames;
62 63
63 HTMLFormElement::HTMLFormElement(Document& document) 64 HTMLFormElement::HTMLFormElement(Document& document)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 340 }
340 } 341 }
341 342
342 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) 343 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
343 { 344 {
344 FrameView* view = document().view(); 345 FrameView* view = document().view();
345 LocalFrame* frame = document().frame(); 346 LocalFrame* frame = document().frame();
346 if (!view || !frame || !frame->page()) 347 if (!view || !frame || !frame->page())
347 return; 348 return;
348 349
350 // Mixed content with form submission to insecure "action"
jww 2014/06/05 17:35:05 This comment is actually a bit unclear. Can you be
mhm 2014/06/05 17:47:43 Done.
351 KURL actionURL = getActionURL();
352 if (!frame->loader().mixedContentChecker()->canDisplayInsecureContent(docume nt().securityOrigin(), actionURL))
Mike West 2014/06/05 17:51:26 Please add a UseCounter here so we know what perce
353 return;
354
349 m_wasUserSubmitted = processingUserGesture; 355 m_wasUserSubmitted = processingUserGesture;
350 356
351 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; 357 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr;
352 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? 358 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
353 359
354 const FormAssociatedElement::List& elements = associatedElements(); 360 const FormAssociatedElement::List& elements = associatedElements();
355 for (unsigned i = 0; i < elements.size(); ++i) { 361 for (unsigned i = 0; i < elements.size(); ++i) {
356 FormAssociatedElement* associatedElement = elements[i]; 362 FormAssociatedElement* associatedElement = elements[i];
357 if (!associatedElement->isFormControlElement()) 363 if (!associatedElement->isFormControlElement())
358 continue; 364 continue;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 returnValue0 = radioNodeList(name, onlyMatchImg); 790 returnValue0 = radioNodeList(name, onlyMatchImg);
785 } 791 }
786 792
787 void HTMLFormElement::setDemoted(bool demoted) 793 void HTMLFormElement::setDemoted(bool demoted)
788 { 794 {
789 if (demoted) 795 if (demoted)
790 UseCounter::count(document(), UseCounter::DemotedFormElement); 796 UseCounter::count(document(), UseCounter::DemotedFormElement);
791 m_wasDemoted = demoted; 797 m_wasDemoted = demoted;
792 } 798 }
793 799
800 void HTMLFormElement::attributeChanged(const QualifiedName& name, const AtomicSt ring& newValue, AttributeModificationReason)
801 {
802 Element::attributeChanged(name, newValue);
803
804 if (name == actionAttr) {
805 // If the new action attribute is pointing to insecure "action" location from a secure page
806 // it is mixed content.
jww 2014/06/05 17:35:05 You should probably clarify "passive mixed content
mhm 2014/06/05 17:47:43 Done.
807 KURL actionURL = getActionURL();
808 if (MixedContentChecker::isMixedContent(document().securityOrigin(), act ionURL))
Mike West 2014/06/05 17:51:26 This is strange, but I understand why you did it.
809 document().frame()->loader().mixedContentChecker()->canDisplayInsecu reContent(document().securityOrigin(), actionURL);
810 }
811 }
812
794 } // namespace 813 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698