Don't exit fullscreen when focusing window on different display

RESOLVED FIXED in Firefox 22

Status

()

Firefox
General
RESOLVED FIXED
5 years ago
2 months ago

People

(Reporter: Jared Stafford, Assigned: cpearce)

Tracking

Trunk
Firefox 22
x86
All
Points:
---
Dependency tree / graph
Bug Flags:
sec-review +

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0) Gecko/20100101 Firefox/10.0
Build ID: 20120129021758

Steps to reproduce:

Opt-in to Youtube HTML5 trial: www.youtube.com/html5
Enter normal fullscreen mode by pressing F11
Select full-screen mode on any HTML5 video
Select a window on a different monitor


Actual results:

Firefox exits fullscreen mode


Expected results:

Firefox should stay in fullscreen mode if the user has selected it manually

Comment 1

5 years ago
"Firefox should stay in fullscreen mode if the user has selected it manually" <- Firefox should stay in fullscreen because I made the video fullscreen. This also applies without step 2 "Enter normal fullscreen mode by pressing F11".

I can confirm this bug. Chrome/Chromium fullscreen Youtube HTML5 videos stay fullscreen. Firefox not. If this bug here is fixed, the most annoying time since Flash is over!

Comment 2

5 years ago
Firefox 13 has a new option "full-screen-api.exit-on-deactivate", introduced in response to [1]. It is worth a try if setting this option to "false" gives you the desired behavior.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=729307

Comment 3

5 years ago
(In reply to Philipp Hartwig from comment #2)
> Firefox 13 has a new option "full-screen-api.exit-on-deactivate", introduced
> in response to [1]. It is worth a try if setting this option to "false"
> gives you the desired behavior.
> 
> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=729307

Please set this option to false as the default! The use case here is very simple:
I want to watch a youtube video, I want to watch it full-screen. I have to monitors, so I want to work on the other monitor. Why in the world should the video become small again if I click into the other monitor?

Updated

5 years ago
Duplicate of this bug: 746522

Comment 5

5 years ago
Please, consider setting full-screen-api.exit-on-deactivate to false by default.

I made a video full screen because I wanted to watch that video in full screen so why close it automatically when i switch to an application on another window?

Comment 6

5 years ago
It's worth noting that in response to demand from users, later version of Flash eventually stopped automatically exiting fullscreen.  

They determined that users want the ability to be able to keep video fullscreen when using other apps.  Hopefully Mozilla will reach the same conclusion.  The full-screen-api.exit-on-deactivate options should be false by default.

Comment 7

5 years ago
I'm seeing the same issue in FF13.0.1 on Win7. It is really annoying not to be able to keep an HTML5 video in full screen mode on secondary monitor while doing something on primary monitor. I've added a link to a Mozilla air HTML5 video so others can more easily test this.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Version: 10 Branch → Trunk
Duplicate of this bug: 756512
Similar to the suggestion in bug 756512 comment 4, if the concern is re spoofing the desktop when focus is returned to the fullscreen window, a similar message to that displayed when entering fullscreen could be displayed when focus returns.
Blocks: 578265
Component: Untriaged → General
(Assignee)

Comment 10

5 years ago
(In reply to Karl Tomlinson (:karlt) from comment #9)
> Similar to the suggestion in bug 756512 comment 4, if the concern is re
> spoofing the desktop when focus is returned to the fullscreen window, a
> similar message to that displayed when entering fullscreen could be
> displayed when focus returns.

I think this is a good compromise, and guards against the desktop spoofing case.

Simply showing the warning again in an "activate" event handler in browser-fullScreen.js should suffice to implement this.

I think you'd implement this in browser-fullScreen.js by not nulling this.fullScreenDoc in cancelWarning() (null it in cleanup() instead), and call showWarning(this.fullscreenDoc) in an "activate" handler. On Windows we receive an "deactivate"/"activate" pair of events when entering or exiting fullscreen, so we'd need to make sure this change doesn't cause the warning to misbehave when entering or exiting fullscreen on Windows.
(Assignee)

Updated

5 years ago
Assignee: nobody → cpearce
(Assignee)

Updated

5 years ago
Summary: Fullscreen exits when focusing window on different display → Don't exit fullscreen when focusing window on different display
(Assignee)

Updated

5 years ago
Depends on: 805613
(Assignee)

Comment 11

5 years ago
I posted to mozilla.dev.security to request feedback from the security guys about changing to not exit fullscreen on blur, and show a warning on re-focus of fullscreen windows:

http://groups.google.com/group/mozilla.dev.security/browse_thread/thread/bcb45e15657af746#

No feedback yet, so I'll forge ahead and upload my patches.
(Assignee)

Comment 12

5 years ago
Created attachment 678911 [details] [diff] [review]
Patch 1 v1: Don't exit fullscreen on window deactivate, just warn on refocus

* Change to not exit fullscreen on window deactivate, but show the "$domain.com warning is now fullscreen" warning upon window re-activate.
* Had to move around when we clear the reference we store to the document fullscreen which requests fullscreen, as we need to access the doc's origin when showing the warning on re-activate.
* Allow interaction with fullscreen pages showing the warning, but not when showing the fullscreen approval UI. Main use case for this is so that upon re-activate users can immediately mute/pause a playing fullscreen video.
Attachment #678911 - Flags: review?(dao)
(Assignee)

Comment 13

5 years ago
Created attachment 678916 [details] [diff] [review]
Patch 2 v1: Move the IsInActiveTab check in a fullscreen request into nsGenericElement::mozRequestFullScreen()

Move the IsInActiveTab() check in a fullscreen request from the runnable which performs the request into the synchronous part of nsGenericElement::mozRequestFullScreen().

This is so that if focus changes between a fullscreen request being made and it being processed, we won't exit fullscreen. We will however show the "$domain.com has entered fullscreen" warning message when the blurred fullscreen window is refocused.
Attachment #678916 - Flags: review?(bugs)
(In reply to Chris Pearce (:cpearce) from comment #13)
> This is so that if focus changes between a fullscreen request being made and
> it being processed, we won't exit fullscreen. We will however show the
> "$domain.com has entered fullscreen" warning message when the blurred
> fullscreen window is refocused.

This is odd. I would expect us to not enter to fullscreen if focus changed between the request
being made and processing it. Why does the blurred fullscreen window get refocused?
Comment on attachment 678911 [details] [diff] [review]
Patch 1 v1: Don't exit fullscreen on window deactivate, just warn on refocus

>     // Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).

obsolete comment

>     if (!this.useLionFullScreen &&
>+        gPrefService.getBoolPref("full-screen-api.warn-on-reactivate")) {
>+      window.addEventListener("activate", this);

Why would we want a pref for this?
Or are you talking about the case when one window is already fullscreen and there is a new request?
Comment on attachment 678916 [details] [diff] [review]
Patch 2 v1: Move the IsInActiveTab check in a fullscreen request into nsGenericElement::mozRequestFullScreen()

But anyhow, background windows or tabs shouldn't be able to become fullscreen.
Attachment #678916 - Flags: review?(bugs) → review-
(Assignee)

Comment 18

5 years ago
(In reply to Olli Pettay [:smaug] from comment #14)
> (In reply to Chris Pearce (:cpearce) from comment #13)
> > This is so that if focus changes between a fullscreen request being made and
> > it being processed, we won't exit fullscreen. We will however show the
> > "$domain.com has entered fullscreen" warning message when the blurred
> > fullscreen window is refocused.
> 
> This is odd. I would expect us to not enter to fullscreen if focus changed
> between the request
> being made and processing it.

This is specifically to resolve bug 805125. It would probably have been clearer if I attached my patch there sorry...

This is so that script can request fullscreen and open a new window in the same user generated event handler. Because fullscreen requests are processed asynchronously, the window opening will race with the fullscreen request, and if the window opens and gains focus before the async fullscreen request is processed, the fullscreen request will be denied. Otherwise it takes multiple clicks to reliably go fullscreen and open windows to load other content.

The use case is for immersive experiences, like The Wilderness Downtown, which want go fullscreen and open windows to display on other monitors to increase the immersiveness of their experiences.

If we don't do this, what else can we do to make requesting fullscreen and opening new window in the same event handler more reliable?


> Why does the blurred fullscreen window get refocused?

I'm not sure what you're getting at here. This is so that if the user clicks to refocus the blurred window, they are made aware they've focused a fullscreen browser window, and not their desktop, i.e. it's a defense against a page which masquerades as the user's desktop.




(In reply to Olli Pettay [:smaug] from comment #17)
> Comment on attachment 678916 [details] [diff] [review]
> Patch 2 v1: Move the IsInActiveTab check in a fullscreen request into
> nsGenericElement::mozRequestFullScreen()
> 
> But anyhow, background windows or tabs shouldn't be able to become
> fullscreen.

The window still needs to be focused and visible when the request is made.

I guess you're concerned about attacks such as a button handler requesting fullscreen and opening a new window, with the new window masquerading as the current window and the background fullscreen window masquerading as the user's desktop? Do you not think that showing the warning on re-focus is enough in that case?
(In reply to Chris Pearce (:cpearce) from comment #18)
> This is so that script can request fullscreen and open a new window in the
> same user generated event handler. Because fullscreen requests are processed
> asynchronously, the window opening will race with the fullscreen request,
> and if the window opens and gains focus before the async fullscreen request
> is processed, the fullscreen request will be denied. Otherwise it takes
> multiple clicks to reliably go fullscreen and open windows to load other
> content.
> 
> The use case is for immersive experiences, like The Wilderness Downtown,
> which want go fullscreen and open windows to display on other monitors to
> increase the immersiveness of their experiences.
> 
> If we don't do this, what else can we do to make requesting fullscreen and
> opening new window in the same event handler more reliable?
> 
Why should we allow that?
Open a new window, focus the old window and ask the old window to become fullscreen.
What is wrong with that approach?
(Assignee)

Comment 20

5 years ago
Created attachment 679394 [details] [diff] [review]
Patch 1 v2: Don't exit fullscreen on window deactivate, just warn on refocus

Thanks Dão. I've updated the comment, and removed the pref.
Attachment #678911 - Attachment is obsolete: true
Attachment #678911 - Flags: review?(dao)
Attachment #679394 - Flags: review?(dao)
(Assignee)

Comment 21

5 years ago
(In reply to Olli Pettay [:smaug] from comment #19)
> (In reply to Chris Pearce (:cpearce) from comment #18)
> [...]
> > If we don't do this, what else can we do to make requesting fullscreen and
> > opening new window in the same event handler more reliable?
> > 
> Why should we allow that?
> Open a new window, focus the old window and ask the old window to become
> fullscreen.
> What is wrong with that approach?

Miklos: Any comment here?

Comment 22

5 years ago
(In reply to Chris Pearce (:cpearce) from comment #21)
> (In reply to Olli Pettay [:smaug] from comment #19)
> > (In reply to Chris Pearce (:cpearce) from comment #18)
> > [...]
> > > If we don't do this, what else can we do to make requesting fullscreen and
> > > opening new window in the same event handler more reliable?
> > > 
> > Why should we allow that?
> > Open a new window, focus the old window and ask the old window to become
> > fullscreen.
> > What is wrong with that approach?
> 
> Miklos: Any comment here?

The end result is the same, but that approach is simply more tedious because it requires more clicks. There's already precedent for performing multiple actions in one event handler, such as opening multiple windows, and this doesn't seem like it's fundamentally different.

Is there some specific reason to disallow this behavior? Showing the warning that the site has gone full screen makes it clear what's going on.

Updated

5 years ago
Attachment #679394 - Flags: review?(dao) → review+
I think this needs a security review.
(Assignee)

Updated

5 years ago
Attachment #678916 - Attachment is obsolete: true
(Assignee)

Comment 24

5 years ago
(In reply to Olli Pettay [:smaug] from comment #23)
> I think this needs a security review.

OK, we should clear this with the security guys. If the security guys hold a review, would you like to attend?

*Security review request details:*

Point of contact: Chris Pearce, cpearce@mozilla.com, :cpearce, I'm in New Zealand time zone.

*Feature/change under consideration*: Not exiting fullscreen on window blur, we currently do. This allows fullscreen video (or something else) on one monitor, while either working in another Firefox window, or another program/application on another monitor.

*Perceived threat:* The reason we exit fullscreen when a fullscreen browser window loses focus is to guard against a malicious page masquerading as the users desktop when it loses focus. This threat was proposed back in the first fullscreen security review:
https://wiki.mozilla.org/Security/Reviews/Firefox10/CodeEditor/FullScreenAPI

*Proposed mitigation:* To mitigate this threat I propose that we show the "$domain.com is now fullscreen" warning for 4 seconds when the fullscreen window which has lost focus is re-focused. This is the same warning that is temporarily shown (and for the same duration) when you enter fullscreen on a domain which has previously been approved for fullscreen with the option to remember the approval for that domain checked. This change is what the patch in this bug makes.

See my blog post at for an overview of the current UI to approve fullscreen:
http://blog.pearce.org.nz/2012/05/improved-key-input-in-fullscreen-mode.html

*Use cases supported by this change*: I want to make this change to support the following use cases:

1. Watching fullscreen video in fullscreen on one monitor while
   continuing to work on another (bug 724554).
2. Many function keys on Linux switch focus to a new window to show
   some volume UI before switching back to Firefox's fullscreen window. For
   example when you press the Volume Up/Down keys on Linux, most window
   managers momentarily switch focus to a volume meter pop up window,
   and this loss of focus causes Firefox to exit fullscreen (bug 578265
   and its duplicates).
3. Allowing multiple fullscreen windows on multiple monitors. Authors
   of immersive experiences (for example "The wilderness downtown" and
   ro.me demos) want fullscreen windows covering all monitors to
   increase the immersiveness of their experience.

I've had quite a number of people request this change, our behaviour of exiting fullscreen on blur is very unpopular.

*Affected platforms:* I'm only proposing to make this change on desktop Firefox builds. It doesn't make sense anywhere else.

*Time line:* I'd like to land this before the next uplift on Jan 8. It would be good if we can do the review before Dec 19.
Flags: sec-review?(curtisk)
changing to sec-review? so this will catch our triage queries for discussion
Flags: sec-review?(curtisk) → sec-review?
Flags: sec-review? → sec-review?(yboily)
Flags: needinfo?(yboily)
(Assignee)

Comment 26

4 years ago
Security review completed today in bug 822654. Got the go ahead to land.
Flags: sec-review?(yboily)
Flags: needinfo?(yboily)
(Assignee)

Comment 27

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/77cdf45932a7
https://hg.mozilla.org/mozilla-central/rev/77cdf45932a7
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
wiki for review https://wiki.mozilla.org/Security/Reviews/ExitFullScreenFocusChange
Flags: sec-review+

Updated

4 years ago
Depends on: 873404

Updated

3 years ago
Duplicate of this bug: 826708

Comment 31

3 years ago
This seems that is not fixed yet. Today, a user from reddit is facing the same problem (http://www.reddit.com/r/firefox/comments/2fr5di/titlebar_showing_up_in_fullscreen_video_when/). I have tried it also in Linux Ubuntu 14.04 (Unity, X.org), and this also happens with me.

and full-screen-api.exit-on-deactivate seems to not being available anymore.

Comment 32

3 years ago
I'm on a single monitor setup on Win8.1 and also facing this problem... just that I'm indeed only using one monitor and doing nothing but watching a movie in fullscreen. (so not even moving my mouse or pressing a key)
I actually get at least thrown out of fullscreen at least once if I'm watching for about 40m... and actually if I'm thrown out once, it will happen just a few seconds after re-enabling it and so on and on.

So for me fullscreen is almost unusable, at least I can't watch movies without getting distracted all the time.

So my fix was to use about:config and set "full-screen-api.exit-on-deactivate" to disabled.. seems to work.


Also if you're not fixing this (which from my experience with Firefox you won't do easily) please at least consider to add "full-screen-api.exit-on-deactivate" to about:config per default.. so someone might search for "full-screen" and is able to find this setting... currently it doesn't even exist at all and must be created manually. (so you need to know it exists and it's correct name)
You're hiding way to many settings already, that's not how about:config is supposed to work.

Comment 33

3 years ago
Has this been removed in Firefox 33.0 or is this not related to Adobe Flash's own fullscreen mode?

Comment 34

3 years ago
(In reply to René Schümann from comment #32)
> I'm on a single monitor setup on Win8.1 and also facing this problem... just
> that I'm indeed only using one monitor and doing nothing but watching a
> movie in fullscreen. (so not even moving my mouse or pressing a key)
> I actually get at least thrown out of fullscreen at least once if I'm
> watching for about 40m... and actually if I'm thrown out once, it will
> happen just a few seconds after re-enabling it and so on and on.
> 
> So for me fullscreen is almost unusable, at least I can't watch movies
> without getting distracted all the time.
> 
> So my fix was to use about:config and set
> "full-screen-api.exit-on-deactivate" to disabled.. seems to work.
> 
> 
> Also if you're not fixing this (which from my experience with Firefox you
> won't do easily) please at least consider to add
> "full-screen-api.exit-on-deactivate" to about:config per default.. so
> someone might search for "full-screen" and is able to find this setting...
> currently it doesn't even exist at all and must be created manually. (so you
> need to know it exists and it's correct name)
> You're hiding way to many settings already, that's not how about:config is
> supposed to work.

René, could you please explain how to create "full-screen-api.exit-on-deactivate" manually? I'm using Firefox 33.1.1 and cannot find it.

Comment 35

3 years ago
sry AB, my comment was quite wrong in most points :(
Guess "full-screen-api.exit-on-deactivate" is really removed and adding it won't change a thing.

In my case, the focus loss problem was related to tabs closing / reloading in the background.. every time that happened, it threw me out of full screen. (and I have addons that restarts tabs after 15m not used)
Took me a while to figure that one out...

So no, that feature is gone and my problem is a different one that I don't bother to post as I don't believe it will be fixed in time^^

Comment 36

2 years ago
This issues still exists when watching Youtube Videos (HTML5 / H264) on Ubuntu Gnome 14.10 and Firefox 37.0.1. When entering fullscreen then switching to another window on a different monitor, the fullscreen exits and video continues inside the website.

Is there any fix in sight?

Comment 37

2 years ago
(In reply to kb from comment #36)
> This issues still exists when watching Youtube Videos (HTML5 / H264)

Sorry, I was mistaken, it was actually the flash player. When completely disabling flash it runs perfectly in HTML5 mode on multiple monitors.

Comment 38

2 years ago
BTW: the Flash issue seems to be covered by bug 1152295.
Depends on: 527298
Duplicate of this bug: 882584

Comment 40

2 years ago
Why was this option, "full-screen-api.exit-on-deactivate" removed?  So that Chrome can gain even more market share?

Comment 41

2 months ago
Is there any update on this? Google Chrome seems to have become really adamant about disabling flash. In the latest updates the about:plugins page was removed and it's no longer trivial to watch flash content on Chrome.

Which is why I switched back to FF. But this full-screen issue is bugging me.

Given that this ticket has been dormant for about a year, I wanted to bump it up and see if there's any new info on this.
You need to log in before you can comment on or make changes to this bug.