Chromium Code Reviews| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | |
|
Mike West
2016/07/28 09:26:47
Drop this comment; at this point, I don't think we
ramya.v
2016/07/28 09:37:15
Done.
| |
| 301 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.")); | |
| 302 return; | |
| 303 } | |
| 304 | |
| 299 bool skipValidation = !document().page() || noValidate(); | 305 bool skipValidation = !document().page() || noValidate(); |
| 300 ASSERT(event); | 306 ASSERT(event); |
| 301 HTMLFormControlElement* submitElement = submitElementFromEvent(event); | 307 HTMLFormControlElement* submitElement = submitElementFromEvent(event); |
| 302 if (submitElement && submitElement->formNoValidate()) | 308 if (submitElement && submitElement->formNoValidate()) |
| 303 skipValidation = true; | 309 skipValidation = true; |
| 304 | 310 |
| 305 UseCounter::count(document(), UseCounter::FormSubmissionStarted); | 311 UseCounter::count(document(), UseCounter::FormSubmissionStarted); |
| 306 // Interactive validation must be done before dispatching the submit event. | 312 // Interactive validation must be done before dispatching the submit event. |
| 307 if (!skipValidation && !validateInteractively()) | 313 if (!skipValidation && !validateInteractively()) |
| 308 return; | 314 return; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 m_isSubmittingOrInUserJSSubmitEvent = false; | 393 m_isSubmittingOrInUserJSSubmitEvent = false; |
| 388 } | 394 } |
| 389 | 395 |
| 390 void HTMLFormElement::scheduleFormSubmission(FormSubmission* submission) | 396 void HTMLFormElement::scheduleFormSubmission(FormSubmission* submission) |
| 391 { | 397 { |
| 392 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met hod() == FormSubmission::GetMethod); | 398 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met hod() == FormSubmission::GetMethod); |
| 393 ASSERT(submission->data()); | 399 ASSERT(submission->data()); |
| 394 ASSERT(submission->form()); | 400 ASSERT(submission->form()); |
| 395 if (submission->action().isEmpty()) | 401 if (submission->action().isEmpty()) |
| 396 return; | 402 return; |
| 397 if (document().isSandboxed(SandboxForms)) { | 403 if (document().isSandboxed(SandboxForms)) { |
|
Mike West
2016/07/28 09:26:47
Can we change this to a DCHECK? I think `prepareFo
ramya.v
2016/07/28 09:37:15
I tried removing this code from here in patchset1.
| |
| 398 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 404 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 399 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSourc e, ErrorMessageLevel, "Blocked form submission to '" + submission->action().elid edString() + "' because the form's frame is sandboxed and the 'allow-forms' perm ission is not set.")); | 405 document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSourc e, ErrorMessageLevel, "Blocked form submission to '" + submission->action().elid edString() + "' because the form's frame is sandboxed and the 'allow-forms' perm ission is not set.")); |
| 400 return; | 406 return; |
| 401 } | 407 } |
| 402 | 408 |
| 403 if (protocolIsJavaScript(submission->action())) { | 409 if (protocolIsJavaScript(submission->action())) { |
| 404 if (!document().contentSecurityPolicy()->allowFormAction(submission->act ion())) | 410 if (!document().contentSecurityPolicy()->allowFormAction(submission->act ion())) |
| 405 return; | 411 return; |
| 406 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion()); | 412 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion()); |
| 407 return; | 413 return; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 784 { | 790 { |
| 785 for (const auto& control : associatedElements()) { | 791 for (const auto& control : associatedElements()) { |
| 786 if (!control->isFormControlElement()) | 792 if (!control->isFormControlElement()) |
| 787 continue; | 793 continue; |
| 788 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) | 794 if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
| 789 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault); | 795 toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::P seudoDefault); |
| 790 } | 796 } |
| 791 } | 797 } |
| 792 | 798 |
| 793 } // namespace blink | 799 } // namespace blink |
| OLD | NEW |