| Index: third_party/WebKit/Source/core/events/Event.cpp
|
| diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp
|
| index a66885174e79b74898ae99c6dca6cd1cc3c70724..3f4f9738ab5a41f8a1bf82f77ac5280491cbcf3d 100644
|
| --- a/third_party/WebKit/Source/core/events/Event.cpp
|
| +++ b/third_party/WebKit/Source/core/events/Event.cpp
|
| @@ -80,8 +80,8 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr
|
| , m_cancelBubble(false)
|
| , m_wasInitialized(true)
|
| , m_isTrusted(false)
|
| - , m_handlingPassive(false)
|
| , m_preventDefaultCalledOnUncancelableEvent(false)
|
| + , m_handlingPassive(PassiveMode::NotPassive)
|
| , m_eventPhase(0)
|
| , m_currentTarget(nullptr)
|
| , m_platformTimeStamp(platformTimeStamp)
|
| @@ -225,11 +225,26 @@ bool Event::isBeforeUnloadEvent() const
|
|
|
| void Event::preventDefault()
|
| {
|
| - if (m_handlingPassive) {
|
| + if (m_handlingPassive != PassiveMode::NotPassive) {
|
| m_preventDefaultCalledDuringPassive = true;
|
| +
|
| const LocalDOMWindow* window = m_eventPath ? m_eventPath->windowEventContext().window() : 0;
|
| - if (window)
|
| - window->printErrorMessage("Unable to preventDefault inside passive event listener invocation.");
|
| + if (window) {
|
| + const char* devToolsMsg = nullptr;
|
| + switch (m_handlingPassive) {
|
| + case PassiveMode::NotPassive:
|
| + NOTREACHED();
|
| + break;
|
| + case PassiveMode::Passive:
|
| + devToolsMsg = "Unable to preventDefault inside passive event listener invocation.";
|
| + break;
|
| + case PassiveMode::PassiveForcedDocumentLevel:
|
| + devToolsMsg = "Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080";
|
| + break;
|
| + }
|
| + if (devToolsMsg)
|
| + window->printErrorMessage(devToolsMsg);
|
| + }
|
| return;
|
| }
|
|
|
| @@ -281,9 +296,9 @@ HeapVector<Member<EventTarget>> Event::composedPath(ScriptState* scriptState) co
|
| return pathInternal(scriptState, EmptyAfterDispatch);
|
| }
|
|
|
| -void Event::setHandlingPassive(bool value)
|
| +void Event::setHandlingPassive(PassiveMode mode)
|
| {
|
| - m_handlingPassive = value;
|
| + m_handlingPassive = mode;
|
| m_preventDefaultCalledDuringPassive = false;
|
| }
|
|
|
|
|