mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 22:32:51 +00:00
Bug 1304247 - Implement HTMLMediaElement.onwaitingforkeys. r=smaug
MozReview-Commit-ID: DhNV30BfksS --HG-- extra : rebase_source : 5fab8f1b3333ff8607c0325907fbe7214234c001
This commit is contained in:
parent
3b07adfba8
commit
d42821ee80
@ -2099,6 +2099,7 @@ GK_ATOM(onenter, "onenter")
|
||||
GK_ATOM(onexit, "onexit")
|
||||
GK_ATOM(onencrypted, "onencrypted")
|
||||
GK_ATOM(encrypted, "encrypted")
|
||||
GK_ATOM(onwaitingforkey, "onwaitingforkey")
|
||||
GK_ATOM(onremovetrack, "onremovetrack")
|
||||
GK_ATOM(loadstart, "loadstart")
|
||||
GK_ATOM(suspend, "suspend")
|
||||
|
@ -6210,6 +6210,18 @@ HTMLMediaElement::SetOnencrypted(EventHandlerNonNull* handler)
|
||||
}
|
||||
}
|
||||
|
||||
EventHandlerNonNull*
|
||||
HTMLMediaElement::GetOnwaitingforkey()
|
||||
{
|
||||
return EventTarget::GetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString());
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::SetOnwaitingforkey(EventHandlerNonNull* aCallback)
|
||||
{
|
||||
EventTarget::SetEventHandler(nsGkAtoms::onwaitingforkey, EmptyString(), aCallback);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
|
||||
const nsAString& aInitDataType)
|
||||
|
@ -635,6 +635,9 @@ public:
|
||||
mozilla::dom::EventHandlerNonNull* GetOnencrypted();
|
||||
void SetOnencrypted(mozilla::dom::EventHandlerNonNull* listener);
|
||||
|
||||
mozilla::dom::EventHandlerNonNull* GetOnwaitingforkey();
|
||||
void SetOnwaitingforkey(mozilla::dom::EventHandlerNonNull* aCallback);
|
||||
|
||||
void DispatchEncrypted(const nsTArray<uint8_t>& aInitData,
|
||||
const nsAString& aInitDataType) override;
|
||||
|
||||
|
@ -58,6 +58,7 @@ function startTest(test, token)
|
||||
|
||||
var gotEncrypted = 0;
|
||||
var gotWaitingForKey = 0;
|
||||
var gotOnwaitingforkey = 0;
|
||||
|
||||
v.addEventListener("encrypted", function() {
|
||||
gotEncrypted += 1;
|
||||
@ -69,6 +70,10 @@ function startTest(test, token)
|
||||
TestIfDoneDelaying()
|
||||
});
|
||||
|
||||
v.onwaitingforkey = function() {
|
||||
gotOnwaitingforkey += 1;
|
||||
};
|
||||
|
||||
v.addEventListener("loadedmetadata", function() {
|
||||
ok(SpecialPowers.do_lookupGetter(v, "isEncrypted").apply(v),
|
||||
TimeStamp(token) + " isEncrypted should be true");
|
||||
@ -81,6 +86,7 @@ function startTest(test, token)
|
||||
// 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, "Should have as many event listener calls as event handler calls, got: " + gotOnwaitingforkey);
|
||||
|
||||
v.closeSessions().then(() => manager.finished(token));
|
||||
});
|
||||
|
@ -165,6 +165,9 @@ partial interface HTMLMediaElement {
|
||||
|
||||
[Pref="media.eme.apiVisible"]
|
||||
attribute EventHandler onencrypted;
|
||||
|
||||
[Pref="media.eme.apiVisible"]
|
||||
attribute EventHandler onwaitingforkey;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
[idlharness.html]
|
||||
type: testharness
|
||||
[HTMLMediaElement interface: attribute onwaitingforkey]
|
||||
expected: FAIL
|
||||
|
||||
[MediaKeySession interface: attribute onkeystatuseschange]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user