[Webkit-unassigned] [Bug 67537] Implement a ProgressEvent constructor for JSC

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 6 14:01:52 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=67537





--- Comment #5 from Sam Weinig <sam at webkit.org>  2011-09-06 14:01:51 PST ---
(In reply to comment #4)
> (From update of attachment 106224 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106224&action=review
> 
> >> LayoutTests/fast/events/constructors/progress-event-constructor.html:46
> >> +shouldBe("new ProgressEvent('eventType', { bubbles: true, cancelable: true, lengthComputable: true, loaded: 12345, total: 12345 }).total", "12345");
> > 
> > It might makes sense to test the edge cases for loaded or total, that is, values  values in the range [0, 18446744073709551615] (unsigned long long range), NaN, negative values, non-numeric values, object literals with valueOf functions, etc.
> 
> Sam: Thank you, but one question. When we pass 18446744073709551615, what should the result be?

I am not sure.  You should check the WebIDL spec.

> In the current implementation, 
> 
>     shouldBe("new ProgressEvent('eventType', { loaded: 18446744073709551615 }).loaded", "18446744073709551615");
> 
> results in
> 
>     FAIL new ProgressEvent('eventType', { loaded: 18446744073709551615 }).loaded should be 18446744073709552000. Was 0.
> 
> The reason why 'loaded' becomes 0 is as follows:
> (1) "18446744073709551615" is passed to JSDictionary::convertValue(), and then to JSValue::toInteger().
> (2) toNumber("18446744073709551615"), which is implemented in JSC, returns a double value 18446744073709551616.000000.
> (3) JSDictionary::convertValue() does static_cast of 18446744073709551616.000000 into an unsigned long long value, resulting in 0.
> 
> I do not investigate the reason why "18446744073709551615" is evaluated as 18446744073709552000, but anyway this conversion is done in JSC code.
> 
> Do we need to fix the JSC code so that it returns the exact value for 64bit integers?

I don't think there is anything to change in JSC, as in JavaScript, all numbers are doubles, so not all 64bit integers can be represented.  One think you can check with (though it also may be wrong) is what initProgressEvent() does.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list