Give WKWebView on iOS a mobile user agent
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 19:19:51 +0000 (19:19 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jun 2014 19:19:51 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134034
<rdar://problem/17346489>

Reviewed by Enrica Casucci.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

index 7a660d1..65db160 100644 (file)
@@ -1,3 +1,14 @@
+2014-06-18  Anders Carlsson  <andersca@apple.com>
+
+        Give WKWebView on iOS a mobile user agent
+        https://bugs.webkit.org/show_bug.cgi?id=134034
+        <rdar://problem/17346489>
+
+        Reviewed by Enrica Casucci.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+
 2014-06-18  Joseph Pecoraro  <pecoraro@apple.com>
 
         Remove stale include, header was removed in r170101.
index f5d4777..94f26a5 100644 (file)
@@ -86,6 +86,7 @@
 #import <CoreGraphics/CGFloat.h>
 #import <CoreGraphics/CGPDFDocumentPrivate.h>
 #import <UIKit/UIApplication.h>
+#import <UIKit/UIDevice_Private.h>
 #import <UIKit/UIPeripheralHost_Private.h>
 #import <UIKit/UIWindow_Private.h>
 #import <QuartzCore/CARenderServer.h>
@@ -267,8 +268,9 @@ static int32_t deviceOrientation()
     [_scrollView setBackgroundColor:[UIColor whiteColor]];
 
     _contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration) webView:self]);
-    _page = [_contentView page];
 
+    _page = [_contentView page];
+    _page->setApplicationNameForUserAgent([@"Mobile/" stringByAppendingString:[UIDevice currentDevice].buildVersion]);
     _page->setDeviceOrientation(deviceOrientation());
 
     [_contentView layer].anchorPoint = CGPointZero;