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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 2191493002: Form submission should abort before constraint validation if sandboxed forms flag is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/frames/resources/sandboxed-iframe-src.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 return false; 290 return false;
291 } 291 }
292 292
293 void HTMLFormElement::prepareForSubmission(Event* event) 293 void HTMLFormElement::prepareForSubmission(Event* event)
294 { 294 {
295 LocalFrame* frame = document().frame(); 295 LocalFrame* frame = document().frame();
296 if (!frame || m_isSubmittingOrInUserJSSubmitEvent) 296 if (!frame || m_isSubmittingOrInUserJSSubmitEvent)
297 return; 297 return;
298 298
299 if (document().isSandboxed(SandboxForms)) {
300 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSourc e, ErrorMessageLevel, "Blocked form submission to '" + m_attributes.action() + " ' because the form's frame is sandboxed and the 'allow-forms' permission is not set."));
301 return;
302 }
303
299 bool skipValidation = !document().page() || noValidate(); 304 bool skipValidation = !document().page() || noValidate();
300 ASSERT(event); 305 ASSERT(event);
301 HTMLFormControlElement* submitElement = submitElementFromEvent(event); 306 HTMLFormControlElement* submitElement = submitElementFromEvent(event);
302 if (submitElement && submitElement->formNoValidate()) 307 if (submitElement && submitElement->formNoValidate())
303 skipValidation = true; 308 skipValidation = true;
304 309
305 UseCounter::count(document(), UseCounter::FormSubmissionStarted); 310 UseCounter::count(document(), UseCounter::FormSubmissionStarted);
306 // Interactive validation must be done before dispatching the submit event. 311 // Interactive validation must be done before dispatching the submit event.
307 if (!skipValidation && !validateInteractively()) 312 if (!skipValidation && !validateInteractively())
308 return; 313 return;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 { 789 {
785 for (const auto& control : associatedElements()) { 790 for (const auto& control : associatedElements()) {
786 if (!control->isFormControlElement()) 791 if (!control->isFormControlElement())
787 continue; 792 continue;
788 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) 793 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton())
789 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault); 794 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault);
790 } 795 }
791 } 796 }
792 797
793 } // namespace blink 798 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/frames/resources/sandboxed-iframe-src.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698