Title: [197237] trunk
Revision
197237
Author
[email protected]
Date
2016-02-26 22:09:37 -0800 (Fri, 26 Feb 2016)

Log Message

Fix the behavior of reflecting IDL attributes of type unsigned long
https://bugs.webkit.org/show_bug.cgi?id=154771

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline now that more checks are passing.

* web-platform-tests/html/dom/reflection-embedded-expected.txt:
* web-platform-tests/html/dom/reflection-obsolete-expected.txt:

Source/WebCore:

Fix the behavior of reflecting IDL attributes of type unsigned long to
align with the specification:
- https://html.spec.whatwg.org/multipage/infrastructure.html#reflecting-content-attributes-in-idl-attributes
- https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers

Firefox and Chrome already follow the specification.

There were several issues with our implementation, which are all
addressed in this patch:
- Upon getting, the value returned must be in the range 0 to 2147483647.
  Otherwise, we must return the default value (0 unless specified
  otherwise). We previously returned values in the range 0 to 4294967295
  instead.
- Upon setting, we must set the content attribute to the default value
  (0 unless specified otherwise) if the input value is not in the range
  0 to 2147483647. We previously allowed values in the range 0 to
  4294967295 instead.
- "-0" was not recognized as a valid unsigned integer

Test: fast/dom/reflect-unsigned-long.html

* dom/Element.cpp:
(WebCore::Element::setUnsignedIntegralAttribute):
Update setUnsignedIntegralAttribute() to limit the input value in the
0 to 2147483647 range, as per the HTML specification. This method is
called by the bindings implementation of reflecting attributes setters.

* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLNonNegativeInteger):
Update parseHTMLNonNegativeInteger() to call parseHTMLInteger() instead
of duplicating most of its code and fail if the value returned is
negative. This matches the algorithm in the specification:
- https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers

This has 2 behavior changes:
1. "-0" is now correctly parsed as 0.
2. The returned values are in the range 0 to 2147483647.

* html/parser/HTMLParserIdioms.h:
(WebCore::limitToOnlyHTMLNonNegativeNumbersGreaterThanZero):
(WebCore::limitToOnlyHTMLNonNegative):
Drop the checks for "<= 2147483647" and replace with an assertion
now that parseHTMLNonNegativeInteger() already returned values in
the right range.

Tools:

Update API tests to cover the fixes to the parseHTMLNonNegativeInteger()
implementation:
- "-0" is parsed as 0.
- Range boundaries are now [0; 2147483647].

* TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:
(TestWebKitAPI::TEST):

LayoutTests:

Add test coverage for the behavior of reflecting IDL attributes of type
unsigned long.

* fast/dom/reflect-unsigned-long-expected.txt: Added.
* fast/dom/reflect-unsigned-long.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197236 => 197237)


--- trunk/LayoutTests/ChangeLog	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/LayoutTests/ChangeLog	2016-02-27 06:09:37 UTC (rev 197237)
@@ -1,3 +1,16 @@
+2016-02-26  Chris Dumez  <[email protected]>
+
+        Fix the behavior of reflecting IDL attributes of type unsigned long
+        https://bugs.webkit.org/show_bug.cgi?id=154771
+
+        Reviewed by Ryosuke Niwa.
+
+        Add test coverage for the behavior of reflecting IDL attributes of type
+        unsigned long.
+
+        * fast/dom/reflect-unsigned-long-expected.txt: Added.
+        * fast/dom/reflect-unsigned-long.html: Added.
+
 2016-02-26  Zalan Bujtas  <[email protected]>
 
         REGRESSION (188611): Search field Cancel button should not overlap search text on extensions page.

Added: trunk/LayoutTests/fast/dom/reflect-unsigned-long-expected.txt (0 => 197237)


--- trunk/LayoutTests/fast/dom/reflect-unsigned-long-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/reflect-unsigned-long-expected.txt	2016-02-27 06:09:37 UTC (rev 197237)
@@ -0,0 +1,65 @@
+This tests covers the behavior of reflecting IDL attributes of type unsigned long
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+* Default value
+PASS video.getAttribute('width') is null
+PASS video.width is 0
+
+* Regular value
+video.setAttribute('width', '123')
+PASS video.getAttribute('width') is "123"
+PASS video.width is 123
+video.width = 123
+PASS video.getAttribute('width') is "123"
+PASS video.width is 123
+
+* Boundary
+video.setAttribute('width', '2147483647')
+PASS video.getAttribute('width') is "2147483647"
+PASS video.width is 2147483647
+video.width = 2147483647
+PASS video.getAttribute('width') is "2147483647"
+PASS video.width is 2147483647
+
+* Out of range value
+video.setAttribute('width', '2147483649')
+PASS video.getAttribute('width') is "2147483649"
+PASS video.width is 0
+video.width = 2147483649
+PASS video.getAttribute('width') is "0"
+PASS video.width is 0
+
+* Default value
+PASS video.getAttribute('height') is null
+PASS video.height is 0
+
+* Regular value
+video.setAttribute('height', '123')
+PASS video.getAttribute('height') is "123"
+PASS video.height is 123
+video.height = 123
+PASS video.getAttribute('height') is "123"
+PASS video.height is 123
+
+* Boundary
+video.setAttribute('height', '2147483647')
+PASS video.getAttribute('height') is "2147483647"
+PASS video.height is 2147483647
+video.height = 2147483647
+PASS video.getAttribute('height') is "2147483647"
+PASS video.height is 2147483647
+
+* Out of range value
+video.setAttribute('height', '2147483649')
+PASS video.getAttribute('height') is "2147483649"
+PASS video.height is 0
+video.height = 2147483649
+PASS video.getAttribute('height') is "0"
+PASS video.height is 0
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/reflect-unsigned-long.html (0 => 197237)


--- trunk/LayoutTests/fast/dom/reflect-unsigned-long.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/reflect-unsigned-long.html	2016-02-27 06:09:37 UTC (rev 197237)
@@ -0,0 +1,73 @@
+<script src=""
+<script>
+description("This tests covers the behavior of reflecting IDL attributes of type unsigned long");
+// https://html.spec.whatwg.org/multipage/infrastructure.html#reflecting-content-attributes-in-idl-attributes
+
+var video = document.createElement("video");
+
+debug("* Default value");
+shouldBeNull("video.getAttribute('width')");
+shouldBe("video.width", "0");
+
+debug("");
+debug("* Regular value");
+evalAndLog("video.setAttribute('width', '123')");
+shouldBeEqualToString("video.getAttribute('width')", "123");
+shouldBe("video.width", "123");
+evalAndLog("video.width = 123");
+shouldBeEqualToString("video.getAttribute('width')", "123");
+shouldBe("video.width", "123");
+
+debug("");
+debug("* Boundary");
+evalAndLog("video.setAttribute('width', '2147483647')");
+shouldBeEqualToString("video.getAttribute('width')", "2147483647");
+shouldBe("video.width", "2147483647");
+evalAndLog("video.width = 2147483647");
+shouldBeEqualToString("video.getAttribute('width')", "2147483647");
+shouldBe("video.width", "2147483647");
+
+debug("");
+debug("* Out of range value");
+evalAndLog("video.setAttribute('width', '2147483649')");
+shouldBeEqualToString("video.getAttribute('width')", "2147483649");
+shouldBe("video.width", "0");
+evalAndLog("video.width = 2147483649");
+shouldBeEqualToString("video.getAttribute('width')", "0");
+shouldBe("video.width", "0");
+
+debug("");
+debug("* Default value");
+shouldBeNull("video.getAttribute('height')");
+shouldBe("video.height", "0");
+
+debug("");
+debug("* Regular value");
+evalAndLog("video.setAttribute('height', '123')");
+shouldBeEqualToString("video.getAttribute('height')", "123");
+shouldBe("video.height", "123");
+evalAndLog("video.height = 123");
+shouldBeEqualToString("video.getAttribute('height')", "123");
+shouldBe("video.height", "123");
+
+debug("");
+debug("* Boundary");
+evalAndLog("video.setAttribute('height', '2147483647')");
+shouldBeEqualToString("video.getAttribute('height')", "2147483647");
+shouldBe("video.height", "2147483647");
+evalAndLog("video.height = 2147483647");
+shouldBeEqualToString("video.getAttribute('height')", "2147483647");
+shouldBe("video.height", "2147483647");
+
+debug("");
+debug("* Out of range value");
+evalAndLog("video.setAttribute('height', '2147483649')");
+shouldBeEqualToString("video.getAttribute('height')", "2147483649");
+shouldBe("video.height", "0");
+evalAndLog("video.height = 2147483649");
+shouldBeEqualToString("video.getAttribute('height')", "0");
+shouldBe("video.height", "0");
+
+debug("");
+</script>
+<script src=""

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (197236 => 197237)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-02-27 06:09:37 UTC (rev 197237)
@@ -1,3 +1,15 @@
+2016-02-26  Chris Dumez  <[email protected]>
+
+        Fix the behavior of reflecting IDL attributes of type unsigned long
+        https://bugs.webkit.org/show_bug.cgi?id=154771
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline now that more checks are passing.
+
+        * web-platform-tests/html/dom/reflection-embedded-expected.txt:
+        * web-platform-tests/html/dom/reflection-obsolete-expected.txt:
+
 2016-02-26  Youenn Fablet  <[email protected]>
 
         Sync web-platform-tests up to revision 5ca8b46

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt (197236 => 197237)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt	2016-02-27 06:09:37 UTC (rev 197237)
@@ -9743,10 +9743,10 @@
 PASS video.width: IDL set to "-0" followed by getAttribute() 
 PASS video.width: IDL set to "-0" followed by IDL get 
 PASS video.width: IDL set to 2147483648 should not throw 
-FAIL video.width: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "0" but got "2147483648"
+PASS video.width: IDL set to 2147483648 followed by getAttribute() 
 PASS video.width: IDL set to 2147483648 followed by IDL get 
 PASS video.width: IDL set to 4294967295 should not throw 
-FAIL video.width: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "0" but got "4294967295"
+PASS video.width: IDL set to 4294967295 followed by getAttribute() 
 PASS video.width: IDL set to 4294967295 followed by IDL get 
 PASS video.height: typeof IDL attribute 
 PASS video.height: IDL get with DOM attribute unset 
@@ -9872,10 +9872,10 @@
 PASS video.height: IDL set to "-0" followed by getAttribute() 
 PASS video.height: IDL set to "-0" followed by IDL get 
 PASS video.height: IDL set to 2147483648 should not throw 
-FAIL video.height: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "0" but got "2147483648"
+PASS video.height: IDL set to 2147483648 followed by getAttribute() 
 PASS video.height: IDL set to 2147483648 followed by IDL get 
 PASS video.height: IDL set to 4294967295 should not throw 
-FAIL video.height: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "0" but got "4294967295"
+PASS video.height: IDL set to 4294967295 followed by getAttribute() 
 PASS video.height: IDL set to 4294967295 followed by IDL get 
 PASS video.poster: typeof IDL attribute 
 PASS video.poster: IDL get with DOM attribute unset 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-obsolete-expected.txt (197236 => 197237)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-obsolete-expected.txt	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-obsolete-expected.txt	2016-02-27 06:09:37 UTC (rev 197237)
@@ -2771,10 +2771,10 @@
 PASS marquee.hspace: IDL set to "-0" followed by getAttribute() 
 PASS marquee.hspace: IDL set to "-0" followed by IDL get 
 PASS marquee.hspace: IDL set to 2147483648 should not throw 
-FAIL marquee.hspace: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "0" but got "2147483648"
+PASS marquee.hspace: IDL set to 2147483648 followed by getAttribute() 
 PASS marquee.hspace: IDL set to 2147483648 followed by IDL get 
 PASS marquee.hspace: IDL set to 4294967295 should not throw 
-FAIL marquee.hspace: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "0" but got "4294967295"
+PASS marquee.hspace: IDL set to 4294967295 followed by getAttribute() 
 PASS marquee.hspace: IDL set to 4294967295 followed by IDL get 
 PASS marquee.scrollAmount: typeof IDL attribute 
 PASS marquee.scrollAmount: IDL get with DOM attribute unset 
@@ -3229,10 +3229,10 @@
 PASS marquee.vspace: IDL set to "-0" followed by getAttribute() 
 PASS marquee.vspace: IDL set to "-0" followed by IDL get 
 PASS marquee.vspace: IDL set to 2147483648 should not throw 
-FAIL marquee.vspace: IDL set to 2147483648 followed by getAttribute() assert_equals: expected "0" but got "2147483648"
+PASS marquee.vspace: IDL set to 2147483648 followed by getAttribute() 
 PASS marquee.vspace: IDL set to 2147483648 followed by IDL get 
 PASS marquee.vspace: IDL set to 4294967295 should not throw 
-FAIL marquee.vspace: IDL set to 4294967295 followed by getAttribute() assert_equals: expected "0" but got "4294967295"
+PASS marquee.vspace: IDL set to 4294967295 followed by getAttribute() 
 PASS marquee.vspace: IDL set to 4294967295 followed by IDL get 
 PASS marquee.width: typeof IDL attribute 
 PASS marquee.width: IDL get with DOM attribute unset 

Modified: trunk/Source/WebCore/ChangeLog (197236 => 197237)


--- trunk/Source/WebCore/ChangeLog	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Source/WebCore/ChangeLog	2016-02-27 06:09:37 UTC (rev 197237)
@@ -1,3 +1,55 @@
+2016-02-26  Chris Dumez  <[email protected]>
+
+        Fix the behavior of reflecting IDL attributes of type unsigned long
+        https://bugs.webkit.org/show_bug.cgi?id=154771
+
+        Reviewed by Ryosuke Niwa.
+
+        Fix the behavior of reflecting IDL attributes of type unsigned long to
+        align with the specification:
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#reflecting-content-attributes-in-idl-attributes
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers
+
+        Firefox and Chrome already follow the specification.
+
+        There were several issues with our implementation, which are all
+        addressed in this patch:
+        - Upon getting, the value returned must be in the range 0 to 2147483647.
+          Otherwise, we must return the default value (0 unless specified
+          otherwise). We previously returned values in the range 0 to 4294967295
+          instead.
+        - Upon setting, we must set the content attribute to the default value
+          (0 unless specified otherwise) if the input value is not in the range
+          0 to 2147483647. We previously allowed values in the range 0 to
+          4294967295 instead.
+        - "-0" was not recognized as a valid unsigned integer
+
+        Test: fast/dom/reflect-unsigned-long.html
+
+        * dom/Element.cpp:
+        (WebCore::Element::setUnsignedIntegralAttribute):
+        Update setUnsignedIntegralAttribute() to limit the input value in the
+        0 to 2147483647 range, as per the HTML specification. This method is
+        called by the bindings implementation of reflecting attributes setters.
+
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::parseHTMLNonNegativeInteger):
+        Update parseHTMLNonNegativeInteger() to call parseHTMLInteger() instead
+        of duplicating most of its code and fail if the value returned is
+        negative. This matches the algorithm in the specification:
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers
+
+        This has 2 behavior changes:
+        1. "-0" is now correctly parsed as 0.
+        2. The returned values are in the range 0 to 2147483647.
+
+        * html/parser/HTMLParserIdioms.h:
+        (WebCore::limitToOnlyHTMLNonNegativeNumbersGreaterThanZero):
+        (WebCore::limitToOnlyHTMLNonNegative):
+        Drop the checks for "<= 2147483647" and replace with an assertion
+        now that parseHTMLNonNegativeInteger() already returned values in
+        the right range.
+
 2016-02-26  Zalan Bujtas  <[email protected]>
 
         REGRESSION (188611): Search field Cancel button should not overlap search text on extensions page.

Modified: trunk/Source/WebCore/dom/Element.cpp (197236 => 197237)


--- trunk/Source/WebCore/dom/Element.cpp	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Source/WebCore/dom/Element.cpp	2016-02-27 06:09:37 UTC (rev 197237)
@@ -2784,7 +2784,7 @@
 
 void Element::setUnsignedIntegralAttribute(const QualifiedName& attributeName, unsigned value)
 {
-    setAttribute(attributeName, AtomicString::number(value));
+    setAttribute(attributeName, AtomicString::number(limitToOnlyHTMLNonNegative(value)));
 }
 
 #if ENABLE(INDIE_UI)

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (197236 => 197237)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2016-02-27 06:09:37 UTC (rev 197237)
@@ -203,7 +203,7 @@
     return ok;
 }
 
-// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-integers
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers
 bool parseHTMLInteger(const String& input, int& value)
 {
     // Step 1
@@ -218,67 +218,17 @@
     return parseHTMLIntegerInternal(start, start + length, value);
 }
 
-template <typename CharacterType>
-static bool parseHTMLNonNegativeIntegerInternal(const CharacterType* position, const CharacterType* end, unsigned& value)
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-non-negative-integers
+bool parseHTMLNonNegativeInteger(const String& input, unsigned& value)
 {
-    // Step 3
-    while (position < end) {
-        if (!isHTMLSpace(*position))
-            break;
-        ++position;
-    }
-
-    // Step 4
-    if (position == end)
+    int signedValue;
+    if (!parseHTMLInteger(input, signedValue) || signedValue < 0)
         return false;
-    ASSERT_WITH_SECURITY_IMPLICATION(position < end);
 
-    // Step 5
-    if (*position == '+')
-        ++position;
-
-    // Step 6
-    if (position == end)
-        return false;
-    ASSERT_WITH_SECURITY_IMPLICATION(position < end);
-
-    // Step 7
-    if (!isASCIIDigit(*position))
-        return false;
-
-    // Step 8
-    StringBuilder digits;
-    while (position < end) {
-        if (!isASCIIDigit(*position))
-            break;
-        digits.append(*position++);
-    }
-
-    // Step 9
-    bool ok;
-    if (digits.is8Bit())
-        value = charactersToUIntStrict(digits.characters8(), digits.length(), &ok);
-    else
-        value = charactersToUIntStrict(digits.characters16(), digits.length(), &ok);
-    return ok;
+    value = signedValue;
+    return true;
 }
 
-
-// http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers
-bool parseHTMLNonNegativeInteger(const String& input, unsigned& value)
-{
-    // Step 1
-    // Step 2
-    unsigned length = input.length();
-    if (!length || input.is8Bit()) {
-        const LChar* start = input.characters8();
-        return parseHTMLNonNegativeIntegerInternal(start, start + length, value);
-    }
-    
-    const UChar* start = input.characters16();
-    return parseHTMLNonNegativeIntegerInternal(start, start + length, value);
-}
-
 static bool threadSafeEqual(const StringImpl& a, const StringImpl& b)
 {
     if (&a == &b)

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (197236 => 197237)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h	2016-02-27 06:09:37 UTC (rev 197237)
@@ -41,6 +41,9 @@
 bool isNotHTMLSpace(UChar);
 bool isHTMLSpaceButNotLineBreak(UChar);
 
+// 2147483647 is 2^31 - 1.
+static const unsigned maxHTMLNonNegativeInteger = 2147483647;
+
 // Strip leading and trailing whitespace as defined by the HTML specification. 
 WEBCORE_EXPORT String stripLeadingAndTrailingHTMLSpaces(const String&);
 
@@ -112,27 +115,31 @@
 // https://html.spec.whatwg.org/multipage/infrastructure.html#limited-to-only-non-negative-numbers-greater-than-zero
 inline unsigned limitToOnlyHTMLNonNegativeNumbersGreaterThanZero(unsigned value, unsigned defaultValue = 1)
 {
-    return (value > 0 && value <= 2147483647) ? value : defaultValue;
+    return (value > 0 && value <= maxHTMLNonNegativeInteger) ? value : defaultValue;
 }
 
 inline unsigned limitToOnlyHTMLNonNegativeNumbersGreaterThanZero(const String& stringValue, unsigned defaultValue = 1)
 {
-    unsigned value = defaultValue;
-    parseHTMLNonNegativeInteger(stringValue, value);
-    return limitToOnlyHTMLNonNegativeNumbersGreaterThanZero(value, defaultValue);
+    unsigned value;
+    if (!parseHTMLNonNegativeInteger(stringValue, value) || !value)
+        value = defaultValue;
+    ASSERT(value > 0 && value <= maxHTMLNonNegativeInteger);
+    return value;
 }
 
 // https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes:idl-unsigned-long
 inline unsigned limitToOnlyHTMLNonNegative(unsigned value, unsigned defaultValue = 0)
 {
-    return value <= 2147483647 ? value : defaultValue;
+    return value <= maxHTMLNonNegativeInteger ? value : defaultValue;
 }
 
 inline unsigned limitToOnlyHTMLNonNegative(const String& stringValue, unsigned defaultValue = 0)
 {
-    unsigned value = defaultValue;
-    parseHTMLNonNegativeInteger(stringValue, value);
-    return limitToOnlyHTMLNonNegative(value, defaultValue);
+    unsigned value;
+    if (!parseHTMLNonNegativeInteger(stringValue, value))
+        value = defaultValue;
+    ASSERT(value <= maxHTMLNonNegativeInteger);
+    return value;
 }
 
 }

Modified: trunk/Tools/ChangeLog (197236 => 197237)


--- trunk/Tools/ChangeLog	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Tools/ChangeLog	2016-02-27 06:09:37 UTC (rev 197237)
@@ -1,3 +1,18 @@
+2016-02-26  Chris Dumez  <[email protected]>
+
+        Fix the behavior of reflecting IDL attributes of type unsigned long
+        https://bugs.webkit.org/show_bug.cgi?id=154771
+
+        Reviewed by Ryosuke Niwa.
+
+        Update API tests to cover the fixes to the parseHTMLNonNegativeInteger()
+        implementation:
+        - "-0" is parsed as 0.
+        - Range boundaries are now [0; 2147483647].
+
+        * TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:
+        (TestWebKitAPI::TEST):
+
 2016-02-26  Brady Eidson  <[email protected]>
 
         Modern IDB: New database versions are never committed to SQLite.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp (197236 => 197237)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp	2016-02-27 05:51:22 UTC (rev 197236)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp	2016-02-27 06:09:37 UTC (rev 197237)
@@ -133,13 +133,13 @@
     // Boundaries.
     EXPECT_EQ(0u, testParseHTMLNonNegativeInteger("+0"));
     EXPECT_EQ(0u, testParseHTMLNonNegativeInteger("0"));
-    // FIXME: This should pass.
-    // EXPECT_EQ(0u, testParseHTMLNonNegativeInteger("-0"));
-    EXPECT_EQ(4294967295u, testParseHTMLNonNegativeInteger("4294967295"));
+    EXPECT_EQ(0u, testParseHTMLNonNegativeInteger("-0"));
+    EXPECT_EQ(2147483647u, testParseHTMLNonNegativeInteger("2147483647"));
 
     // Failure cases.
     EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("-1"));
-    EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("4294967296"));
+    EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("2147483648"));
+    EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("2147483649"));
     EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("111111111111111111"));
     EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("  -123"));
     EXPECT_TRUE(parseHTMLNonNegativeIntegerFails("-123"));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to