Closed Bug 1411227 Opened 7 years ago Closed 7 years ago

Allow WebExtensions to request fullscreen

Categories

(WebExtensions :: General, enhancement, P5)

enhancement

Tracking

(firefox57 wontfix)

RESOLVED WONTFIX
Tracking Status
firefox57 --- wontfix

People

(Reporter: kernp25, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [design-decision-denied])

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20171023100252 Expected results: WebExtensions should be able to request fullscreen. This code should work in a content script (like it works in google chrome): if (document.documentElement.requestFullScreen) { document.documentElement.requestFullScreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullScreen) { document.documentElement.webkitRequestFullScreen(); }
Priority: -- → P5
Whiteboard: [design-decision-needed]
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
Works for me with requestFullscreen(). requestFullScreen does not exist.
Blocks: 1403295
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
IMO not really dupe of bug 1388479. Bug 1388479 says "add fullScreen permission", but this bug is about making "requestFullscreen" always work when called from a WebExtension. Right now, if you add a page action for going fullscreen, and run this inside the page action handler, > browser.tabs.executeScript({ > code: "document.documentElement.requestFullscreen();", > }); requestFullscreen() will fail with error "[JavaScript Warning: "Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler." {file: "resource://gre/modules/ExtensionContent.jsm" line: 362}]". This bug is about lifting this restriction when requestFullscreen is called by a WebExtension. Note that Fennec does not have a "Fullscreen" menu option, so there's no native replacement for this functionality inside Fennec.
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
Severity: normal → enhancement
Hi kernp25, this has been added to the agenda for the WebExtensions APIs triage on April 3, 2018. Would you be able to join us? Here’s a quick overview of what to expect at the triage: * We normally spend 5 minutes per bug * The more information in the bug, the better * The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details Relevant Links: * Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting * Meeting agenda: https://docs.google.com/document/d/1H1ZEWf7dmyyu7NZZL90TkbyaUTjbdIK3TUEtO_vff34/edit# * Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
coming from https://bugzilla.mozilla.org/show_bug.cgi?id=1388479 In Google Chrome my "Full screen" extension works just fine. Firefox not: https://addons.mozilla.org/en-US/firefox/addon/full-screen-for-firefox/
WebExtensions should have more power then normal webpages. So this code should work: > browser.tabs.executeScript({ > code: "document.documentElement.requestFullscreen();", > });
Note that requestFullscreen can also be abused by malicious websites [1]: So "Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler." doesn't really protect the user here. [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1428913
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].
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → WONTFIX
Whiteboard: [design-decision-needed] → [design-decision-denied]
Product: Toolkit → WebExtensions

I know that it is old and closed topic but have you consider adding "fullscreen" permission to manifest. If Element.requestFullscreen() is to hard to change you could add browser.fullscreen module, that can be called in content_script

I need this functionality for my automation extension that plays next episode of show ;)

Flags: needinfo?(nanimo1309)
You need to log in before you can comment on or make changes to this bug.