aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlmediaelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmlmediaelement.rs')
-rw-r--r--components/script/dom/htmlmediaelement.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index 51170564be2..252755cb64e 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+use crate::compartments::{AlreadyInCompartment, InCompartment};
use crate::document_loader::{LoadBlocker, LoadType};
use crate::dom::attr::Attr;
use crate::dom::audiotrack::AudioTrack;
@@ -1683,9 +1684,12 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
}
// https://html.spec.whatwg.org/multipage/#dom-media-play
- #[allow(unsafe_code)]
fn Play(&self) -> Rc<Promise> {
- let promise = unsafe { Promise::new_in_current_compartment(&self.global()) };
+ let in_compartment_proof = AlreadyInCompartment::assert(&self.global());
+ let promise = Promise::new_in_current_compartment(
+ &self.global(),
+ &InCompartment::Already(&in_compartment_proof),
+ );
// Step 1.
// FIXME(nox): Reject promise if not allowed to play.