D13618: Only add Media Sessions Shim if we find a valid video object

Kai Uwe Broulik noreply at phabricator.kde.org
Tue Jun 19 19:52:39 UTC 2018


broulik added a comment.


  An idea how to avoid adding a DOM node altogether

INLINE COMMENTS

> content-script.js:419
> +                    var transferItem = document.getElementById('${mediaSessionsTransferDivId}');
> +                    transferItem.innerText = JSON.stringify({action: action, payload: payload});
> +

Does `element.dataset.mediaSessionTransfer` work?

> content-script.js:423
> +                    event.initEvent('payloadChanged', true, true);
> +                    transferItem.dispatchEvent(event);
> +                };

Would it work to `dispatchEvent` on `document.documentElement` or `document.head`?

> content-script.js:484
> +        // cannot access extensions from innocent page JS for security
> +        var transferItem = document.createElement("div");
> +        transferItem.setAttribute("id", mediaSessionsTransferDivId);

Can we use `document.documentElement` or `document.head` here

> content-script.js:491
> +        transferItem.addEventListener('payloadChanged', function() {
> +            var json = JSON.parse(this.innerText);
>  

And use the `dataset` from above here

REPOSITORY
  R856 Plasma Browser Integration

REVISION DETAIL
  https://phabricator.kde.org/D13618

To: davidedmundson
Cc: broulik, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180619/044b0e54/attachment-0001.html>


More information about the Plasma-devel mailing list