Bug 1452569 - Implement Event's returnValue. r=smaug

Add retrunValue into Event's interface

Differential Revision: https://phabricator.services.mozilla.com/D4084

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alphan Chen 2018-08-27 08:08:11 +00:00
Родитель 2e606ab5f6
Коммит 11a043ad55
9 изменённых файлов: 20 добавлений и 54 удалений

Просмотреть файл

@ -1003,6 +1003,20 @@ Event::DefaultPrevented(CallerType aCallerType) const
aCallerType == CallerType::System;
}
bool
Event::ReturnValue(CallerType aCallerType) const
{
return !DefaultPrevented(aCallerType);
}
void
Event::SetReturnValue(bool aReturnValue, CallerType aCallerType)
{
if (!aReturnValue) {
PreventDefaultInternal(aCallerType == CallerType::System);
}
}
double
Event::TimeStamp()
{

Просмотреть файл

@ -281,6 +281,10 @@ public:
return mEvent->mFlags.mMultipleActionsPrevented;
}
bool ReturnValue(CallerType aCallerType) const;
void SetReturnValue(bool aReturnValue, CallerType aCallerType);
bool IsTrusted() const
{
return mEvent->IsTrusted();

Просмотреть файл

@ -37,6 +37,8 @@ interface Event {
[Pure]
readonly attribute boolean cancelable;
[NeedsCallerType]
attribute boolean returnValue;
[NeedsCallerType]
void preventDefault();
[Pure, NeedsCallerType]
readonly attribute boolean defaultPrevented;

Просмотреть файл

@ -1,4 +0,0 @@
[AddEventListenerOptions-passive.html]
[returnValue should be ignored if-and-only-if the passive option is true]
expected: FAIL

Просмотреть файл

@ -1,7 +0,0 @@
[Event-constructors.html]
[Event constructors 2]
expected: FAIL
[Event constructors 3]
expected: FAIL

Просмотреть файл

@ -1,4 +0,0 @@
[Event-defaultPrevented-after-dispatch.html]
[Default prevention via returnValue]
expected: FAIL

Просмотреть файл

@ -1,13 +0,0 @@
[Event-initEvent.html]
[Properties of initEvent(type, true, true)]
expected: FAIL
[Properties of initEvent(type, true, false)]
expected: FAIL
[Properties of initEvent(type, false, true)]
expected: FAIL
[Properties of initEvent(type, false, false)]
expected: FAIL

Просмотреть файл

@ -1,19 +0,0 @@
[Event-returnValue.html]
[When an event is created, returnValue should be initialized to true.]
expected: FAIL
[preventDefault() should not change returnValue if cancelable is false.]
expected: FAIL
[returnValue=false should have no effect if cancelable is false.]
expected: FAIL
[preventDefault() should change returnValue if cancelable is true.]
expected: FAIL
[initEvent should unset returnValue.]
expected: FAIL
[returnValue=true should have no effect once the canceled flag was set.]
expected: FAIL

Просмотреть файл

@ -1,7 +0,0 @@
[EventTarget-dispatchEvent-returnvalue.html]
[Return value of EventTarget.dispatchEvent() affected by preventDefault().]
expected: FAIL
[Return value of EventTarget.dispatchEvent() affected by returnValue.]
expected: FAIL