Diff
Modified: trunk/Source/WebKit2/ChangeLog (204613 => 204614)
--- trunk/Source/WebKit2/ChangeLog 2016-08-18 23:03:47 UTC (rev 204613)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-18 23:11:05 UTC (rev 204614)
@@ -1,3 +1,35 @@
+2016-08-18 Dan Bernstein <[email protected]>
+
+ [Cocoa] API::Number needs to be wrapped by an NSNumber
+ https://bugs.webkit.org/show_bug.cgi?id=160977
+ <rdar://problem/27877735>
+
+ Reviewed by Anders Carlsson.
+
+ We introduce a single WKNSNumber class to wrap three distinct API::Number instantiations
+ corresponding to the Boolean, UInt64 and Double types.
+
+ Test: TestWebKitAPI/Tests/WebKit2Cocoa/WKNSNumber.mm
+
+ * Shared/Cocoa/APIObject.mm:
+ (API::Object::newObject): Create a WKNSNumber to contain any of the number types, and set
+ its _type ivar accordingly.
+ * Shared/Cocoa/WKNSNumber.h: Added.
+ (WebKit::wrapper):
+ * Shared/Cocoa/WKNSNumber.mm: Added.
+ (-[WKNSNumber dealloc]): Call the appropriate destructor.
+ (-[WKNSNumber objCType]): Implement this NSValue primitive method.
+ (-[WKNSNumber getValue:]): Ditto.
+ (-[WKNSNumber boolValue]): Implement this NSNumber method corresponding to one of our
+ possible types.
+ (-[WKNSNumber doubleValue]): Ditto.
+ (-[WKNSNumber unsignedLongLongValue]): Ditto.
+ (-[WKNSNumber copyWithZone:]): Implement this NSCopying method by retaining self.
+ (-[WKNSNumber _apiObject]): Implement this WKObject method by returning the appropriate
+ API object.
+
+ * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
+
2016-08-18 Andy Estes <[email protected]>
[Cocoa] Add SPI to WKProcessPool for enabling cookie storage partitioning
Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (204613 => 204614)
--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2016-08-18 23:03:47 UTC (rev 204613)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm 2016-08-18 23:11:05 UTC (rev 204614)
@@ -38,6 +38,7 @@
#import "WKNSData.h"
#import "WKNSDictionary.h"
#import "WKNSError.h"
+#import "WKNSNumber.h"
#import "WKNSString.h"
#import "WKNSURL.h"
#import "WKNSURLAuthenticationChallenge.h"
@@ -116,6 +117,13 @@
wrapper = [WKBackForwardListItem alloc];
break;
+ case Type::Boolean:
+ case Type::Double:
+ case Type::UInt64:
+ wrapper = [WKNSNumber alloc];
+ ((WKNSNumber *)wrapper)->_type = type;
+ break;
+
case Type::Bundle:
wrapper = [WKWebProcessPlugInController alloc];
break;
Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.h (0 => 204614)
--- trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.h (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.h 2016-08-18 23:11:05 UTC (rev 204614)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKFoundation.h"
+
+#if WK_API_ENABLED
+
+#import "APINumber.h"
+#import "WKObject.h"
+
+namespace WebKit {
+template<typename NumberType, API::Object::Type APIObjectType>
+inline NSNumber *wrapper(API::Number<NumberType, APIObjectType>& number) { ASSERT([number.wrapper() isKindOfClass:[NSNumber class]]); return (NSNumber *)number.wrapper(); }
+}
+
+@interface WKNSNumber : NSNumber <WKObject> {
+@package
+ API::Object::Type _type;
+}
+@end
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.mm (0 => 204614)
--- trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.mm (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/WKNSNumber.mm 2016-08-18 23:11:05 UTC (rev 204614)
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WKNSNumber.h"
+
+#if WK_API_ENABLED
+
+using namespace WebKit;
+
+@implementation WKNSNumber {
+ union {
+ API::ObjectStorage<API::Boolean> _boolean;
+ API::ObjectStorage<API::Double> _double;
+ API::ObjectStorage<API::UInt64> _uint64;
+ } _number;
+}
+
+- (void)dealloc
+{
+ switch (_type) {
+ case API::Object::Type::Boolean:
+ _number._boolean->~Number<bool, API::Object::Type::Boolean>();
+ break;
+
+ case API::Object::Type::Double:
+ _number._double->~Number<double, API::Object::Type::Double>();
+ break;
+
+ case API::Object::Type::UInt64:
+ _number._uint64->~Number<uint64_t, API::Object::Type::UInt64>();
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ [super dealloc];
+}
+
+// MARK: NSValue primitive methods
+
+- (const char *)objCType
+{
+ switch (_type) {
+ case API::Object::Type::Boolean:
+ return @encode(bool);
+ break;
+
+ case API::Object::Type::Double:
+ return @encode(double);
+ break;
+
+ case API::Object::Type::UInt64:
+ return @encode(uint64_t);
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return nullptr;
+}
+
+- (void)getValue:(void *)value
+{
+ switch (_type) {
+ case API::Object::Type::Boolean:
+ *reinterpret_cast<bool*>(value) = _number._boolean->value();
+ break;
+
+ case API::Object::Type::Double:
+ *reinterpret_cast<double*>(value) = _number._double->value();
+ break;
+
+ case API::Object::Type::UInt64:
+ *reinterpret_cast<uint64_t*>(value) = _number._uint64->value();
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+// MARK: NSNumber primitive methods
+
+- (BOOL)boolValue
+{
+ if (_type == API::Object::Type::Boolean)
+ return _number._boolean->value();
+
+ return super.boolValue;
+}
+
+- (double)doubleValue
+{
+ if (_type == API::Object::Type::Double)
+ return _number._double->value();
+
+ return super.doubleValue;
+}
+
+- (unsigned long long)unsignedLongLongValue
+{
+ if (_type == API::Object::Type::UInt64)
+ return _number._uint64->value();
+
+ return super.unsignedLongLongValue;
+}
+
+// MARK: NSCopying protocol implementation
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return [self retain];
+}
+
+// MARK: WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+ switch (_type) {
+ case API::Object::Type::Boolean:
+ return *_number._boolean;
+ break;
+
+ case API::Object::Type::Double:
+ return *_number._double;
+ break;
+
+ case API::Object::Type::UInt64:
+ return *_number._uint64;
+ break;
+
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return *_number._boolean;
+}
+
+@end
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (204613 => 204614)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-18 23:03:47 UTC (rev 204613)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-18 23:11:05 UTC (rev 204614)
@@ -792,6 +792,8 @@
3743925818BC4C60001C8675 /* WKUIDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
374436881820E7240049579F /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374436871820E7240049579F /* WKObject.mm */; };
3754D5451B3A29FD003A4C7F /* NSInvocationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */; };
+ 375E0E131D66432700EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E111D66432700EFEC2C /* WKNSNumber.mm */; };
+ 375E0E141D66432700EFEC2C /* WKNSNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 375E0E121D66432700EFEC2C /* WKNSNumber.h */; };
3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3760881C150413E900FC82C7 /* WebRenderObject.cpp */; };
3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760881D150413E900FC82C7 /* WebRenderObject.h */; };
37608822150414F700FC82C7 /* WKRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37608820150414F700FC82C7 /* WKRenderObject.cpp */; };
@@ -2836,6 +2838,8 @@
3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUIDelegatePrivate.h; sourceTree = "<group>"; };
374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
3754D5441B3A29FD003A4C7F /* NSInvocationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSInvocationSPI.h; sourceTree = "<group>"; };
+ 375E0E111D66432700EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; };
+ 375E0E121D66432700EFEC2C /* WKNSNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSNumber.h; sourceTree = "<group>"; };
375FB4731883415600BE34D4 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
3760881C150413E900FC82C7 /* WebRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebRenderObject.cpp; sourceTree = "<group>"; };
3760881D150413E900FC82C7 /* WebRenderObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebRenderObject.h; sourceTree = "<group>"; };
@@ -5301,6 +5305,8 @@
371A193F1824D29300F32A5E /* WKNSDictionary.mm */,
372CAF091833FD910040AC27 /* WKNSError.h */,
372CAF0A1833FD910040AC27 /* WKNSError.mm */,
+ 375E0E121D66432700EFEC2C /* WKNSNumber.h */,
+ 375E0E111D66432700EFEC2C /* WKNSNumber.mm */,
378E1A4818208CD60031007A /* WKNSString.h */,
378E1A4718208CD60031007A /* WKNSString.mm */,
378E1A4C18208D700031007A /* WKNSURL.h */,
@@ -7827,6 +7833,7 @@
1A60224D18C16B9F00C3E8C9 /* VisitedLinkStoreMessages.h in Headers */,
37B47E2D1D64DB76005F4EFF /* objcSPI.h in Headers */,
1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */,
+ 375E0E141D66432700EFEC2C /* WKNSNumber.h in Headers */,
1AF4CEF018BC481800BC2D34 /* VisitedLinkTableController.h in Headers */,
1A8E7D3D18C15149005A702A /* VisitedLinkTableControllerMessages.h in Headers */,
1AA9BAE1184FFAC7003B6BC6 /* WeakObjCPtr.h in Headers */,
@@ -9140,6 +9147,7 @@
831EEBBE1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.cpp in Sources */,
832AE2531BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.cpp in Sources */,
83BDCCB91AC5FDB6003F6441 /* NetworkCacheStatistics.cpp in Sources */,
+ 375E0E131D66432700EFEC2C /* WKNSNumber.mm in Sources */,
E4436ED01A0D040B00EAD204 /* NetworkCacheStorage.cpp in Sources */,
8310428C1BD6B66F00A715E4 /* NetworkCacheSubresourcesEntry.cpp in Sources */,
513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
Modified: trunk/Tools/ChangeLog (204613 => 204614)
--- trunk/Tools/ChangeLog 2016-08-18 23:03:47 UTC (rev 204613)
+++ trunk/Tools/ChangeLog 2016-08-18 23:11:05 UTC (rev 204614)
@@ -1,3 +1,15 @@
+2016-08-18 Dan Bernstein <[email protected]>
+
+ [Cocoa] API::Number needs to be wrapped by an NSNumber
+ https://bugs.webkit.org/show_bug.cgi?id=160977
+ <rdar://problem/27877735>
+
+ Reviewed by Anders Carlsson.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WKNSNumber.mm: Added.
+ (TestWebKitAPI::TEST):
+
2016-08-17 Myles C. Maxfield <[email protected]>
[Cocoa] Migrate off of deprecated CoreGraphics API CGContextSelectFont() and CGContextShowTextAtPoint()
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (204613 => 204614)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-08-18 23:03:47 UTC (rev 204613)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-08-18 23:11:05 UTC (rev 204614)
@@ -67,6 +67,7 @@
33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
+ 375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E151D66674400EFEC2C /* WKNSNumber.mm */; };
378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
@@ -743,6 +744,7 @@
33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = "<group>"; };
+ 375E0E151D66674400EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; };
3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; };
378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest.cpp; sourceTree = "<group>"; };
378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest_Bundle.cpp; sourceTree = "<group>"; };
@@ -1299,6 +1301,7 @@
93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */,
1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */,
+ 375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
5E4B1D2C1D404C6100053621 /* WKScrollViewDelegateCrash.mm */,
@@ -2211,6 +2214,7 @@
7CCE7EF11A411AE600447C4C /* FailedLoad.cpp in Sources */,
7C83E04F1D0A641800FEBCF3 /* FileSystem.cpp in Sources */,
7CCE7EF31A411AE600447C4C /* Find.cpp in Sources */,
+ 375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */,
7C83E0BB1D0A650000FEBCF3 /* FindInPage.mm in Sources */,
7CCE7EF41A411AE600447C4C /* FindMatches.mm in Sources */,
7C83E0401D0A63E300FEBCF3 /* FirstResponderScrollingPosition.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKNSNumber.mm (0 => 204614)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKNSNumber.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKNSNumber.mm 2016-08-18 23:11:05 UTC (rev 204614)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED && WK_HAVE_C_SPI
+
+#import <WebKit/WKNumber.h>
+#import <WebKit/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit2, WKNSNumber)
+{
+ auto booleanRef = adoptWK(WKBooleanCreate(true));
+ auto uint64Ref = adoptWK(WKUInt64Create(39));
+ auto doubleRef = adoptWK(WKDoubleCreate(-16.2));
+
+ NSNumber *booleanNumber = (NSNumber *)booleanRef.get();
+ NSNumber *uint64Number = (NSNumber *)uint64Ref.get();
+ NSNumber *doubleNumber = (NSNumber *)doubleRef.get();
+
+ EXPECT_EQ(YES, booleanNumber.boolValue);
+ EXPECT_EQ(39UL, uint64Number.unsignedLongLongValue);
+ EXPECT_EQ(39, uint64Number.intValue);
+ EXPECT_EQ(-16.2, doubleNumber.doubleValue);
+}
+
+} // namespace TestWebKitAPI
+
+#endif