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

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, added counter for mixed content and made warning messages more develo… 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"
57 #include "wtf/text/AtomicString.h"
56 58
57 using namespace std; 59 using namespace std;
58 60
59 namespace WebCore { 61 namespace WebCore {
60 62
61 using namespace HTMLNames; 63 using namespace HTMLNames;
62 64
63 HTMLFormElement::HTMLFormElement(Document& document) 65 HTMLFormElement::HTMLFormElement(Document& document)
64 : HTMLElement(formTag, document) 66 : HTMLElement(formTag, document)
65 #if !ENABLE(OILPAN) 67 #if !ENABLE(OILPAN)
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 returnValue0 = radioNodeList(name, onlyMatchImg); 786 returnValue0 = radioNodeList(name, onlyMatchImg);
785 } 787 }
786 788
787 void HTMLFormElement::setDemoted(bool demoted) 789 void HTMLFormElement::setDemoted(bool demoted)
788 { 790 {
789 if (demoted) 791 if (demoted)
790 UseCounter::count(document(), UseCounter::DemotedFormElement); 792 UseCounter::count(document(), UseCounter::DemotedFormElement);
791 m_wasDemoted = demoted; 793 m_wasDemoted = demoted;
792 } 794 }
793 795
796 void HTMLFormElement::attributeChanged(const QualifiedName& name, const AtomicSt ring& newValue, AttributeModificationReason)
797 {
798 Element::attributeChanged(name, newValue);
799 if (name == actionAttr) {
800 // If the new action attribute is pointing to insecure "action" location from a secure page
801 // it is marked as "passive" mixed content. In other words, it will just
802 // show a console warning unless the user override the preferences to
803 // block all mixed content.
804 KURL actionURL = getActionURL();
805 if (!document().frame()->loader().mixedContentChecker()->canSubmitToInse cureForm(document().securityOrigin(), actionURL))
806 Element::attributeChanged(name, AtomicString(""));
807 if (MixedContentChecker::isMixedContent(document().securityOrigin(), act ionURL))
808 UseCounter::count(document(), UseCounter::MixedContentForm);
809 }
810 }
811
794 } // namespace 812 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698