Bug 145563 - JSExport protocol with an NSInteger property converts negative values to 18446744073709552000
Summary: JSExport protocol with an NSInteger property converts negative values to 1844...
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2015-06-02 13:08 PDT by Keith Miller
Modified: 2015-06-02 15:14 PDT (History)
3 users (show)

See Also:

The Patch (3.01 KB, patch)
2015-06-02 13:23 PDT, Keith Miller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2015-06-02 13:08:26 PDT
Steps to Reproduce:
My code roughly looks like:

@protocol XXThingExports <JSExport>
@property (nonatomic) NSInteger level;

@interface XXThing : NSObject <XXThingExports>
@property (nonatomic) NSInteger level;

1. From Objective-C, set `level` to a negative value like -46.
2. Accessing the `level` property of an XXThing object from JavaScript gives 18446744073709552000.

Expected Results:
thing.level should be -46

Actual Results:
thing.level is 18446744073709552000
Comment 1 Keith Miller 2015-06-02 13:10:21 PDT
Comment 2 Keith Miller 2015-06-02 13:23:00 PDT
Created attachment 254089 [details]
The Patch
Comment 3 Darin Adler 2015-06-02 13:38:05 PDT
Comment on attachment 254089 [details]
The Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=254089&action=review

> Source/JavaScriptCore/API/tests/testapi.mm:1421
> +@property (nonatomic) NSInteger number;

What if the property is an NSUInteger? Could we add a test case that covers that?
Comment 4 WebKit Commit Bot 2015-06-02 14:24:34 PDT
Comment on attachment 254089 [details]
The Patch

Clearing flags on attachment: 254089

Committed r185122: <http://trac.webkit.org/changeset/185122>
Comment 5 WebKit Commit Bot 2015-06-02 14:24:36 PDT
All reviewed patches have been landed.  Closing bug.