Bug 34847 - [Qt] QScriptValue::toIntXX returns incorrect values
Summary: [Qt] QScriptValue::toIntXX returns incorrect values
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jędrzej Nowacki
Keywords: Qt
Depends on:
Blocks: 31863
  Show dependency treegraph
Reported: 2010-02-11 08:44 PST by Jędrzej Nowacki
Modified: 2010-02-15 04:08 PST (History)
1 user (show)

See Also:

test cases (23.92 KB, text/plain)
2010-02-11 08:44 PST, Jędrzej Nowacki
no flags Details
Fix v1 (32.22 KB, patch)
2010-02-11 09:18 PST, Jędrzej Nowacki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jędrzej Nowacki 2010-02-11 08:44:14 PST
Created attachment 48568 [details]
test cases

Functions; QScriptValue::toInteger(), QScriptValue::toInt32, QScriptValue::toUInt32, QScriptValue::toUInt16 don't compliance ECMA Script standard. There are a few edge cases that they return incorrect value. Examples are in the attachment.
Comment 1 Jędrzej Nowacki 2010-02-11 09:18:42 PST
Created attachment 48571 [details]
Fix v1
Comment 2 Simon Hausmann 2010-02-15 03:47:29 PST
Comment on attachment 48571 [details]
Fix v1

> +    return (result > 0) ? qFloor(result) : -1 * qFloor(-result);

I'd leave out the first pair of parentheses. The rest looks good to me.
Comment 3 WebKit Commit Bot 2010-02-15 04:08:49 PST
Comment on attachment 48571 [details]
Fix v1

Clearing flags on attachment: 48571

Committed r54773: <http://trac.webkit.org/changeset/54773>
Comment 4 WebKit Commit Bot 2010-02-15 04:08:54 PST
All reviewed patches have been landed.  Closing bug.