OLD | NEW |
---|---|
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 19 matching lines...) Expand all Loading... | |
30 #include "bindings/v8/ScriptController.h" | 30 #include "bindings/v8/ScriptController.h" |
31 #include "bindings/v8/ScriptEventListener.h" | 31 #include "bindings/v8/ScriptEventListener.h" |
32 #include "core/dom/Attribute.h" | 32 #include "core/dom/Attribute.h" |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/dom/ElementTraversal.h" | 34 #include "core/dom/ElementTraversal.h" |
35 #include "core/dom/IdTargetObserverRegistry.h" | 35 #include "core/dom/IdTargetObserverRegistry.h" |
36 #include "core/events/AutocompleteErrorEvent.h" | 36 #include "core/events/AutocompleteErrorEvent.h" |
37 #include "core/events/Event.h" | 37 #include "core/events/Event.h" |
38 #include "core/events/GenericEventQueue.h" | 38 #include "core/events/GenericEventQueue.h" |
39 #include "core/events/ScopedEventQueue.h" | 39 #include "core/events/ScopedEventQueue.h" |
40 #include "core/frame/DOMWindow.h" | |
41 #include "core/frame/LocalFrame.h" | |
42 #include "core/frame/UseCounter.h" | |
43 #include "core/frame/csp/ContentSecurityPolicy.h" | |
40 #include "core/html/HTMLCollection.h" | 44 #include "core/html/HTMLCollection.h" |
41 #include "core/html/HTMLDialogElement.h" | 45 #include "core/html/HTMLDialogElement.h" |
42 #include "core/html/HTMLImageElement.h" | 46 #include "core/html/HTMLImageElement.h" |
43 #include "core/html/HTMLInputElement.h" | 47 #include "core/html/HTMLInputElement.h" |
44 #include "core/html/HTMLObjectElement.h" | 48 #include "core/html/HTMLObjectElement.h" |
45 #include "core/html/RadioNodeList.h" | 49 #include "core/html/RadioNodeList.h" |
46 #include "core/html/forms/FormController.h" | 50 #include "core/html/forms/FormController.h" |
47 #include "core/loader/FrameLoader.h" | 51 #include "core/loader/FrameLoader.h" |
48 #include "core/loader/FrameLoaderClient.h" | 52 #include "core/loader/FrameLoaderClient.h" |
49 #include "core/frame/DOMWindow.h" | 53 #include "core/loader/MixedContentChecker.h" |
50 #include "core/frame/LocalFrame.h" | |
51 #include "core/frame/UseCounter.h" | |
52 #include "core/frame/csp/ContentSecurityPolicy.h" | |
53 #include "core/rendering/RenderTextControl.h" | 54 #include "core/rendering/RenderTextControl.h" |
54 #include "platform/UserGestureIndicator.h" | 55 #include "platform/UserGestureIndicator.h" |
56 #include "wtf/text/AtomicString.h" | |
55 | 57 |
56 using namespace std; | 58 using namespace std; |
57 | 59 |
58 namespace WebCore { | 60 namespace WebCore { |
59 | 61 |
60 using namespace HTMLNames; | 62 using namespace HTMLNames; |
61 | 63 |
64 namespace { | |
65 | |
66 KURL getActionURL(const Document& document, const String& action) | |
67 { | |
68 return (action.isEmpty() ? document.url() : document.completeURL(action) ); | |
abarth-chromium
2014/06/06 22:49:48
No need for the outer ( )
mhm
2014/06/07 01:21:26
Done.
| |
69 } | |
abarth-chromium
2014/06/06 22:49:48
No indent for namespaces, please.
mhm
2014/06/07 01:21:26
Done.
| |
70 | |
71 } // namespace | |
72 | |
62 HTMLFormElement::HTMLFormElement(Document& document) | 73 HTMLFormElement::HTMLFormElement(Document& document) |
63 : HTMLElement(formTag, document) | 74 : HTMLElement(formTag, document) |
64 #if !ENABLE(OILPAN) | 75 #if !ENABLE(OILPAN) |
65 , m_weakPtrFactory(this) | 76 , m_weakPtrFactory(this) |
66 #endif | 77 #endif |
67 , m_associatedElementsAreDirty(false) | 78 , m_associatedElementsAreDirty(false) |
68 , m_imageElementsAreDirty(false) | 79 , m_imageElementsAreDirty(false) |
69 , m_hasElementsAssociatedByParser(false) | 80 , m_hasElementsAssociatedByParser(false) |
70 , m_didFinishParsingChildren(false) | 81 , m_didFinishParsingChildren(false) |
71 , m_wasUserSubmitted(false) | 82 , m_wasUserSubmitted(false) |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 | 351 |
341 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) | 352 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) |
342 { | 353 { |
343 FrameView* view = document().view(); | 354 FrameView* view = document().view(); |
344 LocalFrame* frame = document().frame(); | 355 LocalFrame* frame = document().frame(); |
345 if (!view || !frame || !frame->page()) | 356 if (!view || !frame || !frame->page()) |
346 return; | 357 return; |
347 | 358 |
348 m_wasUserSubmitted = processingUserGesture; | 359 m_wasUserSubmitted = processingUserGesture; |
349 | 360 |
361 KURL actionURL = getActionURL(document(), m_attributes.action()); | |
362 if (MixedContentChecker::isMixedContent(document().securityOrigin(), actionU RL)) | |
363 UseCounter::count(document(), UseCounter::MixedContentSubmittedForm); | |
364 | |
350 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; | 365 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; |
351 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? | 366 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? |
352 | 367 |
353 const FormAssociatedElement::List& elements = associatedElements(); | 368 const FormAssociatedElement::List& elements = associatedElements(); |
354 for (unsigned i = 0; i < elements.size(); ++i) { | 369 for (unsigned i = 0; i < elements.size(); ++i) { |
355 FormAssociatedElement* associatedElement = elements[i]; | 370 FormAssociatedElement* associatedElement = elements[i]; |
356 if (!associatedElement->isFormControlElement()) | 371 if (!associatedElement->isFormControlElement()) |
357 continue; | 372 continue; |
358 if (needButtonActivation) { | 373 if (needButtonActivation) { |
359 HTMLFormControlElement* control = toHTMLFormControlElement(associate dElement); | 374 HTMLFormControlElement* control = toHTMLFormControlElement(associate dElement); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
783 returnValue0 = radioNodeList(name, onlyMatchImg); | 798 returnValue0 = radioNodeList(name, onlyMatchImg); |
784 } | 799 } |
785 | 800 |
786 void HTMLFormElement::setDemoted(bool demoted) | 801 void HTMLFormElement::setDemoted(bool demoted) |
787 { | 802 { |
788 if (demoted) | 803 if (demoted) |
789 UseCounter::count(document(), UseCounter::DemotedFormElement); | 804 UseCounter::count(document(), UseCounter::DemotedFormElement); |
790 m_wasDemoted = demoted; | 805 m_wasDemoted = demoted; |
791 } | 806 } |
792 | 807 |
808 void HTMLFormElement::attributeChanged(const QualifiedName& name, const AtomicSt ring& newValue, AttributeModificationReason) | |
809 { | |
810 Element::attributeChanged(name, newValue); | |
811 if (name == actionAttr) { | |
812 // If the new action attribute is pointing to insecure "action" location from a secure page | |
813 // it is marked as "passive" mixed content. In other words, it will just | |
814 // show a console warning unless the user override the preferences to | |
815 // block all mixed content. | |
816 KURL actionURL = getActionURL(document(), m_attributes.action()); | |
817 if (!document().frame()->loader().mixedContentChecker()->canSubmitToInse cureForm(document().securityOrigin(), actionURL)) | |
818 Element::attributeChanged(name, AtomicString("")); | |
abarth-chromium
2014/06/06 22:49:48
There's no reason to wrap "" in AtomicString(...).
| |
819 if (MixedContentChecker::isMixedContent(document().securityOrigin(), act ionURL)) | |
820 UseCounter::count(document(), UseCounter::MixedContentForm); | |
821 } | |
822 } | |
823 | |
793 } // namespace | 824 } // namespace |
OLD | NEW |