Closed Bug 1327013 Opened 7 years ago Closed 6 years ago

Dropbox: Shortcut "f" for switching top frame to DOM fullscreen doesn't work [can't call reuestFullscreen() from secure iframe via window.parent.postMessage()]

Categories

(Web Compatibility :: Site Reports, defect)

defect
Not set
normal

Tracking

(platform-rel +)

RESOLVED WORKSFORME
Tracking Status
platform-rel --- +

People

(Reporter: arni2033, Unassigned)

References

()

Details

(Whiteboard: [platform-rel-Dropbox])

>>>   My Info:   Win7_64, Nightly 49, 32bit, ID 20160526082509
STR_1:
1. Open url [1]
2. Click on the text in iframe
3. Press "f" to switch to DOM fullscreen

AR:  The iframe with text now takes all space on the page and displays close button at the top right
ER:  Shortcut "f" should switch the page to DOM fullscreen mode, just like in GoogleChrome

> [1] data:text/html,<script>location.href="https://www.drop"+"box.com/s/3c8sw5jsr4j49g0/Sample%20PDF.pdf?dl=0"</script>
> [2] https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen
> [3] https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage


Notes:
1) Brief explanation of what happens: event handler of 'keydown' executes window.parent.postMessage(),
   then in parent frame, event handler of 'message' event executes document.body.reuestFullscreen(),
   which fails, because it's not called inside original event handler. See [2], [3]
2) More detailed Expectations:  Either X or Y or Z or T.
 [I think that (Y) is definitely wrong, but I mentioned it anyway as a concept. For a long time I
  wanted to know why (Y) or (Z) aren't implemented, so if somebody knows, please post the explanation.
  At first sight (T) is what GoogleChrome is doing. I have no idea why Firefox decided not to do this]

X) Ask Dropbox devs to use some workaround.
Y) (Nested) zero timeouts and event handlers of events (e.g. 'message') dispatched in original event
   handlers should be deemed as "user-generated", because it's a fair play from the page's side.
Z) reuestFullscreen() should be more lenient and allow nested timeouts/events to set fullscreen
T) reuestFullscreen() should be more lenient and ANY code triggered by original event handler
   to set fullscreen, if it's executed after 1 second or less.
   This seems like what GoogleChrome is doing. I tested the following code on this page, and it works
   in GoogleChrome, but not Firefox. If the spec allows it, I think this should be implemented.

onclick=function(){
    setTimeout(function(){
        var B=document.body;
        if (B.requestFullscreen) B.requestFullscreen();
        else if (B.webkitRequestFullscreen) B.webkitRequestFullscreen();
        else if (B.mozRequestFullScreen) B.mozRequestFullScreen();
        else if (B.msRequestFullscreen) B.msRequestFullscreen();
    },1000);
}
No longer blocks: 1277113
Component: Untriaged → Desktop
Product: Firefox → Tech Evangelism
platform-rel: --- → ?
Whiteboard: [platform-rel-Dropbox]
ni? to diagnose.
Flags: needinfo?(miket)
platform-rel: ? → +
This WFM.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
I can reproduce this in Firefox 55 for OSX following the STR.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
This still doesn't reproduce for me. Please comment with STR and feel free to re-open, thanks!
Status: REOPENED → RESOLVED
Closed: 7 years ago6 years ago
Resolution: --- → WORKSFORME
Product: Tech Evangelism → Web Compatibility
You need to log in before you can comment on or make changes to this bug.