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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 #if !ENABLE(OILPAN) | 65 #if !ENABLE(OILPAN) |
66 , m_weakPtrFactory(this) | 66 , m_weakPtrFactory(this) |
67 #endif | 67 #endif |
68 , m_associatedElementsAreDirty(false) | 68 , m_associatedElementsAreDirty(false) |
69 , m_imageElementsAreDirty(false) | 69 , m_imageElementsAreDirty(false) |
70 , m_hasElementsAssociatedByParser(false) | 70 , m_hasElementsAssociatedByParser(false) |
71 , m_didFinishParsingChildren(false) | 71 , m_didFinishParsingChildren(false) |
72 , m_wasUserSubmitted(false) | 72 , m_wasUserSubmitted(false) |
73 , m_isInResetFunction(false) | 73 , m_isInResetFunction(false) |
74 , m_wasDemoted(false) | 74 , m_wasDemoted(false) |
75 , m_insecureSubmissionReported(false) | |
75 , m_pendingAutocompleteEventsQueue(GenericEventQueue::create(this)) | 76 , m_pendingAutocompleteEventsQueue(GenericEventQueue::create(this)) |
76 { | 77 { |
77 ScriptWrappable::init(this); | 78 ScriptWrappable::init(this); |
78 } | 79 } |
79 | 80 |
80 PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLFormElement::create(Document& docume nt) | 81 PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLFormElement::create(Document& docume nt) |
81 { | 82 { |
82 UseCounter::count(document, UseCounter::FormElement); | 83 UseCounter::count(document, UseCounter::FormElement); |
83 return adoptRefWillBeRefCountedGarbageCollected(new HTMLFormElement(document )); | 84 return adoptRefWillBeRefCountedGarbageCollected(new HTMLFormElement(document )); |
84 } | 85 } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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" | |
351 KURL actionURL = document().completeURL(m_attributes.action().isEmpty() ? do cument().url().string() : m_attributes.action()); | |
jww
2014/06/05 03:49:46
You should probably factor all of this out into a
mhm
2014/06/05 17:04:28
Done.
| |
352 if (!frame->loader().mixedContentChecker()->canDisplayInsecureContent(docume nt().securityOrigin(), actionURL)) { | |
353 m_insecureSubmissionReported = true; | |
354 return; | |
355 } | |
356 | |
349 m_wasUserSubmitted = processingUserGesture; | 357 m_wasUserSubmitted = processingUserGesture; |
350 | 358 |
351 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; | 359 RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nul lptr; |
352 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? | 360 bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button? |
353 | 361 |
354 const FormAssociatedElement::List& elements = associatedElements(); | 362 const FormAssociatedElement::List& elements = associatedElements(); |
355 for (unsigned i = 0; i < elements.size(); ++i) { | 363 for (unsigned i = 0; i < elements.size(); ++i) { |
356 FormAssociatedElement* associatedElement = elements[i]; | 364 FormAssociatedElement* associatedElement = elements[i]; |
357 if (!associatedElement->isFormControlElement()) | 365 if (!associatedElement->isFormControlElement()) |
358 continue; | 366 continue; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 bool HTMLFormElement::shouldAutocomplete() const | 748 bool HTMLFormElement::shouldAutocomplete() const |
741 { | 749 { |
742 return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); | 750 return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); |
743 } | 751 } |
744 | 752 |
745 void HTMLFormElement::finishParsingChildren() | 753 void HTMLFormElement::finishParsingChildren() |
746 { | 754 { |
747 HTMLElement::finishParsingChildren(); | 755 HTMLElement::finishParsingChildren(); |
748 document().formController().restoreControlStateIn(*this); | 756 document().formController().restoreControlStateIn(*this); |
749 m_didFinishParsingChildren = true; | 757 m_didFinishParsingChildren = true; |
758 | |
759 // If the post is pointing to insecure "action" location from a secure page | |
760 // it is mixed content. | |
761 KURL actionURL = document().completeURL(m_attributes.action().isEmpty() ? do cument().url().string() : m_attributes.action()); | |
jww
2014/06/05 03:49:46
See comment above about factoring this logic out.
mhm
2014/06/05 17:04:28
Done.
| |
762 if (!m_insecureSubmissionReported && MixedContentChecker::isMixedContent(doc ument().securityOrigin(), actionURL)) { | |
jww
2014/06/05 03:49:46
Although it's technically not needed, for clarify,
mhm
2014/06/05 17:04:28
Done.
| |
763 document().frame()->loader().mixedContentChecker()->canDisplayInsecureCo ntent(document().securityOrigin(), actionURL); | |
764 m_insecureSubmissionReported = true; | |
765 } | |
750 } | 766 } |
751 | 767 |
752 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e) | 768 void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc e) |
753 { | 769 { |
754 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; | 770 m_wasDemoted = static_cast<const HTMLFormElement&>(source).m_wasDemoted; |
755 HTMLElement::copyNonAttributePropertiesFromElement(source); | 771 HTMLElement::copyNonAttributePropertiesFromElement(source); |
756 } | 772 } |
757 | 773 |
758 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtrWillBeRawPtr<RadioNodeList>& returnValue0, bool& returnVal ue1Enabled, RefPtrWillBeRawPtr<Element>& returnValue1) | 774 void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, bool& retur nValue0Enabled, RefPtrWillBeRawPtr<RadioNodeList>& returnValue0, bool& returnVal ue1Enabled, RefPtrWillBeRawPtr<Element>& returnValue1) |
759 { | 775 { |
(...skipping 24 matching lines...) Expand all Loading... | |
784 returnValue0 = radioNodeList(name, onlyMatchImg); | 800 returnValue0 = radioNodeList(name, onlyMatchImg); |
785 } | 801 } |
786 | 802 |
787 void HTMLFormElement::setDemoted(bool demoted) | 803 void HTMLFormElement::setDemoted(bool demoted) |
788 { | 804 { |
789 if (demoted) | 805 if (demoted) |
790 UseCounter::count(document(), UseCounter::DemotedFormElement); | 806 UseCounter::count(document(), UseCounter::DemotedFormElement); |
791 m_wasDemoted = demoted; | 807 m_wasDemoted = demoted; |
792 } | 808 } |
793 | 809 |
810 void HTMLFormElement::attributeChanged(const QualifiedName& name, const AtomicSt ring& newValue, AttributeModificationReason) | |
jww
2014/06/05 03:49:46
Does this get called when the object is initially
mhm
2014/06/05 17:04:28
Done.
mhm
2014/06/05 17:04:28
Yes it does get called :-)
Removed redundant code
| |
811 { | |
812 Element::attributeChanged(name, newValue); | |
813 | |
814 if (name == actionAttr) { | |
815 // If the new action attribute is pointing to insecure "action" location from a secure page | |
816 // it is mixed content. | |
817 KURL actionURL = document().completeURL(m_attributes.action().isEmpty() ? document().url().string() : m_attributes.action()); | |
jww
2014/06/05 03:49:46
Assuming you don't remove the logic in finishParsi
mhm
2014/06/05 17:04:28
Done.
| |
818 if (!m_insecureSubmissionReported && MixedContentChecker::isMixedContent (document().securityOrigin(), actionURL)) { | |
819 document().frame()->loader().mixedContentChecker()->canDisplayInsecu reContent(document().securityOrigin(), actionURL); | |
820 m_insecureSubmissionReported = true; | |
821 } | |
822 } | |
823 } | |
824 | |
794 } // namespace | 825 } // namespace |
OLD | NEW |