Closed Bug 1304247 Opened 5 years ago Closed 5 years ago

[EME] Implement HTMLMediaElement.onwaitingforkeys

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: cpearce, Assigned: cpearce)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

This Web Platform test is failing because we don't implement HTMLMediaElement.onwaitingforkeys:

https://w3c-test.org/encrypted-media/idlharness.html

Should be an easy fix.
Comment on attachment 8793132 [details]
Bug 1304247 - Implement HTMLMediaElement.onwaitingforkeys.

https://reviewboard.mozilla.org/r/79910/#review78770

::: dom/html/HTMLMediaElement.cpp:6244
(Diff revision 1)
> +  return elm ? elm->GetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString())
> +             : nullptr;
> +}
> +
> +void
> +HTMLMediaElement::SetOnwaitingforkey(EventHandlerNonNull* handler)

arguments should be in form aFoo, not foo

::: dom/html/HTMLMediaElement.cpp:6251
(Diff revision 1)
> +  EventListenerManager *elm = GetOrCreateListenerManager();
> +  if (elm) {
> +    elm->SetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString(), handler);
> +  }
> +}
> +

Also here Get/SetEventHandler

::: dom/media/test/test_eme_waitingforkey.html:89
(Diff revision 1)
>      ok(true, TimeStamp(token) + " got ended event");
>      // We expect only one waitingForKey as we delay until all sessions are ready.
>      // I.e. one waitingForKey should be fired, after which, we process all sessions,
>      // so it should not be possible to be blocked by a key after that point.
>      ok(gotWaitingForKey == 1,  "Expected number 1 wait, got: " + gotWaitingForKey);
> +    ok(gotOnwaitingforkey == gotWaitingForKey, "Expected as many onwaitingforkey as waitingforkey events, got: " + gotOnwaitingforkey);

nit, the same event, but listener vs. handler
Attachment #8793132 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] (TPAC) from comment #3)
> Comment on attachment 8793132 [details]
> Bug 1304247 - Implement HTMLMediaElement.onwaitingforkeys.
> 
> ::: dom/html/HTMLMediaElement.cpp:6251
> (Diff revision 1)
> > +  EventListenerManager *elm = GetOrCreateListenerManager();
> > +  if (elm) {
> > +    elm->SetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString(), handler);
> > +  }
> > +}
> > +
> 
> Also here Get/SetEventHandler


This worked fine for the MediaKeySession cases, but in the HTMLMediaElement.onwaitingforkeys case I had to explicitly prefix the {Get,Set}EventHandler calls with EventTarget::, as Element::SetEventHandler(nsIAtom* aEventName, const nsAString& aValue, bool aDefer) was being called by default, and that wasn't working.
https://hg.mozilla.org/mozilla-central/rev/4b1df6021158
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.