Auto merge of #27530 - jdm:media, r=Manishearth

Fix crashes on video playback in UWP

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27529 and fix #27526
- [x] These changes do not require tests because there's no way to test UWP right now.
This commit is contained in:
bors-servo 2020-08-06 16:30:04 -04:00 committed by GitHub
commit 776b564db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 27 deletions

View file

@ -20,7 +20,7 @@ use crate::dom::bindings::str::DOMString;
use crate::dom::htmlmediaelement::HTMLMediaElement;
use crate::dom::mediametadata::MediaMetadata;
use crate::dom::window::Window;
use crate::realms::{AlreadyInRealm, InRealm};
use crate::realms::{enter_realm, InRealm};
use dom_struct::dom_struct;
use embedder_traits::MediaMetadata as EmbedderMediaMetadata;
use embedder_traits::MediaSessionEvent;
@ -80,8 +80,8 @@ impl MediaSession {
if let Some(media) = self.media_instance.get() {
match action {
MediaSessionActionType::Play => {
let in_realm_proof = AlreadyInRealm::assert(&self.global());
media.Play(InRealm::Already(&in_realm_proof));
let realm = enter_realm(self);
media.Play(InRealm::Entered(&realm));
},
MediaSessionActionType::Pause => {
media.Pause();