aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 41a7192e70a..78b7a8606b0 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1304,6 +1304,10 @@ impl ScriptThread {
// An event came-in from a document that is not fully-active, it has been stored by the task-queue.
// Continue without adding it to "sequential".
},
+ FromConstellation(ConstellationControlMsg::ExitFullScreen(id)) => self
+ .profile_event(ScriptThreadEventCategory::ExitFullscreen, Some(id), || {
+ self.handle_exit_fullscreen(id);
+ }),
_ => {
sequential.push(event);
},
@@ -1500,6 +1504,7 @@ impl ScriptThread {
Reload(id, ..) => Some(id),
WebVREvents(id, ..) => Some(id),
PaintMetric(..) => None,
+ ExitFullScreen(id, ..) => Some(id),
}
},
MixedMessage::FromDevtools(_) => None,
@@ -1731,6 +1736,7 @@ impl ScriptThread {
msg @ ConstellationControlMsg::Viewport(..) |
msg @ ConstellationControlMsg::SetScrollState(..) |
msg @ ConstellationControlMsg::Resize(..) |
+ msg @ ConstellationControlMsg::ExitFullScreen(..) |
msg @ ConstellationControlMsg::ExitScriptThread => {
panic!("should have handled {:?} already", msg)
},
@@ -1953,6 +1959,19 @@ impl ScriptThread {
warn!("resize sent to nonexistent pipeline");
}
+ // exit_fullscreen creates a new JS promise object, so we need to have entered a compartment
+ fn handle_exit_fullscreen(&self, id: PipelineId) {
+ let document = self.documents.borrow().find_document(id);
+ if let Some(document) = document {
+ let _ac = JSAutoCompartment::new(
+ document.global().get_cx(),
+ document.reflector().get_jsobject().get(),
+ );
+ document.exit_fullscreen();
+ return;
+ }
+ }
+
fn handle_viewport(&self, id: PipelineId, rect: Rect<f32>) {
let document = self.documents.borrow().find_document(id);
if let Some(document) = document {