Status

defect
P5
normal
RESOLVED WONTFIX
2 years ago
7 months ago

People

(Reporter: kernp25, Unassigned, NeedInfo)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [design-decision-denied])

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20170808114032

Steps to reproduce:

Install this add-on:
https://addons.mozilla.org/firefox/addon/full-screen-for-firefox/

Return to this page and click the button.


Actual results:

The add-on will not work when setting the pref "full-screen-api.allow-trusted-requests-only" not to false (by the user) (default is true)

It says:
IMPORTANT SOLUTION for the FIREFOX BUG
//----------------------------------------------------------------------
1. Open your Firefox web browser
2. Type this in the address bar:
about:config
3. page search for the following key and set it to "false"
full-screen-api.allow-trusted-requests-only
4. Open now Google.com and click on the Full Screen button
//----------------------------------------------------------------------

I think the current behavior is really bad because, the user must go to about:config and flip the pref "full-screen-api.allow-trusted-requests-only" to make the webextension work.


Expected results:

I think, it makes more sense to add a new permission called "fullScreen".
This new permission allows webextensions to enter the full screen mode (e.g. The following code will work):
chrome.browserAction.onClicked.addListener(function(tab) {
  chrome.windows.getCurrent(null, function(window) {
    chrome.storage.local.get(['fullscreenweb','fullscreenwindow','fullscreenvideo'], function(items){
      if(items['fullscreenweb'] == true){chrome.tabs.executeScript(tab.id, {file: "js/fullscreen.js"});}
      else if(items['fullscreenwindow'] == true){chrome.windows.update(window.id, {state: "fullscreen"});}
      else if(items['fullscreenvideo'] == true){chrome.tabs.executeScript(tab.id, {file: "js/video.js"});}
      else{chrome.tabs.executeScript(tab.id, {file: "js/fullscreen.js"});}
    });
  });
});

The code in fullscreen.js:
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen();
}

The code in video.js:
if (document.documentElement.requestFullScreen) {
document.getElementsByTagName('video')[0].requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.getElementsByTagName('video')[0].mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.getElementsByTagName('video')[0].webkitRequestFullScreen();
}

It should work like with the clipboardRead/clipboardWrite permissions.
What do you think?
Flags: needinfo?(amckay)
Flags: needinfo?(amckay)
Priority: -- → P5
Whiteboard: [design-decision-needed]
Hi kernp25, this has been added to the agenda for the September 26 WebExtensions APIs triage meeting. Would you be able to join us? 

Wiki: https://wiki.mozilla.org/Add-ons/Contribute/Triage

Agenda: https://docs.google.com/document/d/1pw5y-GHwDLPV9bYK4HWCiZtslqFtAeL3G9bC4ZDbdjs/edit#
Flags: needinfo?(amckay)
Whiteboard: [design-decision-needed] → [design-decision-denied]
In Firefox 57 there is now a "Full screen" button built into Firefox, in the customise menu. As I understand it, the extension is now no longer needed. Based on that this request is likely no longer needed, certainly based on the use case on comment 0 it is. For that reason we are closing it, however if there's some other use case for having a full screen API, please let us know.
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(amckay)
Resolution: --- → WONTFIX
(In reply to Andy McKay [:andym] from comment #3)
> In Firefox 57 there is now a "Full screen" button built into Firefox, in the
> customise menu. As I understand it, the extension is now no longer needed.
> Based on that this request is likely no longer needed, certainly based on
> the use case on comment 0 it is. For that reason we are closing it, however
> if there's some other use case for having a full screen API, please let us
> know.

The add-on also has a auto-fullscreen feature!
If a video starts playing it will auto switch to fullscreen mode!
Please think about it again.
Flags: needinfo?(amckay)
Cool, I'm pretty sure that could done through a content script right?

I think you are talking about the permission moving from the web content where it says "site is now using the full screen" and remind you about how to exit it, over to the extension. So when you install the extension it says something like "Allow the browser to go full screen", as opposed to seeing it every time you go full screen.

The concerns there are that we probably still want to show the warning to exit full screen (as Chrome does) and the very real security concerns. Once a page takes over the full screen an awful lot of the security measures the URL bar and the browser chrome present in a browser are lost. You can then completely fake well, almost everything.

There's a web API for this and decent web API warnings, so I'm not sure what having a WebExtension API gains us.
Flags: needinfo?(amckay)
hi,

The 'fullscreen' mode in WebExtensions is indipensable, and I find it useful in the category of animation, gaming and entertainment.


I published a WebExtension "screen saver"
- Addons : https://addons.mozilla.org/fr/firefox/addon/screen-saver/
- Script : https://github.com/hellosct1/screensaver-webextensions


Currently, here's what I'm doing to launch the 'fullscreen' mode


document.addEventListener("keypress", function() {
  if (document.documentElement.requestFullScreen) {
    document.documentElement.requestFullScreen();
  } else if (document.documentElement.mozRequestFullScreen) {
    document.documentElement.mozRequestFullScreen();
  } else if (document.documentElement.webkitRequestFullScreen) {
    document.documentElement.webkitRequestFullScreen();
  }
});


This code is the /content_scripts/anim.js file


I watched the API addEventListener and the event (https://developer.mozilla.org/en-US/docs/Web/Events) but It's missing the trigger to run the Fullscreen

I hope that I have explained the problem I am experiencing.

thank's

Christophe
Flags: needinfo?(kernp25)
(In reply to Andy McKay [:andym] from comment #5)
> Cool, I'm pretty sure that could done through a content script right?
> 
> I think you are talking about the permission moving from the web content
> where it says "site is now using the full screen" and remind you about how
> to exit it, over to the extension. So when you install the extension it says
> something like "Allow the browser to go full screen", as opposed to seeing
> it every time you go full screen.
> 
> The concerns there are that we probably still want to show the warning to
> exit full screen (as Chrome does) and the very real security concerns. Once
> a page takes over the full screen an awful lot of the security measures the
> URL bar and the browser chrome present in a browser are lost. You can then
> completely fake well, almost everything.
> 
> There's a web API for this and decent web API warnings, so I'm not sure what
> having a WebExtension API gains us.

This is not what i meant with this permission! The goal was to allow a WebExtension to request full screen (that was the main idea of this bug).

Thinking about this again, i don't think a new permission called "fullScreen" makes sense here because, if the user changes the pref "full-screen-api.allow-trusted-requests-only" to false (default true) then a normal web page is also able to request full screen without any problems [1].

In Google Chrome, requesting full screen works for me without any problems (i run this code in console: document.body.webkitRequestFullScreen())

I think it would make more sense to allow WebExtensions to request full screen without this permission.
Then this check [1] also returns true if the caller is a WebExtension.

If i put "document.body.requestFullscreen()" inside a click event handler, then this works without any problems but it will not work for my use case (i need to listen for play event [2])

Should i create a new bug to allow WebExtensions to request full screen?

[1] https://dxr.mozilla.org/mozilla-central/source/dom/base/nsContentUtils.cpp#7342
[2] https://developer.mozilla.org/en-US/docs/Web/Events/play
Flags: needinfo?(kernp25) → needinfo?(amckay)
(In reply to Andy McKay [:andym] from comment #3)
> In Firefox 57 there is now a "Full screen" button built into Firefox, in the
> customise menu. As I understand it, the extension is now no longer needed.
> Based on that this request is likely no longer needed, certainly based on
> the use case on comment 0 it is. For that reason we are closing it, however
> if there's some other use case for having a full screen API, please let us
> know.

Wait, i didn't said we need a full screen API for this. The main idea of this bug was to allow a WebExtension to request full screen.
Bug 1411227 makes more sense to me, thanks for filing that.
Flags: needinfo?(amckay)
(In reply to Andy McKay [:andym] from comment #3)
> In Firefox 57 there is now a "Full screen" button built into Firefox, in the
> customise menu. As I understand it, the extension is now no longer needed.
> Based on that this request is likely no longer needed, certainly based on
> the use case on comment 0 it is. For that reason we are closing it, however
> if there's some other use case for having a full screen API, please let us
> know.

As :aswan recommended, I'm splitting Bug 1403295

At present a webextension can trigger full-screen from web content tabs, but not from restricted pages. To support the keyboard API, we would like to be able to trigger full screen from any page. Andrew says that this may be restricted to an event handler.
Flags: needinfo?(aswan)
Blocks: 1403295
No longer blocks: 1403295
This bug has been resolved, but I've marked 1411227 as a dependency of 1403295
Flags: needinfo?(aswan)
Duplicate of this bug: 1423561
Duplicate of this bug: 1411227
What is the fix for my Full Screen Firefox extension? Add a permission? What permission?
https://addons.mozilla.org/en-US/firefox/addon/full-screen-for-firefox/
In Google Chrome the code works just fine and no extra permission. (it is a user gesture when you click on the Full Screen button)!
I have found out that, if you move your full screen button into the webpage and adding a click event handler to it, it will work just fine. (the page opens in fullscreen)

Will this work for you?
Flags: needinfo?(stefan.vd01)
Create an extra button on the web page, that disturb the website design.
Flags: needinfo?(stefan.vd01)
Flags: needinfo?(hellosct1)
Flags: needinfo?(aswan)
Flags: needinfo?(amckay)
Flags: needinfo?(amckay)
Flags: needinfo?(aswan)
(In reply to Andy McKay from comment #3)
> In Firefox 57 there is now a "Full screen" button built into Firefox, in the
> customise menu.
(In reply to Luca Greco [:rpl] from bug 1411227, comment #9)
> We discussed about this during the API triage meeting and we agreed that
> exempting all the WebExtensions content scripts from the user interaction
> requirement on the requestFullscreen method is not an option, and so I'm
> marking this as wontfix and change the whiteboard field to
> [design-decision-denied].

All of this for security is all nice and dandy... 
Still, I'm not sure how I'd be supposed to resort to this (ie triggering complete/total fullscreen) in Android without going all the way through adb shell settings put global policy_control immersive.full=org.mozilla.firefox ?

It's a PITA for every website that for a reason or another hasn't a specific apposite button. 
See also bug 961148
Product: Toolkit → WebExtensions

YouTube's latest GUI update allows viewers to scroll down from the video to the rest of the video page with all of the usual stuff like comments and everything.

An extension I am testing totally works on YouTube site when it is not in full-screen mode, but does not work in case if viewers would scroll down to the same content from the fullscreen mode where the extension previously worked but now can not.

It is super annoying and confusing to users, and playing with "full-screen-api.allow-trusted-requests-only" setting does not help.

And I did not find Manifest.JSON permission option keyword that would actually made my extension asking for the ability to run in the fullscreen mode.

But maybe I missed something. Does anyone know?

Thanks in advance.

You need to log in before you can comment on or make changes to this bug.