Commit 38831149 authored by Alphan Chen's avatar Alphan Chen
Browse files

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
parent 294c48bb
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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()
{
+4 −0
Original line number Diff line number Diff line
@@ -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();
+2 −0
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ interface Event {
  [Pure]
  readonly attribute boolean cancelable;
  [NeedsCallerType]
  attribute boolean returnValue;
  [NeedsCallerType]
  void preventDefault();
  [Pure, NeedsCallerType]
  readonly attribute boolean defaultPrevented;
+0 −4
Original line number Diff line number Diff line
[AddEventListenerOptions-passive.html]
  [returnValue should be ignored if-and-only-if the passive option is true]
    expected: FAIL
+0 −7
Original line number Diff line number Diff line
[Event-constructors.html]
  [Event constructors 2]
    expected: FAIL

  [Event constructors 3]
    expected: FAIL
Loading