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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "core/frame/UseCounter.h" | 43 #include "core/frame/UseCounter.h" |
44 #include "core/frame/csp/ContentSecurityPolicy.h" | 44 #include "core/frame/csp/ContentSecurityPolicy.h" |
45 #include "core/html/HTMLCollection.h" | 45 #include "core/html/HTMLCollection.h" |
46 #include "core/html/HTMLDialogElement.h" | 46 #include "core/html/HTMLDialogElement.h" |
47 #include "core/html/HTMLFormControlsCollection.h" | 47 #include "core/html/HTMLFormControlsCollection.h" |
48 #include "core/html/HTMLImageElement.h" | 48 #include "core/html/HTMLImageElement.h" |
49 #include "core/html/HTMLInputElement.h" | 49 #include "core/html/HTMLInputElement.h" |
50 #include "core/html/HTMLObjectElement.h" | 50 #include "core/html/HTMLObjectElement.h" |
51 #include "core/html/RadioNodeList.h" | 51 #include "core/html/RadioNodeList.h" |
52 #include "core/html/forms/FormController.h" | 52 #include "core/html/forms/FormController.h" |
| 53 #include "core/inspector/ConsoleMessage.h" |
53 #include "core/loader/FrameLoader.h" | 54 #include "core/loader/FrameLoader.h" |
54 #include "core/loader/FrameLoaderClient.h" | 55 #include "core/loader/FrameLoaderClient.h" |
55 #include "core/loader/MixedContentChecker.h" | 56 #include "core/loader/MixedContentChecker.h" |
56 #include "core/rendering/RenderTextControl.h" | 57 #include "core/rendering/RenderTextControl.h" |
57 #include "platform/UserGestureIndicator.h" | 58 #include "platform/UserGestureIndicator.h" |
58 #include "wtf/text/AtomicString.h" | 59 #include "wtf/text/AtomicString.h" |
59 #include <limits> | 60 #include <limits> |
60 | 61 |
61 namespace blink { | 62 namespace blink { |
62 | 63 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 305 } |
305 // Warn about all of unfocusable controls. | 306 // Warn about all of unfocusable controls. |
306 if (document().frame()) { | 307 if (document().frame()) { |
307 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { | 308 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { |
308 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid
Controls[i].get(); | 309 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid
Controls[i].get(); |
309 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement); | 310 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement); |
310 if (unhandled->isFocusable() && unhandled->inDocument()) | 311 if (unhandled->isFocusable() && unhandled->inDocument()) |
311 continue; | 312 continue; |
312 String message("An invalid form control with name='%name' is not foc
usable."); | 313 String message("An invalid form control with name='%name' is not foc
usable."); |
313 message.replace("%name", unhandledAssociatedElement->name()); | 314 message.replace("%name", unhandledAssociatedElement->name()); |
314 document().addConsoleMessage(RenderingMessageSource, ErrorMessageLev
el, message); | 315 document().addConsoleMessage(ConsoleMessage::create(RenderingMessage
Source, ErrorMessageLevel, message)); |
315 } | 316 } |
316 } | 317 } |
317 return false; | 318 return false; |
318 } | 319 } |
319 | 320 |
320 void HTMLFormElement::prepareForSubmission(Event* event) | 321 void HTMLFormElement::prepareForSubmission(Event* event) |
321 { | 322 { |
322 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); | 323 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); |
323 LocalFrame* frame = document().frame(); | 324 LocalFrame* frame = document().frame(); |
324 if (!frame || m_isSubmittingOrInUserJSSubmitEvent) | 325 if (!frame || m_isSubmittingOrInUserJSSubmitEvent) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 414 |
414 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi
on> submission) | 415 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi
on> submission) |
415 { | 416 { |
416 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); | 417 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met
hod() == FormSubmission::GetMethod); |
417 ASSERT(submission->data()); | 418 ASSERT(submission->data()); |
418 ASSERT(submission->state()); | 419 ASSERT(submission->state()); |
419 if (submission->action().isEmpty()) | 420 if (submission->action().isEmpty()) |
420 return; | 421 return; |
421 if (document().isSandboxed(SandboxForms)) { | 422 if (document().isSandboxed(SandboxForms)) { |
422 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 423 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
423 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."); | 424 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.")); |
424 return; | 425 return; |
425 } | 426 } |
426 | 427 |
427 if (protocolIsJavaScript(submission->action())) { | 428 if (protocolIsJavaScript(submission->action())) { |
428 if (!document().contentSecurityPolicy()->allowFormAction(submission->act
ion())) | 429 if (!document().contentSecurityPolicy()->allowFormAction(submission->act
ion())) |
429 return; | 430 return; |
430 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac
tion()); | 431 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac
tion()); |
431 return; | 432 return; |
432 } | 433 } |
433 | 434 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 String errorMessage; | 484 String errorMessage; |
484 | 485 |
485 if (!document().frame()) | 486 if (!document().frame()) |
486 errorMessage = "requestAutocomplete: form is not owned by a displayed do
cument."; | 487 errorMessage = "requestAutocomplete: form is not owned by a displayed do
cument."; |
487 else if (!shouldAutocomplete()) | 488 else if (!shouldAutocomplete()) |
488 errorMessage = "requestAutocomplete: form autocomplete attribute is set
to off."; | 489 errorMessage = "requestAutocomplete: form autocomplete attribute is set
to off."; |
489 else if (!UserGestureIndicator::processingUserGesture()) | 490 else if (!UserGestureIndicator::processingUserGesture()) |
490 errorMessage = "requestAutocomplete: must be called in response to a use
r gesture."; | 491 errorMessage = "requestAutocomplete: must be called in response to a use
r gesture."; |
491 | 492 |
492 if (!errorMessage.isEmpty()) { | 493 if (!errorMessage.isEmpty()) { |
493 document().addConsoleMessage(RenderingMessageSource, LogMessageLevel, er
rorMessage); | 494 document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSour
ce, LogMessageLevel, errorMessage)); |
494 finishRequestAutocomplete(AutocompleteResultErrorDisabled); | 495 finishRequestAutocomplete(AutocompleteResultErrorDisabled); |
495 } else { | 496 } else { |
496 document().frame()->loader().client()->didRequestAutocomplete(this); | 497 document().frame()->loader().client()->didRequestAutocomplete(this); |
497 } | 498 } |
498 } | 499 } |
499 | 500 |
500 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) | 501 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) |
501 { | 502 { |
502 RefPtrWillBeRawPtr<Event> event = nullptr; | 503 RefPtrWillBeRawPtr<Event> event = nullptr; |
503 if (result == AutocompleteResultSuccess) | 504 if (result == AutocompleteResultSuccess) |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 847 } |
847 | 848 |
848 void HTMLFormElement::setDemoted(bool demoted) | 849 void HTMLFormElement::setDemoted(bool demoted) |
849 { | 850 { |
850 if (demoted) | 851 if (demoted) |
851 UseCounter::count(document(), UseCounter::DemotedFormElement); | 852 UseCounter::count(document(), UseCounter::DemotedFormElement); |
852 m_wasDemoted = demoted; | 853 m_wasDemoted = demoted; |
853 } | 854 } |
854 | 855 |
855 } // namespace | 856 } // namespace |
OLD | NEW |