broulik created this revision.
broulik added reviewers: Plasma, davidedmundson, fvogt, lbeltrame.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
broulik requested review of this revision.

REVISION SUMMARY
  Don't wait for `DOMContentLoaded` as `document.documentElement` is always 
there (at least as far as HTML is concerned) and a website might dynamically 
create objects before that

TEST PLAN
  We intercept `document.createElement` so that when a website dynamically 
creates `audio` (or `video`) tags, we know about this. However, the JS 
environment the website sees is different from the one the content script sees, 
so we cannot just pass the element around as variable. Instead, we add it to 
the DOM which is then picked up by the mutation observer. We remove the element 
immediately afterwards as to not confuse the website.
  When the website now dynamically creates an `audio` element before 
`DOMContentLoaded`, our mutation observer isn't installed yet and we miss this 
event.
  Tested the https://googlechrome.github.io/samples/media-session/audio.html 
which works fine now
  
  I didn't notice any slowdown caused by this but @lbeltrame please test with 
that heavy website you always use to verify it doesn't cause any problems for 
you :)

REPOSITORY
  R856 Plasma Browser Integration

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

AFFECTED FILES
  extension/content-script.js

To: broulik, #plasma, davidedmundson, fvogt, lbeltrame
Cc: lbeltrame, plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, mart

Reply via email to