Commit cc863fb6 authored by Paul Meyer's avatar Paul Meyer Committed by Commit Bot

Change intervention console messages from warnings to errors.

Since interventions actually block or change browser behavior, their
messages should be reported as errors rather than just warnings.

Bug: 564071
Change-Id: Id8f1110466f127903bd362c4c7ada454aa3df0d6
Reviewed-on: https://chromium-review.googlesource.com/985028Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Commit-Queue: Paul Meyer <paulmeyer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547896}
parent d83f8c5a
CONSOLE WARNING: line 13: Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
CONSOLE ERROR: line 13: Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
This is a testharness.js-based test.
PASS Forced passive event listener
PASS Forced passive event listener with touch-action
......
......@@ -2,9 +2,9 @@ CONSOLE MESSAGE: line 32: Sending cancelable touchmove
CONSOLE MESSAGE: line 21: Calling preventDefault on TouchEvent with cancelable=true
CONSOLE MESSAGE: line 39: Sending uncancelable touchmove
CONSOLE MESSAGE: line 21: Calling preventDefault on TouchEvent with cancelable=false
CONSOLE WARNING: line 22: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
CONSOLE ERROR: line 22: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
CONSOLE MESSAGE: line 64: Sending uncancelable touchmove
CONSOLE WARNING: line 57: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
CONSOLE ERROR: line 57: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
This is a testharness.js-based test.
PASS Test that touch events may or may not be marked cancelable. http://crbug.com/365681
PASS Test that warning occurs in default mode
......
......@@ -261,9 +261,9 @@ void TouchEvent::preventDefault() {
UIEventWithKeyState::preventDefault();
// A common developer error is to wait too long before attempting to stop
// scrolling by consuming a touchmove event. Generate a warning if this
// scrolling by consuming a touchmove event. Generate an error if this
// event is uncancelable.
String warning_message;
String message;
switch (HandlingPassive()) {
case PassiveMode::kNotPassive:
case PassiveMode::kNotPassiveDefault:
......@@ -285,17 +285,17 @@ void TouchEvent::preventDefault() {
WebFeature::
kUncancelableTouchEventDueToMainThreadResponsivenessPreventDefaulted);
}
warning_message =
message =
"Ignored attempt to cancel a " + type() +
" event with cancelable=false. This event was forced to be "
"non-cancellable because the page was too busy to handle the "
"event promptly.";
} else {
// Non blocking for any other reason.
warning_message = "Ignored attempt to cancel a " + type() +
" event with cancelable=false, for example "
"because scrolling is in progress and "
"cannot be interrupted.";
message = "Ignored attempt to cancel a " + type() +
" event with cancelable=false, for example "
"because scrolling is in progress and "
"cannot be interrupted.";
}
}
break;
......@@ -304,7 +304,7 @@ void TouchEvent::preventDefault() {
// an author may use touch action but call preventDefault for interop with
// browsers that don't support touch-action.
if (current_touch_action_ == TouchAction::kTouchActionAuto) {
warning_message =
message =
"Unable to preventDefault inside passive event listener due to "
"target being treated as passive. See "
"https://www.chromestatus.com/features/5093566007214080";
......@@ -314,10 +314,9 @@ void TouchEvent::preventDefault() {
break;
}
if (!warning_message.IsEmpty() && view() && view()->IsLocalDOMWindow() &&
if (!message.IsEmpty() && view() && view()->IsLocalDOMWindow() &&
view()->GetFrame()) {
Intervention::GenerateReport(ToLocalDOMWindow(view())->GetFrame(),
warning_message);
Intervention::GenerateReport(ToLocalDOMWindow(view())->GetFrame(), message);
}
if ((type() == EventTypeNames::touchstart ||
......
......@@ -25,7 +25,7 @@ void Intervention::GenerateReport(const LocalFrame* frame,
// Send the message to the console.
frame->Console().AddMessage(ConsoleMessage::Create(
kInterventionMessageSource, kWarningMessageLevel, message));
kInterventionMessageSource, kErrorMessageLevel, message));
if (!frame->Client())
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment