Bug 90327 - [BlackBerry] exitFullScreenForElement() is not working for fullscreen elements in iframes
Summary: [BlackBerry] exitFullScreenForElement() is not working for fullscreen element...
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit BlackBerry (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Max Feil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-29 17:39 PDT by Max Feil
Modified: 2012-11-02 12:48 PDT (History)
5 users (show)

See Also:


Attachments
Patch (6.96 KB, patch)
2012-06-29 17:51 PDT, Max Feil
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-02 (752.38 KB, application/zip)
2012-06-29 20:20 PDT, WebKit Review Bot
no flags Details
Patch (7.64 KB, patch)
2012-07-06 14:07 PDT, Max Feil
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Max Feil 2012-06-29 17:39:36 PDT
This problem was discovered in the BlackBerry port during manual testing of fullscreen video at:
http://w3schools.com/html5/tryit.asp?filename=tryhtml5_video_all
See PR168219.

The video element is in an iframe, and exiting fullscreen resulted in a crash. The exitFullScreenForElement() call was being made on the topDocument (which has a null m_fullScreenElement) instead of the iframe's document.

The Chromium and Windows ports get around this problem by storing either the fullscreen element or its frame during enterFullScreenForElement(), so I will bring the BlackBerry port in line with this. See also bug 89817.
Comment 1 Max Feil 2012-06-29 17:51:02 PDT
Created attachment 150283 [details]
Patch
Comment 2 WebKit Review Bot 2012-06-29 20:20:52 PDT
Comment on attachment 150283 [details]
Patch

Attachment 150283 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13114572

New failing tests:
fullscreen/exit-full-screen-iframe.html
Comment 3 WebKit Review Bot 2012-06-29 20:20:56 PDT
Created attachment 150296 [details]
Archive of layout-test-results from ec2-cr-linux-02

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-02  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 4 Antonio Gomes 2012-06-30 07:34:25 PDT
Comment on attachment 150283 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150283&action=review

> Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp:739
> +    ASSERT(m_fullScreenElement);
> +    if (m_fullScreenElement) {

Max, if it can be null, why do you assert that it is always non-null?
Comment 5 Max Feil 2012-06-30 12:21:43 PDT
(In reply to comment #4)
> > Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp:739
> > +    ASSERT(m_fullScreenElement);
> > +    if (m_fullScreenElement) {
> 
> Max, if it can be null, why do you assert that it is always non-null?

The element parameter to exitFullScreenForElement() can be null (for reasons I don't fully agree with). But the member variable m_fullScreenElement is set by enterFullScreenForElement() whose element parameter is never null, so the member variable should never be null at this point (except in the pathological case of mismatched enter/exit calls). See bug 89817 for more background info.
Comment 6 Antonio Gomes 2012-06-30 13:56:42 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > > Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp:739
> > > +    ASSERT(m_fullScreenElement);
> > > +    if (m_fullScreenElement) {
> > 
> > Max, if it can be null, why do you assert that it is always non-null?
> 
> The element parameter to exitFullScreenForElement() can be null (for reasons I don't fully agree with). But the member variable m_fullScreenElement is set by enterFullScreenForElement() whose element parameter is never null, so the member variable should never be null at this point (except in the pathological case of mismatched enter/exit calls). See bug 89817 for more background info.

I understand that part from the other bug. So why not just remove the 'if' and keep the assert?
Comment 7 Max Feil 2012-06-30 14:31:04 PDT
(In reply to comment #6)
> I understand that part from the other bug. So why not just remove the 'if' and keep the assert?

I think it is better in release builds to do nothing rather than crash if exitFullScreenForElement() is called when m_fullScreenElement is empty. In many ways a null m_fullScreenElement means we are not knowingly in fullscreen mode, so there is nothing we should do. I felt this was clear from the code?
Comment 8 Antonio Gomes 2012-07-01 11:36:46 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > I understand that part from the other bug. So why not just remove the 'if' and keep the assert?
> 
> I think it is better in release builds to do nothing rather than crash if exitFullScreenForElement() is called when m_fullScreenElement is empty.

I particularly prefer it to crash, so we fix it if it is a real bug. If we are trying to catch the cases when it can happen, then we can keep both the assert and if check temporarily, but I'd dislike this pattern to live forever.
Comment 9 Max Feil 2012-07-06 14:07:42 PDT
Created attachment 151116 [details]
Patch
Comment 10 WebKit Review Bot 2012-07-06 14:41:14 PDT
Comment on attachment 151116 [details]
Patch

Clearing flags on attachment: 151116

Committed r122035: <http://trac.webkit.org/changeset/122035>
Comment 11 WebKit Review Bot 2012-07-06 14:41:19 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Max Feil 2012-11-02 12:48:10 PDT
Closing bug for patch that landed a long time ago.