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" | |
44 #include "core/html/HTMLCollection.h" | 40 #include "core/html/HTMLCollection.h" |
45 #include "core/html/HTMLDialogElement.h" | 41 #include "core/html/HTMLDialogElement.h" |
46 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
47 #include "core/html/HTMLInputElement.h" | 43 #include "core/html/HTMLInputElement.h" |
48 #include "core/html/HTMLObjectElement.h" | 44 #include "core/html/HTMLObjectElement.h" |
49 #include "core/html/RadioNodeList.h" | 45 #include "core/html/RadioNodeList.h" |
50 #include "core/html/forms/FormController.h" | 46 #include "core/html/forms/FormController.h" |
51 #include "core/loader/FrameLoader.h" | 47 #include "core/loader/FrameLoader.h" |
52 #include "core/loader/FrameLoaderClient.h" | 48 #include "core/loader/FrameLoaderClient.h" |
53 #include "core/loader/MixedContentChecker.h" | 49 #include "core/frame/DOMWindow.h" |
| 50 #include "core/frame/LocalFrame.h" |
| 51 #include "core/frame/UseCounter.h" |
| 52 #include "core/frame/csp/ContentSecurityPolicy.h" |
54 #include "core/rendering/RenderTextControl.h" | 53 #include "core/rendering/RenderTextControl.h" |
55 #include "platform/UserGestureIndicator.h" | 54 #include "platform/UserGestureIndicator.h" |
56 #include "wtf/text/AtomicString.h" | |
57 | 55 |
58 using namespace std; | 56 using namespace std; |
59 | 57 |
60 namespace WebCore { | 58 namespace WebCore { |
61 | 59 |
62 using namespace HTMLNames; | 60 using namespace HTMLNames; |
63 | 61 |
64 namespace { | |
65 | |
66 KURL getActionURL(const Document& document, const String& action) | |
67 { | |
68 return (action.isEmpty() ? document.url() : document.completeURL(action)
); | |
69 } | |
70 | |
71 } // namespace | |
72 | |
73 HTMLFormElement::HTMLFormElement(Document& document) | 62 HTMLFormElement::HTMLFormElement(Document& document) |
74 : HTMLElement(formTag, document) | 63 : HTMLElement(formTag, document) |
75 #if !ENABLE(OILPAN) | 64 #if !ENABLE(OILPAN) |
76 , m_weakPtrFactory(this) | 65 , m_weakPtrFactory(this) |
77 #endif | 66 #endif |
78 , m_associatedElementsAreDirty(false) | 67 , m_associatedElementsAreDirty(false) |
79 , m_imageElementsAreDirty(false) | 68 , m_imageElementsAreDirty(false) |
80 , m_hasElementsAssociatedByParser(false) | 69 , m_hasElementsAssociatedByParser(false) |
81 , m_didFinishParsingChildren(false) | 70 , m_didFinishParsingChildren(false) |
82 , m_wasUserSubmitted(false) | 71 , m_wasUserSubmitted(false) |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 340 |
352 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce
ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) | 341 void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool proce
ssingUserGesture, FormSubmissionTrigger formSubmissionTrigger) |
353 { | 342 { |
354 FrameView* view = document().view(); | 343 FrameView* view = document().view(); |
355 LocalFrame* frame = document().frame(); | 344 LocalFrame* frame = document().frame(); |
356 if (!view || !frame || !frame->page()) | 345 if (!view || !frame || !frame->page()) |
357 return; | 346 return; |
358 | 347 |
359 m_wasUserSubmitted = processingUserGesture; | 348 m_wasUserSubmitted = processingUserGesture; |
360 | 349 |
361 KURL actionURL = getActionURL(document(), m_attributes.action()); | |
362 if (MixedContentChecker::isMixedContent(document().securityOrigin(), actionU
RL)) | |
363 UseCounter::count(document(), UseCounter::MixedContentSubmittedForm); | |
364 | |
365 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul
lptr; | 350 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul
lptr; |
366 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? | 351 bool needButtonActivation = activateSubmitButton; // do we need to activate
a submit button? |
367 | 352 |
368 const FormAssociatedElement::List& elements = associatedElements(); | 353 const FormAssociatedElement::List& elements = associatedElements(); |
369 for (unsigned i = 0; i < elements.size(); ++i) { | 354 for (unsigned i = 0; i < elements.size(); ++i) { |
370 FormAssociatedElement* associatedElement = elements[i]; | 355 FormAssociatedElement* associatedElement = elements[i]; |
371 if (!associatedElement->isFormControlElement()) | 356 if (!associatedElement->isFormControlElement()) |
372 continue; | 357 continue; |
373 if (needButtonActivation) { | 358 if (needButtonActivation) { |
374 HTMLFormControlElement* control = toHTMLFormControlElement(associate
dElement); | 359 HTMLFormControlElement* control = toHTMLFormControlElement(associate
dElement); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 returnValue0 = radioNodeList(name, onlyMatchImg); | 783 returnValue0 = radioNodeList(name, onlyMatchImg); |
799 } | 784 } |
800 | 785 |
801 void HTMLFormElement::setDemoted(bool demoted) | 786 void HTMLFormElement::setDemoted(bool demoted) |
802 { | 787 { |
803 if (demoted) | 788 if (demoted) |
804 UseCounter::count(document(), UseCounter::DemotedFormElement); | 789 UseCounter::count(document(), UseCounter::DemotedFormElement); |
805 m_wasDemoted = demoted; | 790 m_wasDemoted = demoted; |
806 } | 791 } |
807 | 792 |
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("")); | |
819 if (MixedContentChecker::isMixedContent(document().securityOrigin(), act
ionURL)) | |
820 UseCounter::count(document(), UseCounter::MixedContentForm); | |
821 } | |
822 } | |
823 | |
824 } // namespace | 793 } // namespace |
OLD | NEW |