[Cocoa] Only query for kMGQDeviceName on iOS
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 06:30:42 +0000 (06:30 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 06:30:42 +0000 (06:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150858

Reviewed by Brent Fulgham.

* platform/ios/Device.cpp:
(WebCore::deviceName): On non-iOS platorms, just return "iPhone" as the device name.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192010 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/ios/Device.cpp

index 037f4df413943e3e4a9e735ba4ba25d1bb14b3da..570af94c0f50c433abbdf54f9363b6e016e7f74b 100644 (file)
@@ -1,3 +1,13 @@
+2015-11-03  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] Only query for kMGQDeviceName on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=150858
+
+        Reviewed by Brent Fulgham.
+
+        * platform/ios/Device.cpp:
+        (WebCore::deviceName): On non-iOS platorms, just return "iPhone" as the device name.
+
 2015-11-03  Geoffrey Garen  <ggaren@apple.com>
 
         Provide a way to turn off const in WebKit2.
index a96b710a1edbde615ed1c2af0de8033851c7f212..e15d479259497084c7992b58fa6520b7a9c189de 100644 (file)
@@ -61,7 +61,11 @@ const String& deviceName()
     static LazyNeverDestroyed<String> deviceName;
     static std::once_flag onceFlag;
     std::call_once(onceFlag, [] {
+#if TARGET_OS_IOS
         auto cfDeviceName = adoptCF(static_cast<CFStringRef>(MGCopyAnswer(kMGQDeviceName, nullptr)));
+#else
+        auto cfDeviceName = retainPtr(CFSTR("iPhone"));
+#endif
         ASSERT(!cfDeviceName || CFGetTypeID(cfDeviceName.get()) == CFStringGetTypeID());
         deviceName.construct(cfDeviceName.get());
     });