Bug 38434

Summary: Use HTML5 number parsing in HTMLProgressElement
Product: WebKit Reporter: Yael <yael>
Component: DOMAssignee: Nobody <webkit-unassigned>
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Description Flags
darin: review-
Patch addressing comment #2. darin: review+

Description Yael 2010-05-02 07:07:33 PDT
Suggested in https://bugs.webkit.org/show_bug.cgi?id=38140#c12 and https://bugs.webkit.org/show_bug.cgi?id=38140#c15 to use the more strict HTML5 parsing code.
Comment 1 Yael 2010-05-02 07:21:07 PDT
Created attachment 54878 [details]
Comment 2 Darin Adler 2010-05-02 23:50:28 PDT
Comment on attachment 54878 [details]

> +        Use parseToDoubleForNumberType instead of toDouble.

Where are the tests for the behavior changes this creates? We require tests for any bug fixes. Or is this refactoring only?

> +        Throw an exception when the number is NaN or Infinity.

All the test changes seem to be for this independent half of the patch.

> +    if (isnan(value) || !isfinite(value)) {

The isnan check here is redundant and should be removed. The isfinite function returns false for NAN.

review- because of a lack of test for the HTML5 number parsing change and because the extra check should be omitted.
Comment 3 Yael 2010-05-03 06:05:31 PDT
Created attachment 54920 [details]
Patch addressing comment #2.

Add more tests for parseToDoubleForNumberType and remove redundant isnan().
Comment 4 Darin Adler 2010-05-03 08:19:18 PDT
Comment on attachment 54920 [details]
Patch addressing comment #2.

> +try {
>  p.value = "200A";
> -p.max = 100;
> -shouldBe("p.value", "0");
> -shouldBe("p.max", "100");
> -shouldBe("p.position", "0");
> +} catch (e) {
> +debug(e.message);
> +}

The shouldThrow function is a cleaner way to do a test like this.
Comment 5 Yael 2010-05-03 11:21:42 PDT
Committed r58687: <http://trac.webkit.org/changeset/58687>