Title: [169848] trunk
Revision
169848
Author
[email protected]
Date
2014-06-11 15:40:59 -0700 (Wed, 11 Jun 2014)

Log Message

Viewport arguments should ignore invalid characters in values
<http://webkit.org/b/133555>
<rdar://problem/17179650>

Reviewed by Daniel Bates.

Source/WebCore:

Test: fast/viewport/viewport-warnings-7.html

* dom/Document.cpp:
(WebCore::Document::processArguments): 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/viewport/viewport-warnings-7-expected.txt: Added.
* fast/viewport/viewport-warnings-7.html: Added.

Modified Paths

Added Paths

Diff

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


--- trunk/LayoutTests/ChangeLog	2014-06-11 22:34:05 UTC (rev 169847)
+++ trunk/LayoutTests/ChangeLog	2014-06-11 22:40:59 UTC (rev 169848)
@@ -1,5 +1,16 @@
 2014-06-11  David Kilzer  <[email protected]>
 
+        Viewport arguments should ignore invalid characters in values
+        <http://webkit.org/b/133555>
+        <rdar://problem/17179650>
+
+        Reviewed by Daniel Bates.
+
+        * fast/viewport/viewport-warnings-7-expected.txt: Added.
+        * fast/viewport/viewport-warnings-7.html: Added.
+
+2014-06-11  David Kilzer  <[email protected]>
+
         [iOS] Enable fast/viewport tests
         <http://webkit.org/b/133754>
 

Added: trunk/LayoutTests/fast/viewport/viewport-warnings-7-expected.txt (0 => 169848)


--- trunk/LayoutTests/fast/viewport/viewport-warnings-7-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/viewport-warnings-7-expected.txt	2014-06-11 22:40:59 UTC (rev 169848)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 5: Viewport argument value "123i̇" for key "width" was truncated to its numeric prefix.
+ALERT: viewport size 123x135.3 scale 2.60163 with limits [2.60163, 5] and userScalable true
+

Added: trunk/LayoutTests/fast/viewport/viewport-warnings-7.html (0 => 169848)


--- trunk/LayoutTests/fast/viewport/viewport-warnings-7.html	                        (rev 0)
+++ trunk/LayoutTests/fast/viewport/viewport-warnings-7.html	2014-06-11 22:40:59 UTC (rev 169848)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Invalid value should be truncated.</title>
+    <meta name="viewport" content="width=123&#x0130;">
+    <script>
+        function test() {
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                alert(internals.configurationForViewport(1, 320, 480, 320, 352));
+            }
+        }
+    </script>
+</head>
+<body _onload_="test();">
+</body>
+</html>

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


--- trunk/Source/WebCore/ChangeLog	2014-06-11 22:34:05 UTC (rev 169847)
+++ trunk/Source/WebCore/ChangeLog	2014-06-11 22:40:59 UTC (rev 169848)
@@ -1,3 +1,19 @@
+2014-06-11  David Kilzer  <[email protected]>
+
+        Viewport arguments should ignore invalid characters in values
+        <http://webkit.org/b/133555>
+        <rdar://problem/17179650>
+
+        Reviewed by Daniel Bates.
+
+        Test: fast/viewport/viewport-warnings-7.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::processArguments): 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  Anders Carlsson  <[email protected]>
 
         Move some HTTP header field accessors to ResourceRequestBase.cpp

Modified: trunk/Source/WebCore/dom/Document.cpp (169847 => 169848)


--- trunk/Source/WebCore/dom/Document.cpp	2014-06-11 22:34:05 UTC (rev 169847)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-06-11 22:40:59 UTC (rev 169848)
@@ -2858,13 +2858,12 @@
 void Document::processArguments(const String& features, void* data, ArgumentsCallback callback)
 {
     // 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 (isSeparator(buffer[i])) {
             if (i >= length)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to