w3c / encrypted-media

Encrypted Media Extensions
https://w3c.github.io/encrypted-media/
Other
180 stars 80 forks source link

Clarify behaviour around discarded browsing contexts and unloaded windows #466

Closed SingingTree closed 1 year ago

SingingTree commented 4 years ago

What is the appropriate behaviour for requestMediaKeySystemAccess when called on a navigator that is associated with a discarded browsing context or with a window that has been unloaded?

For example, I believe the following will attempt to request access via a navigator associated with a discarded browsing context:

<iframe></iframe>
<script>
let clearKeyOptions = [
  {
    initDataTypes: ['keyids', 'webm'],
    audioCapabilities: [
      { contentType: 'audio/webm; codecs="opus"' }
    ]
  }];
try {
  let i = document.querySelector("iframe");
  let nav = i.contentWindow.navigator;
  i.remove();
  let mka = nav.requestMediaKeySystemAccess('org.w3.clearkey', clearKeyOptions);
  console.log(mka);
} catch (e) {
  console.log(e);
}
</script>

The Window unloaded case has come up in Gecko if we request access as a page is navigated away from.

It makes sense to me that these cases should fail, but would be useful to have that specified.

mounirlamouri commented 3 years ago

Discussed briefly during the Sep 8 2020 WG meeting. There is a question about how to express that in term of spec language.