can not request full screen on browserAction before user clicked the page
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
People
(Reporter: thorgalle, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
Load this extension: https://github.com/th0rgall/fullscreen/tree/firefox-support
See the attached video where I'm executing these steps.
It essentially runs this in a background script:
chrome.tabs.executeScript({
code: "document.documentElement.requestFullscreen();"
});
when a browserAction is invoked.
- Load a random URL in a new tab. https://duckduckgo.com/ for instance. Don't click anywhere on the loaded page yet.
- Click the extension icon (browserAction). The fullscreen request will fail with the following warning in the console:
Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler. - Click somewhere in the web page you just loaded (not on a link)
- Try clicking the extension button again. Now the
requestFullscreenworks.
Previous related bugs
This might seem like a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1411227, but the WONTFIX conclusion there was: "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]."
Note the "exempting from user interaction". In this case, there is still user interaction (browserAction) on the extension button/shortcut. Therefore, this case should not be exempted according to that decision.
Workarounds
I tried executing document.documentElement.click() to simulate the click before requesting fullscreen, but that didn't work out.
The obvious workaround is to use the <all_urls> permission, but isn't that the whole point of activeTab? To avoid using <all_urls> for actions on pages that are the results of browserActions?
Actual results:
activeTab permission does not allow requestFullscreen on a browserAction if the user has not clicked on the page that was just loaded yet
Expected results:
An extension with activeTab should be able to request fullscreen via tabs.executeScript on user click of the extension button, without the user having to click on the page first
Updated•5 years ago
|
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Hmm, it works on Chrome, maybe we should consider make it work on Firefox.
Updated•5 years ago
|
| Reporter | ||
Comment 2•5 years ago
|
||
I realized my report wasn't accurate. I tried the <all_urls> permission instead of activeTab and the problem remains.
Revised actual results: extensions can not execute requestFullscreen on a browserAction if the user has not clicked on the page that was just loaded yet (regardless of the permissions in manifest.json)
The demo video attachment I refer to in the report also didn't come through. I uploaded it here: https://youtu.be/wPEKxiWSeG0. When the mouse moves into the page it clicks one time.
@edgar: yes, it works without an initial user click on Chrome. Making this work in Firefox would be much appreciated!
Comment 3•5 years ago
|
||
I tested Chrome a bit, it seems that Chrome will propagate userActivation state initialized from browserAction to content tab through executeScript, so the page executed the content script allows the fullscreen request.
Updated•3 years ago
|
Description
•