Title: [169849] trunk
Revision
169849
Author
[email protected]
Date
2014-06-11 15:41:03 -0700 (Wed, 11 Jun 2014)

Log Message

WindowFeatures arguments shoud ignore invalid characters in values
<http://webkit.org/b/133703>
<rdar://problem/17254118>

Reviewed by Andy Estes.

Source/WebCore:

Test: fast/dom/Window/window-property-invalid-characters-ignored.html

* page/WindowFeatures.cpp:
(WebCore::WindowFeatures::WindowFeatures): Set |length| based on
|buffer|, not |features|.  Switch to using a for loop.  Switch
to unsigned types since we are working with positive offsets
into a String.

LayoutTests:

* fast/dom/Window/resources/window-property-invalid-characters-ignored.html: Added.
* fast/dom/Window/window-property-invalid-characters-ignored-expected.txt: Added.
* fast/dom/Window/window-property-invalid-characters-ignored.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169848 => 169849)


--- trunk/LayoutTests/ChangeLog	2014-06-11 22:40:59 UTC (rev 169848)
+++ trunk/LayoutTests/ChangeLog	2014-06-11 22:41:03 UTC (rev 169849)
@@ -1,5 +1,17 @@
 2014-06-11  David Kilzer  <[email protected]>
 
+        WindowFeatures arguments shoud ignore invalid characters in values
+        <http://webkit.org/b/133703>
+        <rdar://problem/17254118>
+
+        Reviewed by Andy Estes.
+
+        * fast/dom/Window/resources/window-property-invalid-characters-ignored.html: Added.
+        * fast/dom/Window/window-property-invalid-characters-ignored-expected.txt: Added.
+        * fast/dom/Window/window-property-invalid-characters-ignored.html: Added.
+
+2014-06-11  David Kilzer  <[email protected]>
+
         Viewport arguments should ignore invalid characters in values
         <http://webkit.org/b/133555>
         <rdar://problem/17179650>

Added: trunk/LayoutTests/fast/dom/Window/resources/window-property-invalid-characters-ignored.html (0 => 169849)


--- trunk/LayoutTests/fast/dom/Window/resources/window-property-invalid-characters-ignored.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/resources/window-property-invalid-characters-ignored.html	2014-06-11 22:41:03 UTC (rev 169849)
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<html><head></head><body _onload_="setTimeout('window.opener.finishTest()', 0)"></body></html>

Added: trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored-expected.txt (0 => 169849)


--- trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored-expected.txt	2014-06-11 22:41:03 UTC (rev 169849)
@@ -0,0 +1,12 @@
+Tests that invalid characters are ignored after a window property value.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS w.document.width is 123
+PASS w.document.height is 123
+PASS w !== window is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored.html (0 => 169849)


--- trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Window/window-property-invalid-characters-ignored.html	2014-06-11 22:41:03 UTC (rev 169849)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+jsTestIsAsync = true;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.setCanOpenWindows();
+}
+
+description("Tests that invalid characters are ignored after a window property value.");
+
+var w = window.open("resources/window-property-invalid-characters-ignored.html", "blank", "width=123\u0130,height=123\u0130");
+
+function finishTest()
+{
+    shouldBe("w.document.width", "123");
+    shouldBe("w.document.height", "123");
+    shouldBeTrue("w !== window");
+    w.close();
+
+    finishJSTest();
+}
+
+successfullyParsed = true;
+</script>
+<script src=""
+</head>
+<body>
+<pre id="console"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (169848 => 169849)


--- trunk/Source/WebCore/ChangeLog	2014-06-11 22:40:59 UTC (rev 169848)
+++ trunk/Source/WebCore/ChangeLog	2014-06-11 22:41:03 UTC (rev 169849)
@@ -1,5 +1,21 @@
 2014-06-11  David Kilzer  <[email protected]>
 
+        WindowFeatures arguments shoud ignore invalid characters in values
+        <http://webkit.org/b/133703>
+        <rdar://problem/17254118>
+
+        Reviewed by Andy Estes.
+
+        Test: fast/dom/Window/window-property-invalid-characters-ignored.html
+
+        * page/WindowFeatures.cpp:
+        (WebCore::WindowFeatures::WindowFeatures): Set |length| based on
+        |buffer|, not |features|.  Switch to using a for loop.  Switch
+        to unsigned types since we are working with positive offsets
+        into a String.
+
+2014-06-11  David Kilzer  <[email protected]>
+
         Viewport arguments should ignore invalid characters in values
         <http://webkit.org/b/133555>
         <rdar://problem/17179650>

Modified: trunk/Source/WebCore/page/WindowFeatures.cpp (169848 => 169849)


--- trunk/Source/WebCore/page/WindowFeatures.cpp	2014-06-11 22:40:59 UTC (rev 169848)
+++ trunk/Source/WebCore/page/WindowFeatures.cpp	2014-06-11 22:41:03 UTC (rev 169849)
@@ -74,13 +74,12 @@
     scrollbarsVisible = false;
 
     // Tread lightly in this code -- it was specifically designed to mimic Win IE's parsing behavior.
-    int keyBegin, keyEnd;
-    int valueBegin, valueEnd;
+    unsigned keyBegin, keyEnd;
+    unsigned valueBegin, valueEnd;
 
-    int i = 0;
-    int length = features.length();
     String buffer = features.lower();
-    while (i < length) {
+    unsigned length = buffer.length();
+    for (unsigned i = 0; i < length; ) {
         // skip to first non-separator, but don't skip past the end of the string
         while (isWindowFeaturesSeparator(buffer[i])) {
             if (i >= length)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to