Skip to content

Commit 83d58b5

Browse files
Matthew BenedictMatthew Benedict
authored andcommitted
Change user agent
1 parent ab55fd8 commit 83d58b5

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

Source/CyberCore/platform/ios/UserAgentIOS.mm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ASCIILiteral osNameForUserAgent()
6161
return "iPhone OS"_s;
6262
}
6363

64-
#if !USE(STATIC_IPAD_USER_AGENT_VALUE)
64+
#if 0 && !USE(STATIC_IPAD_USER_AGENT_VALUE)
6565
static StringView deviceNameForUserAgent()
6666
{
6767
if (isClassic()) {
@@ -88,19 +88,18 @@ String standardUserAgentWithApplicationName(const String& applicationName, const
8888
auto separator = applicationName.isEmpty() ? "" : " ";
8989

9090
if (type == UserAgentType::Desktop)
91-
return makeString("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleCyberKit/605.1.15 (KHTML, like Gecko)", separator, applicationName);
92-
93-
#if USE(STATIC_IPAD_USER_AGENT_VALUE)
91+
return makeString("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15");
92+
#if 1 || USE(STATIC_IPAD_USER_AGENT_VALUE)
9493
UNUSED_PARAM(userAgentOSVersion);
9594
UNUSED_PARAM(separator);
96-
return makeString("Mozilla/5.0 (iPad; CPU OS 16_3_1 like Mac OS X) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/16.3 Mobile/15E148 Safari/604.1");
95+
return makeString("Mozilla/5.0 (iPad; CPU OS 16_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Mobile/15E148 Safari/604.1");
9796
#else
9897
// FIXME: We should deprecate and remove this override; see https://bugs.webkit.org/show_bug.cgi?id=217927 for details.
9998
if (auto override = dynamic_cf_cast<CFStringRef>(adoptCF(CFPreferencesCopyAppValue(CFSTR("UserAgent"), CFSTR("com.apple.WebFoundation")))))
10099
return override.get();
101100
102101
auto osVersion = userAgentOSVersion.isEmpty() ? systemMarketingVersionForUserAgentString() : userAgentOSVersion;
103-
return makeString("Mozilla/5.0 (", deviceNameForUserAgent(), "; CPU ", osNameForUserAgent(), " ", osVersion, " like Mac OS X) AppleCyberKit/605.1.15 (KHTML, like Gecko)", separator, applicationName);
102+
return makeString("Mozilla/5.0 (", deviceNameForUserAgent(), "; CPU ", osNameForUserAgent(), " ", osVersion, " like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)", separator, applicationName);
104103
#endif
105104
}
106105

Source/CyberCore/platform/mac/UserAgentMac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ String standardUserAgentWithApplicationName(const String& applicationName, const
4040

4141
String appNameSuffix = applicationName.isEmpty() ? emptyString() : makeString(" ", applicationName);
4242

43-
return makeString("Mozilla/5.0 (Macintosh; Intel Mac OS X ", osVersion, ") AppleCyberKit/605.1.15 (KHTML, like Gecko)", appNameSuffix);
43+
return makeString("Mozilla/5.0 (Macintosh; Intel Mac OS X ", osVersion, ") AppleWebKit/605.1.15 (KHTML, like Gecko)", appNameSuffix);
4444
}
4545

4646
} // namespace CyberCore

Source/WebInspectorUI/UserInterface/External/CodeMirror/codemirror.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var safari = /Apple Computer/.test(navigator.vendor)
3131
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
3232
var phantom = /PhantomJS/.test(userAgent)
3333

34-
var ios = /AppleCyberKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
34+
var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
3535
// This is woefully incomplete. Suggestions for alternative methods welcome.
3636
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
3737
var mac = ios || /Mac/.test(platform)
@@ -9108,4 +9108,4 @@ CodeMirror.version = "5.21.1"
91089108

91099109
return CodeMirror;
91109110

9111-
})));
9111+
})));

Source/WebInspectorUI/UserInterface/Views/OverrideDeviceSettingsPopover.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,20 @@ WI.OverrideDeviceSettingsPopover = class OverrideDeviceSettingsPopover extends W
146146
{name: WI.UIString("Default"), value: WI.DeviceSettingsManager.DefaultValue},
147147
],
148148
[
149-
{name: "Safari 16.0", value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"},
149+
{name: "Safari 16.0", value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"},
150150
],
151151
[
152-
{name: `Safari ${emDash} iOS 16.0 ${emDash} iPhone`, value: "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"},
153-
{name: `Safari ${emDash} iPadOS 16.0 ${emDash} iPad mini`, value: "Mozilla/5.0 (iPad; CPU iPhone OS 16_0 like Mac OS X) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"},
154-
{name: `Safari ${emDash} iPadOS 16.0 ${emDash} iPad`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"},
152+
{name: `Safari ${emDash} iOS 16.0 ${emDash} iPhone`, value: "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"},
153+
{name: `Safari ${emDash} iPadOS 16.0 ${emDash} iPad mini`, value: "Mozilla/5.0 (iPad; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"},
154+
{name: `Safari ${emDash} iPadOS 16.0 ${emDash} iPad`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"},
155155
],
156156
[
157-
{name: `Microsoft Edge ${emDash} macOS`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37"},
158-
{name: `Microsoft Edge ${emDash} Windows`, value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37"},
157+
{name: `Microsoft Edge ${emDash} macOS`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37"},
158+
{name: `Microsoft Edge ${emDash} Windows`, value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37"},
159159
],
160160
[
161-
{name: `Google Chrome ${emDash} macOS`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36"},
162-
{name: `Google Chrome ${emDash} Windows`, value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"},
161+
{name: `Google Chrome ${emDash} macOS`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36"},
162+
{name: `Google Chrome ${emDash} Windows`, value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"},
163163
],
164164
[
165165
{name: `Firefox ${emDash} macOS`, value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0"},

Tools/MiniBrowser/mac/SettingsController.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ + (NSArray *)userAgentData
228228
@{
229229
@"label" : @"Safari 13.1",
230230
@"identifier" : @"safari",
231-
@"userAgent" : @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15"
231+
@"userAgent" : @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15"
232232
},
233233
@{
234234
@"label" : @"-",
235235
},
236236
@{
237237
@"label" : @"Safari—iOS 13.4—iPhone",
238238
@"identifier" : @"iphone-safari",
239-
@"userAgent" : @"Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleCyberKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1"
239+
@"userAgent" : @"Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1"
240240
},
241241
@{
242242
@"label" : @"-",
@@ -257,17 +257,17 @@ + (NSArray *)userAgentData
257257
@{
258258
@"label" : @"Chrome—macOS",
259259
@"identifier" : @"chrome",
260-
@"userAgent" : @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
260+
@"userAgent" : @"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
261261
},
262262
@{
263263
@"label" : @"Chrome—Windows",
264264
@"identifier" : @"windows-chrome",
265-
@"userAgent" : @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
265+
@"userAgent" : @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
266266
},
267267
@{
268268
@"label" : @"Chrome—Android",
269269
@"identifier" : @"android-chrome",
270-
@"userAgent" : @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
270+
@"userAgent" : @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
271271
},
272272
];
273273
}

Tools/TestCyberKitAPI/ios/PreferredContentMode.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static auto makeContentModeDecisionHandler(WKContentMode mode)
316316

317317
auto [webView, delegate] = setUpWebViewForPreferredContentModeTesting<TestWKWebView>(WKContentModeDesktop);
318318

319-
NSString *customUserAgent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleCyberKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
319+
NSString *customUserAgent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
320320
[webView setCustomUserAgent:customUserAgent];
321321
[webView loadTestPageNamed:@"simple" withPolicyDecisionHandler:nil];
322322
EXPECT_WK_STREQ(customUserAgent, [webView navigatorUserAgent]);

0 commit comments

Comments
 (0)