-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show MediaKeyMessageEvent.messageType #27
Comments
I'm not sure why that's not showing. I'll take a look. |
Where we hook in the formatter, we're using a spread operator to copy all the fields of the original to the formatted version: // You can't (and shouldn't, to avoid breaking the app) modify the event
// object here. So clone it, and replace the message field of that.
log.event = {
// The spread operator reads the fields and values (shallow clone) of the
// object named here.
...log.event,
// This overrides on of those fields with a new value.
message: formatEmeRequest(log.event.message),
}; It's not working, though. Only |
It appears that the difference is in "own" properties. The spread operator seems to only copy an object's "own" properties, and this object's only "own" property is orig
MediaKeyMessageEvent {isTrusted: true, messageType: 'license-request', message: ArrayBuffer(2), type: 'message', target: MediaKeySession, …}
{...orig}
{isTrusted: true}
Object.keys(orig)
['isTrusted']
JSON.stringify(orig)
'{"isTrusted":true}'
a = []; for (k in orig) { a.push(k); }; a;
(25) ['isTrusted', 'messageType', 'message', 'type', 'target', 'currentTarget', 'eventPhase', 'bubbles', 'cancelable', 'defaultPrevented', 'composed', 'timeStamp', 'srcElement', 'returnValue', 'cancelBubble', 'path', 'NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE', 'composedPath', 'initEvent', 'preventDefault', 'stopImmediatePropagation', 'stopPropagation']
for (k in orig) { if (orig.hasOwnProperty(k)) console.log(k); }
isTrusted |
Object.assign has the same drawback as the spread operator and Object.keys: Object.assign({}, orig)
{isTrusted: true} Thinking about "own" properties, though, it seems I can just filter out the properties inherited from Event: for (k in orig) { if (!Event.prototype.hasOwnProperty(k)) console.log(k); }
isTrusted
messageType
message I should be able to write a custom cloning method for Event objects to ensure the copy has everything it should. |
Currently
MediaKeyMessageEvent
is displayed asMediaKeySession message event
where only themessage
is shown. It'd be great to also see theMediaKeyMessageEvent.messageType
, e.g.license-request
orlicense-renewal
.See the screenshot below for the current behavior:
The text was updated successfully, but these errors were encountered: