Bug 1311252 - Make MediaKeyMessageEvent.webidl patch spec. r=smaug
Update our copy of EncryptedMediaExtensions.idl to match upstream
Web Platform Tests, so we keep passing.
MozReview-Commit-ID: IHaVX45GrYx
--- a/dom/media/eme/MediaKeyMessageEvent.cpp
+++ b/dom/media/eme/MediaKeyMessageEvent.cpp
@@ -80,25 +80,20 @@ MediaKeyMessageEvent::Constructor(const
const nsAString& aType,
const MediaKeyMessageEventInit& aEventInitDict,
ErrorResult& aRv)
{
nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<MediaKeyMessageEvent> e = new MediaKeyMessageEvent(owner);
bool trusted = e->Init(owner);
e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
- const uint8_t* data = nullptr;
- size_t length = 0;
- if (aEventInitDict.mMessage.WasPassed()) {
- const auto& a = aEventInitDict.mMessage.Value();
- a.ComputeLengthAndData();
- data = a.Data();
- length = a.Length();
- }
- e->mMessage = ArrayBuffer::Create(aGlobal.Context(), length, data);
+ aEventInitDict.mMessage.ComputeLengthAndData();
+ e->mMessage = ArrayBuffer::Create(aGlobal.Context(),
+ aEventInitDict.mMessage.Length(),
+ aEventInitDict.mMessage.Data());
if (!e->mMessage) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
e->mMessageType = aEventInitDict.mMessageType;
e->SetTrusted(trusted);
e->SetComposed(aEventInitDict.mComposed);
return e.forget();
--- a/dom/webidl/MediaKeyMessageEvent.webidl
+++ b/dom/webidl/MediaKeyMessageEvent.webidl
@@ -12,19 +12,19 @@
enum MediaKeyMessageType {
"license-request",
"license-renewal",
"license-release",
"individualization-request"
};
-[Pref="media.eme.apiVisible", Constructor(DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
+[Pref="media.eme.apiVisible", Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType;
[Throws]
readonly attribute ArrayBuffer message;
};
dictionary MediaKeyMessageEventInit : EventInit {
- MediaKeyMessageType messageType = "license-request";
- ArrayBuffer message;
+ required MediaKeyMessageType messageType;
+ required ArrayBuffer message;
};
--- a/testing/web-platform/tests/encrypted-media/EncryptedMediaExtensions.idl
+++ b/testing/web-platform/tests/encrypted-media/EncryptedMediaExtensions.idl
@@ -1,14 +1,15 @@
// Encrypted Media Extensions WebIDL
//
// NOTE: Please update the link below to the specification version from
// which this IDL was extracted.
//
// https://www.w3.org/TR/2016/WD-encrypted-media-20160610/
+// + commit 5499821932391ae2c2e53756ae7ab9fae89d5863
//
partial interface Navigator {
Promise<MediaKeySystemAccess> requestMediaKeySystemAccess (DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfigurations);
};
enum MediaKeysRequirement {
"required",
@@ -81,36 +82,36 @@ enum MediaKeyStatus {
enum MediaKeyMessageType {
"license-request",
"license-renewal",
"license-release",
"individualization-request"
};
-[ Constructor (DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
+[Constructor(DOMString type, MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType;
readonly attribute ArrayBuffer message;
};
dictionary MediaKeyMessageEventInit : EventInit {
- MediaKeyMessageType messageType = "license-request";
- ArrayBuffer message;
+ required MediaKeyMessageType messageType;
+ required ArrayBuffer message;
};
// partial interface HTMLMediaElement : EventTarget {
partial interface HTMLMediaElement {
readonly attribute MediaKeys? mediaKeys;
attribute EventHandler onencrypted;
attribute EventHandler onwaitingforkey;
Promise<void> setMediaKeys (MediaKeys? mediaKeys);
};
-[ Constructor (DOMString type, optional MediaEncryptedEventInit eventInitDict)]
+[Constructor(DOMString type, optional MediaEncryptedEventInit eventInitDict)]
interface MediaEncryptedEvent : Event {
readonly attribute DOMString initDataType;
readonly attribute ArrayBuffer? initData;
};
dictionary MediaEncryptedEventInit : EventInit {
DOMString initDataType = "";
ArrayBuffer? initData = null;