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

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

Issue 419203004: DevTools: wrapping arguments addConsoleMessage in ConsoleMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@wrap-not-all-console-args
Patch Set: Created 6 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 303 }
303 // Warn about all of unfocusable controls. 304 // Warn about all of unfocusable controls.
304 if (document().frame()) { 305 if (document().frame()) {
305 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) { 306 for (unsigned i = 0; i < unhandledInvalidControls.size(); ++i) {
306 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid Controls[i].get(); 307 FormAssociatedElement* unhandledAssociatedElement = unhandledInvalid Controls[i].get();
307 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement); 308 HTMLElement* unhandled = toHTMLElement(unhandledAssociatedElement);
308 if (unhandled->isFocusable() && unhandled->inDocument()) 309 if (unhandled->isFocusable() && unhandled->inDocument())
309 continue; 310 continue;
310 String message("An invalid form control with name='%name' is not foc usable."); 311 String message("An invalid form control with name='%name' is not foc usable.");
311 message.replace("%name", unhandledAssociatedElement->name()); 312 message.replace("%name", unhandledAssociatedElement->name());
312 document().addConsoleMessage(RenderingMessageSource, ErrorMessageLev el, message); 313 document().addConsoleMessage(ConsoleMessage::create(RenderingMessage Source, ErrorMessageLevel, message));
313 } 314 }
314 } 315 }
315 return false; 316 return false;
316 } 317 }
317 318
318 void HTMLFormElement::prepareForSubmission(Event* event) 319 void HTMLFormElement::prepareForSubmission(Event* event)
319 { 320 {
320 RefPtrWillBeRawPtr<HTMLFormElement> protector(this); 321 RefPtrWillBeRawPtr<HTMLFormElement> protector(this);
321 LocalFrame* frame = document().frame(); 322 LocalFrame* frame = document().frame();
322 if (!frame) 323 if (!frame)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 395
395 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi on> submission) 396 void HTMLFormElement::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubmissi on> submission)
396 { 397 {
397 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met hod() == FormSubmission::GetMethod); 398 ASSERT(submission->method() == FormSubmission::PostMethod || submission->met hod() == FormSubmission::GetMethod);
398 ASSERT(submission->data()); 399 ASSERT(submission->data());
399 ASSERT(submission->state()); 400 ASSERT(submission->state());
400 if (submission->action().isEmpty()) 401 if (submission->action().isEmpty())
401 return; 402 return;
402 if (document().isSandboxed(SandboxForms)) { 403 if (document().isSandboxed(SandboxForms)) {
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. 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.
404 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."); 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."));
405 return; 406 return;
406 } 407 }
407 408
408 if (protocolIsJavaScript(submission->action())) { 409 if (protocolIsJavaScript(submission->action())) {
409 if (!document().contentSecurityPolicy()->allowFormAction(submission->act ion())) 410 if (!document().contentSecurityPolicy()->allowFormAction(submission->act ion()))
410 return; 411 return;
411 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion()); 412 document().frame()->script().executeScriptIfJavaScriptURL(submission->ac tion());
412 return; 413 return;
413 } 414 }
414 415
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 String errorMessage; 465 String errorMessage;
465 466
466 if (!document().frame()) 467 if (!document().frame())
467 errorMessage = "requestAutocomplete: form is not owned by a displayed do cument."; 468 errorMessage = "requestAutocomplete: form is not owned by a displayed do cument.";
468 else if (!shouldAutocomplete()) 469 else if (!shouldAutocomplete())
469 errorMessage = "requestAutocomplete: form autocomplete attribute is set to off."; 470 errorMessage = "requestAutocomplete: form autocomplete attribute is set to off.";
470 else if (!UserGestureIndicator::processingUserGesture()) 471 else if (!UserGestureIndicator::processingUserGesture())
471 errorMessage = "requestAutocomplete: must be called in response to a use r gesture."; 472 errorMessage = "requestAutocomplete: must be called in response to a use r gesture.";
472 473
473 if (!errorMessage.isEmpty()) { 474 if (!errorMessage.isEmpty()) {
474 document().addConsoleMessage(RenderingMessageSource, LogMessageLevel, er rorMessage); 475 document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSour ce, LogMessageLevel, errorMessage));
475 finishRequestAutocomplete(AutocompleteResultErrorDisabled); 476 finishRequestAutocomplete(AutocompleteResultErrorDisabled);
476 } else { 477 } else {
477 document().frame()->loader().client()->didRequestAutocomplete(this); 478 document().frame()->loader().client()->didRequestAutocomplete(this);
478 } 479 }
479 } 480 }
480 481
481 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result) 482 void HTMLFormElement::finishRequestAutocomplete(AutocompleteResult result)
482 { 483 {
483 RefPtrWillBeRawPtr<Event> event = nullptr; 484 RefPtrWillBeRawPtr<Event> event = nullptr;
484 if (result == AutocompleteResultSuccess) 485 if (result == AutocompleteResultSuccess)
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 828 }
828 829
829 void HTMLFormElement::setDemoted(bool demoted) 830 void HTMLFormElement::setDemoted(bool demoted)
830 { 831 {
831 if (demoted) 832 if (demoted)
832 UseCounter::count(document(), UseCounter::DemotedFormElement); 833 UseCounter::count(document(), UseCounter::DemotedFormElement);
833 m_wasDemoted = demoted; 834 m_wasDemoted = demoted;
834 } 835 }
835 836
836 } // namespace 837 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698