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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "core/frame/UseCounter.h" | 42 #include "core/frame/UseCounter.h" |
43 #include "core/frame/csp/ContentSecurityPolicy.h" | 43 #include "core/frame/csp/ContentSecurityPolicy.h" |
44 #include "core/html/HTMLCollection.h" | 44 #include "core/html/HTMLCollection.h" |
45 #include "core/html/HTMLDialogElement.h" | 45 #include "core/html/HTMLDialogElement.h" |
46 #include "core/html/HTMLFormControlsCollection.h" | 46 #include "core/html/HTMLFormControlsCollection.h" |
47 #include "core/html/HTMLImageElement.h" | 47 #include "core/html/HTMLImageElement.h" |
48 #include "core/html/HTMLInputElement.h" | 48 #include "core/html/HTMLInputElement.h" |
49 #include "core/html/HTMLObjectElement.h" | 49 #include "core/html/HTMLObjectElement.h" |
50 #include "core/html/RadioNodeList.h" | 50 #include "core/html/RadioNodeList.h" |
51 #include "core/html/forms/FormController.h" | 51 #include "core/html/forms/FormController.h" |
| 52 #include "core/inspector/ConsoleMessage.h" |
52 #include "core/loader/FrameLoader.h" | 53 #include "core/loader/FrameLoader.h" |
53 #include "core/loader/FrameLoaderClient.h" | 54 #include "core/loader/FrameLoaderClient.h" |
54 #include "core/loader/MixedContentChecker.h" | 55 #include "core/loader/MixedContentChecker.h" |
55 #include "core/rendering/RenderTextControl.h" | 56 #include "core/rendering/RenderTextControl.h" |
56 #include "platform/UserGestureIndicator.h" | 57 #include "platform/UserGestureIndicator.h" |
57 #include "wtf/text/AtomicString.h" | 58 #include "wtf/text/AtomicString.h" |
58 #include <limits> | 59 #include <limits> |
59 | 60 |
60 namespace WebCore { | 61 namespace WebCore { |
61 | 62 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 } | 302 } |
302 // Warn about all of unfocusable controls. | 303 // Warn about all of unfocusable controls. |
303 if (document().frame()) { | 304 if (document().frame()) { |
304 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { | 305 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { |
305 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid
Controls[i].get(); | 306 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid
Controls[i].get(); |
306 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement); | 307 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement); |
307 if (unhandled->isFocusable() && unhandled->inDocument()) | 308 if (unhandled->isFocusable() && unhandled->inDocument()) |
308 continue; | 309 continue; |
309 String message("An invalid form control with name='%name' is not foc
usable."); | 310 String message("An invalid form control with name='%name' is not foc
usable."); |
310 message.replace("%name", unhandledAssociatedElement->name()); | 311 message.replace("%name", unhandledAssociatedElement->name()); |
311 document().addConsoleMessage(RenderingMessageSource, ErrorMessageLev
el, message); | 312 document().addConsoleMessage(ConsoleMessage::create(RenderingMessage
Source, ErrorMessageLevel, message)); |
312 } | 313 } |
313 } | 314 } |
314 return false; | 315 return false; |
315 } | 316 } |
316 | 317 |
317 void HTMLFormElement::prepareForSubmission(Event* event) | 318 void HTMLFormElement::prepareForSubmission(Event* event) |
318 { | 319 { |
319 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); | 320 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); |
320 LocalFrame* frame = document().frame(); | 321 LocalFrame* frame = document().frame(); |
321 if (!frame) | 322 if (!frame) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 394 |
394 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi
on> submission) | 395 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi
on> submission) |
395 { | 396 { |
396 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); | 397 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); |
397 ASSERT(submission->data()); | 398 ASSERT(submission->data()); |
398 ASSERT(submission->state()); | 399 ASSERT(submission->state()); |
399 if (submission->action().isEmpty()) | 400 if (submission->action().isEmpty()) |
400 return; | 401 return; |
401 if (document().isSandboxed(SandboxForms)) { | 402 if (document().isSandboxed(SandboxForms)) { |
402 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 403 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
403 document().addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "
Blocked form submission to '" + submission->action().elidedString() + "' because
the form's frame is sandboxed and the 'allow-forms' permission is not set."); | 404 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.")); |
404 return; | 405 return; |
405 } | 406 } |
406 | 407 |
407 if (protocolIsJavaScript(submission->action())) { | 408 if (protocolIsJavaScript(submission->action())) { |
408 if (!document().contentSecurityPolicy()->allowFormAction(submission->act
ion())) | 409 if (!document().contentSecurityPolicy()->allowFormAction(submission->act
ion())) |
409 return; | 410 return; |
410 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac
tion()); | 411 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac
tion()); |
411 return; | 412 return; |
412 } | 413 } |
413 | 414 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 String errorMessage; | 464 String errorMessage; |
464 | 465 |
465 if (!document().frame()) | 466 if (!document().frame()) |
466 errorMessage = "requestAutocomplete: form is not owned by a displayed do
cument."; | 467 errorMessage = "requestAutocomplete: form is not owned by a displayed do
cument."; |
467 else if (!shouldAutocomplete()) | 468 else if (!shouldAutocomplete()) |
468 errorMessage = "requestAutocomplete: form autocomplete attribute is set
to off."; | 469 errorMessage = "requestAutocomplete: form autocomplete attribute is set
to off."; |
469 else if (!UserGestureIndicator::processingUserGesture()) | 470 else if (!UserGestureIndicator::processingUserGesture()) |
470 errorMessage = "requestAutocomplete: must be called in response to a use
r gesture."; | 471 errorMessage = "requestAutocomplete: must be called in response to a use
r gesture."; |
471 | 472 |
472 if (!errorMessage.isEmpty()) { | 473 if (!errorMessage.isEmpty()) { |
473 document().addConsoleMessage(RenderingMessageSource, LogMessageLevel, er
rorMessage); | 474 document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSour
ce, LogMessageLevel, errorMessage)); |
474 finishRequestAutocomplete(AutocompleteResultErrorDisabled); | 475 finishRequestAutocomplete(AutocompleteResultErrorDisabled); |
475 } else { | 476 } else { |
476 document().frame()->loader().client()->didRequestAutocomplete(this); | 477 document().frame()->loader().client()->didRequestAutocomplete(this); |
477 } | 478 } |
478 } | 479 } |
479 | 480 |
480 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) | 481 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) |
481 { | 482 { |
482 RefPtrWillBeRawPtr<Event> event = nullptr; | 483 RefPtrWillBeRawPtr<Event> event = nullptr; |
483 if (result == AutocompleteResultSuccess) | 484 if (result == AutocompleteResultSuccess) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 } | 827 } |
827 | 828 |
828 void HTMLFormElement::setDemoted(bool demoted) | 829 void HTMLFormElement::setDemoted(bool demoted) |
829 { | 830 { |
830 if (demoted) | 831 if (demoted) |
831 UseCounter::count(document(), UseCounter::DemotedFormElement); | 832 UseCounter::count(document(), UseCounter::DemotedFormElement); |
832 m_wasDemoted = demoted; | 833 m_wasDemoted = demoted; |
833 } | 834 } |
834 | 835 |
835 } // namespace | 836 } // namespace |
OLD | NEW |