Bug 145563

Summary: JSExport protocol with an NSInteger property converts negative values to 18446744073709552000
Product: WebKit Reporter: Keith Miller <keith_miller>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, keith_miller, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
The Patch none

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;
@end

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

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
<rdar://problem/19123511>
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.