Automatic features should work in sandboxed iframes if "allow-scripts" flag is set
https://bugs.webkit.org/show_bug.cgi?id=93961

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-09-04
Reviewed by Adam Barth.

Source/WebCore:

Allow automatic features (video autoplay and form control
autofocus) in a sandboxed iframe that has "allow-scripts"
flag set. This behavior is according to the latest
specification at:
http://dev.w3.org/html5/spec/browsers.html#attr-iframe-sandbox-allow-same-origin

This sandboxed automatic features browsing context flag is
relaxed by the same keyword as scripts, because when
scripts are enabled these features are trivially possible
anyway, and it would be unfortunate to force authors to
use script to do them when sandboxed rather than allowing
them to use the declarative features.

Tests: fast/forms/autofocus-in-sandbox-with-allow-scripts.html
       media/auto-play-in-sandbox-with-allow-scripts.html

* dom/SecurityContext.cpp:
(WebCore::SecurityContext::parseSandboxPolicy):

LayoutTests:

Add layout tests to check that automatic features (video
autoplay and form control autofocus) are allowed / working
in sandboxed iframes if the "allow-scripts" flag is set.
This behavior is according to the latest specification at:
http://dev.w3.org/html5/spec/browsers.html#attr-iframe-sandbox-allow-same-origin

The tests to check that automatic features are blocked in
sandboxed iframes have been removed since they relied on
the "allow-scripts" flag to work.

* fast/forms/autofocus-in-sandbox-with-allow-scripts-expected.txt: Added.
* fast/forms/autofocus-in-sandbox-with-allow-scripts.html: Renamed from LayoutTests/fast/forms/no-autofocus-in-sandbox.html.
* fast/forms/no-autofocus-in-sandbox-expected.txt: Removed.
* media/auto-play-in-sandbox-with-allow-scripts-expected.txt: Added.
* media/auto-play-in-sandbox-with-allow-scripts.html: Renamed from LayoutTests/media/no-auto-play-in-sandbox.html.
* media/no-auto-play-in-sandbox-expected.txt: Removed.
* media/resources/auto-play-in-sandbox-with-allow-scripts-iframe.html: Added.
* media/resources/no-auto-play-in-sandbox-iframe.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed