Bug 114530

Summary: requestFullscreen on the current fullscreen element should fire fullscreen error.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: WebCore Misc.Assignee: Frédéric Wang Nélar <fred.wang>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, commit-queue, esprehn+autocc, rniwa, scheib, simon.fraser, zalan
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://github.com/GoogleChrome/chrome-app-samples/blob/master/window-state/window.html
Bug Depends on:    
Bug Blocks: 276855    
Attachments:
Description Flags
Patch bfulgham: review+

Jer Noble
Reported 2013-04-12 13:21:25 PDT
Cloned from <http://code.google.com/p/chromium/issues/detail?id=229803>: UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1472.0 Safari/537.36 Steps to reproduce the problem: 1. Install the Window State example from the chrome-app-samples repo (https://github.com/GoogleChrome/chrome-app-samples/tree/master/window-state ) 2. Launch it, then "Enter" next to HTML5 fullscreen 3. (App goes fullscreen) Click "Enter" again 4. Click "Exit" What is the expected behavior? App stops being fullscreen What went wrong? App stays fullscreen. Clicking "Exit" again will cause it to stop being fullscreen. You have to press "Exit" as many times as you've pressed "Enter". (These buttons are just calling webkitRequestFullscreen and webkitExitFullscreen respectively.) WebStore page: Did this work before? No Chrome version: 28.0.1472.0 Channel: canary OS Version: OS X 10.7.5
Attachments
Patch (7.08 KB, patch)
2013-04-17 14:25 PDT, Jer Noble
bfulgham: review+
Jer Noble
Comment 1 2013-04-12 13:22:04 PDT
schieb@chromium.org commented <http://code.google.com/p/chromium/issues/detail?id=229803#c3> in the original bug: "This is an error in WebKit & Blink (likely in Document.cpp), and not apps specific. Load https://github.com/GoogleChrome/chrome-app-samples/blob/master/window-state/window.html in Chrome and the same behavior exists. The fullscreen specification https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html does express this as an error, in: - requestFullscreen() method must run these steps: - If any of the following conditions are true, ... fullscreenerror: - "The context object's node document fullscreen element stack is not empty and its top element is not an ancestor of the context object." In this case, the element is already fullscreen and the top of the stack, the element is not an ancestor of its self. A work around is for an application to check document.webkitFullscreenElement before requesting fullscreen, so as to not make the same element fullscreen multiple times."
Jer Noble
Comment 2 2013-04-17 14:17:23 PDT
*** Bug 114767 has been marked as a duplicate of this bug. ***
Jer Noble
Comment 3 2013-04-17 14:25:23 PDT
Brent Fulgham
Comment 4 2014-04-24 10:30:46 PDT
Comment on attachment 198612 [details] Patch r=me.
Ahmad Saleem
Comment 5 2022-09-12 09:18:52 PDT
This r+ patch didn't landed and I was not able to find reference to this code in Webkit GitHub (might be searching wrong). Can anyone else see whether it is still an issue or need to be fixed or this is taken care of? Thanks!
Frédéric Wang Nélar
Comment 6 2026-10-10 00:06:47 PDT
Frédéric Wang Nélar
Comment 7 2026-10-10 00:09:10 PDT
(In reply to Ahmad Saleem from comment #5) > This r+ patch didn't landed and I was not able to find reference to this > code in Webkit GitHub (might be searching wrong). > > Can anyone else see whether it is still an issue or need to be fixed or this > is taken care of? Thanks! @Ahmad Saleem: I just did it. And actually this patch is no longer needed, WebKit implements the correct behavior per the spec (i.e. a stack of fullscreen elements vs a single fullscreen element). The test has been updated in Chromium: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/fullscreen/full-screen-twice-newapi.html and it's passing in WebKit. Anyway I uploaded a PR to import this test, but feel free to close as WONTFIX if you prefer.
Frédéric Wang Nélar
Comment 8 2026-10-12 22:54:12 PDT
> (In reply to Ahmad Saleem from comment #5) > The test has been updated in Chromium: > https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/ > web_tests/fullscreen/full-screen-twice-newapi.html and it's passing in > WebKit. > > Anyway I uploaded a PR to import this test, but feel free to close as > WONTFIX if you prefer. There is already a WPT test for that: LayoutTests/imported/w3c/web-platform-tests/fullscreen/api/element-request-fullscreen-twice.html So closing.
Note You need to log in before you can comment on or make changes to this bug.