Title: [104775] trunk
Revision
104775
Author
[email protected]
Date
2012-01-11 17:24:23 -0800 (Wed, 11 Jan 2012)

Log Message

iframe sandbox doesn't block autofocus (IETC automatic-feature-block-autofocus-form-control)
https://bugs.webkit.org/show_bug.cgi?id=76120

Reviewed by Eric Seidel.

Source/WebCore:

Test: fast/forms/no-autofocus-in-sandbox.html

* html/HTMLFormControlElement.cpp:
(WebCore::shouldAutofocus):
    - The HTML5 spec says that we shouldn't autofocus elements when the
      automatic features are sandboxed.

LayoutTests:

* fast/forms/no-autofocus-in-sandbox-expected.txt: Added.
* fast/forms/no-autofocus-in-sandbox.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104774 => 104775)


--- trunk/LayoutTests/ChangeLog	2012-01-12 01:23:49 UTC (rev 104774)
+++ trunk/LayoutTests/ChangeLog	2012-01-12 01:24:23 UTC (rev 104775)
@@ -1,3 +1,13 @@
+2012-01-11  Adam Barth  <[email protected]>
+
+        iframe sandbox doesn't block autofocus (IETC automatic-feature-block-autofocus-form-control)
+        https://bugs.webkit.org/show_bug.cgi?id=76120
+
+        Reviewed by Eric Seidel.
+
+        * fast/forms/no-autofocus-in-sandbox-expected.txt: Added.
+        * fast/forms/no-autofocus-in-sandbox.html: Added.
+
 2012-01-11  Joshua Bell  <[email protected]>
 
         IndexedDB: Methods should throw TRANSACTION_INACTIVE_ERR when transaction is completed/aborted

Added: trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox-expected.txt (0 => 104775)


--- trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox-expected.txt	2012-01-12 01:24:23 UTC (rev 104775)
@@ -0,0 +1,2 @@
+ALERT: BODY
+This test passes if the activeElement is the body rather than the input element (which it would be if the sandbox didn't succeed in blocking autofocus). 

Added: trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox.html (0 => 104775)


--- trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/no-autofocus-in-sandbox.html	2012-01-12 01:24:23 UTC (rev 104775)
@@ -0,0 +1,8 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+This test passes if the activeElement is the body rather than the input element
+(which it would be if the sandbox didn't succeed in blocking autofocus).
+<iframe sandbox="allow-scripts"
+    src="" autofocus onfocus><script>alert(document.activeElement.tagName)</script>"></iframe>

Modified: trunk/Source/WebCore/ChangeLog (104774 => 104775)


--- trunk/Source/WebCore/ChangeLog	2012-01-12 01:23:49 UTC (rev 104774)
+++ trunk/Source/WebCore/ChangeLog	2012-01-12 01:24:23 UTC (rev 104775)
@@ -1,3 +1,17 @@
+2012-01-11  Adam Barth  <[email protected]>
+
+        iframe sandbox doesn't block autofocus (IETC automatic-feature-block-autofocus-form-control)
+        https://bugs.webkit.org/show_bug.cgi?id=76120
+
+        Reviewed by Eric Seidel.
+
+        Test: fast/forms/no-autofocus-in-sandbox.html
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::shouldAutofocus):
+            - The HTML5 spec says that we shouldn't autofocus elements when the
+              automatic features are sandboxed.
+
 2012-01-11  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=75904

Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (104774 => 104775)


--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-01-12 01:23:49 UTC (rev 104774)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp	2012-01-12 01:24:23 UTC (rev 104775)
@@ -139,6 +139,8 @@
         return false;
     if (element->document()->ignoreAutofocus())
         return false;
+    if (element->document()->isSandboxed(SandboxAutomaticFeatures))
+        return false;
     if (element->hasAutofocused())
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to