Title: [191349] trunk
- Revision
- 191349
- Author
- [email protected]
- Date
- 2015-10-20 11:33:38 -0700 (Tue, 20 Oct 2015)
Log Message
Only HTML spaces should be stripped from a <script>'s 'for' / 'event' attributes
https://bugs.webkit.org/show_bug.cgi?id=150335
Reviewed by Darin Adler.
Source/WebCore:
Only HTML spaces should be stripped from a <script>'s 'for' / 'event' attributes:
https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script (step 12.3)
https://html.spec.whatwg.org/multipage/infrastructure.html#space-character
Previously, we were uding the wrong stripping function and we were stripping
some non-HTML spaces.
Test: fast/dom/script-for-event-spaces.html
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::isScriptForEventSupported):
LayoutTests:
Add a layout test to check that U+000B does not get stripped from the
script's 'for' / 'event' attributes.
* fast/dom/script-for-event-spaces-expected.txt: Added.
* fast/dom/script-for-event-spaces.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (191348 => 191349)
--- trunk/LayoutTests/ChangeLog 2015-10-20 18:15:58 UTC (rev 191348)
+++ trunk/LayoutTests/ChangeLog 2015-10-20 18:33:38 UTC (rev 191349)
@@ -1,3 +1,16 @@
+2015-10-20 Chris Dumez <[email protected]>
+
+ Only HTML spaces should be stripped from a <script>'s 'for' / 'event' attributes
+ https://bugs.webkit.org/show_bug.cgi?id=150335
+
+ Reviewed by Darin Adler.
+
+ Add a layout test to check that U+000B does not get stripped from the
+ script's 'for' / 'event' attributes.
+
+ * fast/dom/script-for-event-spaces-expected.txt: Added.
+ * fast/dom/script-for-event-spaces.html: Added.
+
2015-10-20 Ryan Haddad <[email protected]>
fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html flakily times out on Mavericks WK1
Added: trunk/LayoutTests/fast/dom/script-for-event-spaces-expected.txt (0 => 191349)
--- trunk/LayoutTests/fast/dom/script-for-event-spaces-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/script-for-event-spaces-expected.txt 2015-10-20 18:33:38 UTC (rev 191349)
@@ -0,0 +1,14 @@
+Tests that only HTML spaces in a script's 'event' / 'for' attributes are stripped.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* for="" event="onload"
+PASS wasExecuted is false
+
+* for="" event="onload"
+PASS wasExecuted is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/script-for-event-spaces.html (0 => 191349)
--- trunk/LayoutTests/fast/dom/script-for-event-spaces.html (rev 0)
+++ trunk/LayoutTests/fast/dom/script-for-event-spaces.html 2015-10-20 18:33:38 UTC (rev 191349)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+
+<script>
+description("Tests that only HTML spaces in a script's 'event' / 'for' attributes are stripped.");
+var wasExecuted = false;
+// U+000B /  is not an HTML space.
+</script>
+
+<script for="" event="onload">
+wasExecuted = true;
+</script>
+
+<script>
+debug("* for="" event=\"onload\"");
+shouldBeFalse("wasExecuted");
+wasExecuted = false;
+</script>
+
+<script for="" event="onload">
+wasExecuted = true;
+</script>
+
+<script>
+debug("");
+debug("* for="" event=\"&#xb;onload&#xb;\"");
+shouldBeFalse("wasExecuted");
+wasExecuted = false;
+</script>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (191348 => 191349)
--- trunk/Source/WebCore/ChangeLog 2015-10-20 18:15:58 UTC (rev 191348)
+++ trunk/Source/WebCore/ChangeLog 2015-10-20 18:33:38 UTC (rev 191349)
@@ -1,3 +1,22 @@
+2015-10-20 Chris Dumez <[email protected]>
+
+ Only HTML spaces should be stripped from a <script>'s 'for' / 'event' attributes
+ https://bugs.webkit.org/show_bug.cgi?id=150335
+
+ Reviewed by Darin Adler.
+
+ Only HTML spaces should be stripped from a <script>'s 'for' / 'event' attributes:
+ https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script (step 12.3)
+ https://html.spec.whatwg.org/multipage/infrastructure.html#space-character
+
+ Previously, we were uding the wrong stripping function and we were stripping
+ some non-HTML spaces.
+
+ Test: fast/dom/script-for-event-spaces.html
+
+ * dom/ScriptElement.cpp:
+ (WebCore::ScriptElement::isScriptForEventSupported):
+
2015-10-20 Csaba Osztrogonác <[email protected]>
Fix the !ENABLE(CSS_GRID_LAYOUT) build after r191128
Modified: trunk/Source/WebCore/dom/ScriptElement.cpp (191348 => 191349)
--- trunk/Source/WebCore/dom/ScriptElement.cpp 2015-10-20 18:15:58 UTC (rev 191348)
+++ trunk/Source/WebCore/dom/ScriptElement.cpp 2015-10-20 18:33:38 UTC (rev 191349)
@@ -369,11 +369,11 @@
String eventAttribute = eventAttributeValue();
String forAttribute = forAttributeValue();
if (!eventAttribute.isNull() && !forAttribute.isNull()) {
- forAttribute = forAttribute.stripWhiteSpace();
+ forAttribute = stripLeadingAndTrailingHTMLSpaces(forAttribute);
if (!equalIgnoringCase(forAttribute, "window"))
return false;
- eventAttribute = eventAttribute.stripWhiteSpace();
+ eventAttribute = stripLeadingAndTrailingHTMLSpaces(eventAttribute);
if (!equalIgnoringCase(eventAttribute, "onload") && !equalIgnoringCase(eventAttribute, "onload()"))
return false;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes