Changeset 81038 in webkit


Ignore:
Timestamp:
Mar 14, 2011 10:52:31 AM (13 years ago)
Author:
jer.noble@apple.com
Message:

2011-03-12 Jer Noble <jer.noble@apple.com>

Reviewed by Eric Carlson.

FullScreen: Handle entering full screen security restrictions
https://bugs.webkit.org/show_bug.cgi?id=56264

  • fullscreen/full-screen-css.html: Use runWithKeyDown.
  • fullscreen/full-screen-remove-ancestor.html: Ditto.
  • fullscreen/full-screen-remove.html: Ditto.
  • fullscreen/full-screen-request.html: Ditto.
  • fullscreen/full-screen-twice.html: Ditto.
  • fullscreen/full-screen-test.js:
  • fullscreen/full-screen-iframe-allowed-expected.txt: Added.
  • fullscreen/full-screen-iframe-allowed.html: Added.
  • fullscreen/full-screen-iframe-not-allowed-expected.txt: Added.
  • fullscreen/full-screen-iframe-not-allowed.html: Added. (runWithKeyDown): Added. Wraps the command in a keyDown/keyPress

listener.

  • platform/mac-wk2/Skipped: Added new tests to skipped list.
  • platform/qt-wk2/Skipped: Ditto.

2011-03-13 Jer Noble <jer.noble@apple.com>

FullScreen: Handle entering full screen security restrictions
https://bugs.webkit.org/show_bug.cgi?id=56264

Tests: fullscreen/full-screen-iframe-allowed.html

fullscreen/full-screen-iframe-not-allowed.html

Disable full screen documents in the following conditions:
1) requesting element is in an iframe which does not have a
webkitallowfullscreen attribute.
2) page is not processing a user gesture.

  • dom/Document.cpp: (WebCore::Document::fullScreenIsAllowedForElement): Added. Checks

to see if elements contained in IFRAMES are allowed to
enter full screen.

(WebCore::Document::webkitRequestFullScreenForElement): Checks

if page is currently processing a user gesture.

  • dom/Document.h:
  • html/HTMLAttributeNames.in: Added webkitallowfullscreenAttr.
  • html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::allowFullScreen): Added.
  • html/HTMLFrameElementBase.h:
Location:
trunk
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r81035 r81038  
     12011-03-12  Jer Noble  <jer.noble@apple.com>
     2
     3        Reviewed by Eric Carlson.
     4
     5        FullScreen: Handle entering full screen security restrictions
     6        https://bugs.webkit.org/show_bug.cgi?id=56264
     7
     8        * fullscreen/full-screen-css.html: Use runWithKeyDown.
     9        * fullscreen/full-screen-remove-ancestor.html: Ditto.
     10        * fullscreen/full-screen-remove.html: Ditto.
     11        * fullscreen/full-screen-request.html: Ditto.
     12        * fullscreen/full-screen-twice.html: Ditto.
     13        * fullscreen/full-screen-test.js:
     14        * fullscreen/full-screen-iframe-allowed-expected.txt: Added.
     15        * fullscreen/full-screen-iframe-allowed.html: Added.
     16        * fullscreen/full-screen-iframe-not-allowed-expected.txt: Added.
     17        * fullscreen/full-screen-iframe-not-allowed.html: Added.
     18        (runWithKeyDown): Added.  Wraps the command in a keyDown/keyPress
     19            listener.
     20        * platform/mac-wk2/Skipped: Added new tests to skipped list.
     21        * platform/qt-wk2/Skipped: Ditto.
     22
    1232011-02-28  Luiz Agostini  <luiz.agostini@openbossa.org>
    224
  • trunk/LayoutTests/fullscreen/full-screen-css.html

    r75277 r81038  
    3434       
    3535            callback = documentEnteredFullScreen;
    36             document.documentElement.webkitRequestFullScreen();
     36            runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
    3737        };
    3838   
     
    4646   
    4747        callback = spanEnteredFullScreen;
    48         span.webkitRequestFullScreen();
     48        runWithKeyDown(function(){span.webkitRequestFullScreen()});
    4949    }
    5050</script>
  • trunk/LayoutTests/fullscreen/full-screen-remove-ancestor.html

    r66251 r81038  
    3232
    3333        callback = spanEnteredFullScreen;
    34         span.webkitRequestFullScreen();
     34        runWithKeyDown(function(){span.webkitRequestFullScreen()});
    3535    }
    3636</script>
  • trunk/LayoutTests/fullscreen/full-screen-remove.html

    r66251 r81038  
    3131   
    3232        callback = spanEnteredFullScreen;
    33         span.webkitRequestFullScreen();
     33        runWithKeyDown(function(){span.webkitRequestFullScreen()});
    3434    }
    3535</script>
  • trunk/LayoutTests/fullscreen/full-screen-request.html

    r75277 r81038  
    88    } else {
    99        waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitIsFullScreen==true");
    10         document.documentElement.webkitRequestFullScreen();
     10        runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
    1111    }
    1212</script>
  • trunk/LayoutTests/fullscreen/full-screen-test.js

    r66267 r81038  
    77    layoutTestController.dumpAsText();
    88    layoutTestController.waitUntilDone();
     9}
     10
     11function runWithKeyDown(fn)
     12{
     13    document.addEventListener('keypress', function() { fn(); }, false);
     14    if (window.layoutTestController) {
     15        eventSender.keyDown(" ", []);
     16    }
    917}
    1018
  • trunk/LayoutTests/fullscreen/full-screen-twice.html

    r66251 r81038  
    2121            testExpected("document.webkitCurrentFullScreenElement", span);
    2222            callback = documentEnteredFullScreen;
    23             document.documentElement.webkitRequestFullScreen();
     23            runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
    2424        };
    2525   
     
    3131
    3232        callback = spanEnteredFullScreen;
    33         span.webkitRequestFullScreen();
     33        runWithKeyDown(function(){span.webkitRequestFullScreen()});
    3434    }
    3535</script>
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r80503 r81038  
    19141914# WebKit2 needs fullscreen support
    19151915fullscreen/full-screen-css.html
     1916fullscreen/full-screen-iframe-allowed.html
     1917fullscreen/full-screen-iframe-not-allowed.html
    19161918fullscreen/full-screen-remove-ancestor.html
    19171919fullscreen/full-screen-remove.html
  • trunk/LayoutTests/platform/qt-wk2/Skipped

    r81018 r81038  
    20582058# WebKit2 needs fullscreen support
    20592059fullscreen/full-screen-css.html
     2060fullscreen/full-screen-iframe-allowed.html
     2061fullscreen/full-screen-iframe-not-allowed.html
    20602062fullscreen/full-screen-remove-ancestor.html
    20612063fullscreen/full-screen-remove.html
  • trunk/Source/WebCore/ChangeLog

    r81037 r81038  
     12011-03-13  Jer Noble  <jer.noble@apple.com>
     2
     3        FullScreen: Handle entering full screen security restrictions
     4        https://bugs.webkit.org/show_bug.cgi?id=56264
     5
     6        Tests: fullscreen/full-screen-iframe-allowed.html
     7               fullscreen/full-screen-iframe-not-allowed.html
     8
     9        Disable full screen documents in the following conditions:
     10        1) requesting element is in an iframe which does not have a
     11        webkitallowfullscreen attribute.
     12        2) page is not processing a user gesture.
     13
     14        * dom/Document.cpp:
     15        (WebCore::Document::fullScreenIsAllowedForElement): Added.  Checks
     16            to see if elements contained in IFRAMES are allowed to
     17            enter full screen.
     18        (WebCore::Document::webkitRequestFullScreenForElement): Checks
     19            if page is currently processing a user gesture.
     20        * dom/Document.h:
     21        * html/HTMLAttributeNames.in: Added webkitallowfullscreenAttr.
     22        * html/HTMLFrameElementBase.cpp:
     23        (WebCore::HTMLFrameElementBase::allowFullScreen): Added.
     24        * html/HTMLFrameElementBase.h:
     25
    1262011-03-14  Anton D'Auria  <adauria@apple.com>
    227
  • trunk/Source/WebCore/dom/Document.cpp

    r80930 r81038  
    48504850
    48514851#if ENABLE(FULLSCREEN_API)
     4852bool Document::fullScreenIsAllowedForElement(Element* element) const
     4853{
     4854    ASSERT(element);
     4855    while (HTMLFrameOwnerElement* ownerElement = element->document()->ownerElement()) {
     4856        if (!ownerElement->hasTagName(frameTag) && !ownerElement->hasTagName(iframeTag))
     4857            continue;
     4858
     4859        if (!static_cast<HTMLFrameElementBase*>(ownerElement)->allowFullScreen())
     4860            return false;
     4861        element = ownerElement;
     4862    }
     4863    return true;
     4864}
     4865
    48524866void Document::webkitRequestFullScreenForElement(Element* element, unsigned short flags)
    48534867{
     
    48574871    if (!element)
    48584872        element = documentElement();
     4873   
     4874    if (!fullScreenIsAllowedForElement(element))
     4875        return;
     4876   
     4877    if (!ScriptController::processingUserGesture())
     4878        return;
    48594879   
    48604880    if (!page()->chrome()->client()->supportsFullScreenForElement(element))
  • trunk/Source/WebCore/dom/Document.h

    r80797 r81038  
    10941094   
    10951095    void fullScreenChangeDelayTimerFired(Timer<Document>*);
     1096    bool fullScreenIsAllowedForElement(Element*) const;
    10961097#endif
    10971098
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r80297 r81038  
    299299vlink
    300300vspace
     301webkitallowfullscreen
    301302webkitdirectory
    302303width
  • trunk/Source/WebCore/html/HTMLFrameElementBase.cpp

    r76872 r81038  
    284284}
    285285
     286#if ENABLE(FULLSCREEN_API)
     287bool HTMLFrameElementBase::allowFullScreen() const
     288{
     289    return hasAttribute(webkitallowfullscreenAttr);
     290}
     291#endif
     292
    286293} // namespace WebCore
  • trunk/Source/WebCore/html/HTMLFrameElementBase.h

    r78232 r81038  
    4444
    4545    void setRemainsAliveOnRemovalFromTree(bool);
     46#if ENABLE(FULLSCREEN_API)
     47    virtual bool allowFullScreen() const;
     48#endif
    4649
    4750protected:
Note: See TracChangeset for help on using the changeset viewer.