Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c947306c authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Also catch new Audio() elements

Also catches audio players created using the proper new Audio() syntax rather than explicitly creating a DOM element using document.createElement('audio')

BUG: 398261

Differential Revision: https://phabricator.kde.org/D16435
parent 9a2462fa
......@@ -582,6 +582,21 @@ function loadMediaSessionsShim() {
}
`);
// We also briefly add items created as new Audio() to the DOM so we can control it
// similar to the document.createElement hack above
executeScript(`function() {
var oldAudio = window.Audio;
window.Audio = function () {
var createdAudio = new (Function.prototype.bind.apply(oldAudio, arguments));
(document.head || document.documentElement).appendChild(createdAudio);
createdAudio.parentNode.removeChild(createdAudio);
return createdAudio;
};
}
`);
// now the fun part of getting the stuff from our page back into our extension...
// cannot access extensions from innocent page JS for security
var transferItem = document.createElement("div");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment