Closed
Bug 1310814
Opened 8 years ago
Closed 8 years ago
startup crash [__NSCFString objectForKey:]: unrecognized selector sent to instance 0x10af01b70
Categories
(Core :: Widget: Cocoa, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla52
People
(Reporter: asa, Assigned: mstange)
References
Details
(Keywords: crash, regression, Whiteboard: tpi:+)
Attachments
(2 files)
58 bytes,
text/x-review-board-request
|
spohl
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details |
58 bytes,
text/x-review-board-request
|
spohl
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details |
From smfr on Twitter: "Firefox crashes on launch every time on macOS Sierra." Safe mode didn't help. New profile shows crash at [__NSCFString objectForKey:]: unrecognized selector sent to instance 0x10af01b70
Simon, can you provide your Firefox version info and a link to your crash report? Thanks.
Comment 1•8 years ago
|
||
Reproduced with Firefox 45.0.1 and Nightly 52.0a1 (slightly different crash).
Firefox 45.0.1 crashes with:
3$ $ /Volumes/Data/Applications/Firefox.app/Contents/MacOS/firefox-bin
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
2016-10-17 14:03:31.558 firefox-bin[59343:7706631] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x1004019b0
2016-10-17 14:03:31.649 firefox-bin[59343:7706631] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x1004019b0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9ca956fb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffb1439a2a objc_exception_throw + 48
2 CoreFoundation 0x00007fff9cb15cc4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff9ca08f03 ___forwarding___ + 1059
4 CoreFoundation 0x00007fff9ca08a58 _CF_forwarding_prep_0 + 120
5 XUL 0x000000010225bf24 NS_LogCOMPtrRelease + 15860
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Nightly 52.0a1 crashes with:
4$ $ /Volumes/Data/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
2016-10-17 14:03:56.106 firefox-bin[59351:7707196] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x1003b82e0
2016-10-17 14:03:56.463 firefox-bin[59351:7707196] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x1003b82e0'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff9ca956fb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fffb1439a2a objc_exception_throw + 48
2 CoreFoundation 0x00007fff9cb15cc4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff9ca08f03 ___forwarding___ + 1059
4 CoreFoundation 0x00007fff9ca08a58 _CF_forwarding_prep_0 + 120
5 XUL 0x000000010086df99 _ZN7mozilla19GetSelectedCityInfoER18nsAString_internal + 73
6 XUL 0x000000010086572e _ZN12nsSystemInfo4InitEv + 2910
7 XUL 0x00000001008e1e1c _ZL23nsSystemInfoConstructorP11nsISupportsRK4nsIDPPv + 76
8 XUL 0x00000001008ad8e8 _ZN22nsComponentManagerImpl26CreateInstanceByContractIDEPKcP11nsISupportsRK4nsIDPPv + 280
9 XUL 0x00000001008aa570 _ZN22nsComponentManagerImpl22GetServiceByContractIDEPKcRK4nsIDPPv + 784
10 XUL 0x00000001008e5de1 _ZN13nsCOMPtr_base25assign_from_gs_contractidE24nsGetServiceByContractIDRK4nsID + 33
11 XUL 0x0000000102b29aa8 _ZN7mozilla19InitOSFileConstantsEv + 952
12 XUL 0x0000000102b2b4f3 _ZN7mozilla22OSFileConstantsService4InitEP9JSContext + 19
13 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
14 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
15 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
16 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
17 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
18 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
19 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
20 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
21 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
22 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
23 XUL 0x000000010144048a _ZN20mozJSComponentLoader10ImportIntoERK19nsACString_internalN2JS6HandleIP8JSObjectEEP9JSContextNS3_13MutableHandleIS6_EE + 4186
24 XUL 0x000000010143f233 _ZN20mozJSComponentLoader6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 563
25 XUL 0x000000010144ed56 _ZN21nsXPCComponents_Utils6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 102
26 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
27 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
28 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
29 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
30 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
31 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
32 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
33 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
34 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
35 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
36 XUL 0x000000010144048a _ZN20mozJSComponentLoader10ImportIntoERK19nsACString_internalN2JS6HandleIP8JSObjectEEP9JSContextNS3_13MutableHandleIS6_EE + 4186
37 XUL 0x000000010143f233 _ZN20mozJSComponentLoader6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 563
38 XUL 0x000000010144ed56 _ZN21nsXPCComponents_Utils6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 102
39 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
40 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
41 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
42 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
43 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
44 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
45 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
46 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
47 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
48 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
49 XUL 0x000000010144048a _ZN20mozJSComponentLoader10ImportIntoERK19nsACString_internalN2JS6HandleIP8JSObjectEEP9JSContextNS3_13MutableHandleIS6_EE + 4186
50 XUL 0x000000010143f233 _ZN20mozJSComponentLoader6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 563
51 XUL 0x000000010144ed56 _ZN21nsXPCComponents_Utils6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 102
52 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
53 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
54 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
55 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
56 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
57 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
58 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
59 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
60 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
61 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
62 XUL 0x000000010144048a _ZN20mozJSComponentLoader10ImportIntoERK19nsACString_internalN2JS6HandleIP8JSObjectEEP9JSContextNS3_13MutableHandleIS6_EE + 4186
63 XUL 0x000000010143f233 _ZN20mozJSComponentLoader6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 563
64 XUL 0x000000010144ed56 _ZN21nsXPCComponents_Utils6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 102
65 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
66 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
67 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
68 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
69 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
70 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
71 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
72 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
73 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
74 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
75 XUL 0x000000010144048a _ZN20mozJSComponentLoader10ImportIntoERK19nsACString_internalN2JS6HandleIP8JSObjectEEP9JSContextNS3_13MutableHandleIS6_EE + 4186
76 XUL 0x000000010143f233 _ZN20mozJSComponentLoader6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 563
77 XUL 0x000000010144ed56 _ZN21nsXPCComponents_Utils6ImportERK19nsACString_internalN2JS6HandleINS3_5ValueEEEP9JSContexthNS3_13MutableHandleIS5_EE + 102
78 XUL 0x00000001008cbcbf NS_InvokeByIndex + 511
79 XUL 0x0000000101491643 _ZN16XPCWrappedNative10CallMethodER14XPCCallContextNS_8CallModeE + 4243
80 XUL 0x00000001014930ef _Z17XPC_WN_CallMethodP9JSContextjPN2JS5ValueE + 575
81 XUL 0x000000010464361d _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE + 877
82 XUL 0x000000010463d51d _ZL9InterpretP9JSContextRN2js8RunStateE + 41293
83 XUL 0x0000000104633347 _ZN2js9RunScriptEP9JSContextRNS_8RunStateE + 471
84 XUL 0x000000010464468b _ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_16AbstractFramePtrEPS9_ + 507
85 XUL 0x0000000104644840 _ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE + 304
86 XUL 0x00000001044b1f80 _Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEE + 96
87 XUL 0x000000010143e18e _ZN20mozJSComponentLoader17ObjectForLocationER19ComponentLoaderInfoP7nsIFileN2JS13MutableHandleIP8JSObjectEENS5_IP8JSScriptEEPPcbNS5_INS4_5ValueEEE + 3310
88 XUL 0x000000010143cf46 _ZN20mozJSComponentLoader10LoadModuleERN7mozilla12FileLocationE + 870
89 XUL 0x00000001008ad036 _ZN14nsFactoryEntry10GetFactoryEv + 118
90 XUL 0x00000001008ad8bd _ZN22nsComponentManagerImpl26CreateInstanceByContractIDEPKcP11nsISupportsRK4nsIDPPv + 237
91 XUL 0x00000001008aa570 _ZN22nsComponentManagerImpl22GetServiceByContractIDEPKcRK4nsIDPPv + 784
92 XUL 0x00000001008e5e91 _ZN13nsCOMPtr_base36assign_from_gs_contractid_with_errorERK33nsGetServiceByContractIDWithErrorRK4nsID + 49
93 XUL 0x0000000103555290 _ZN20nsAppStartupNotifier7ObserveEP11nsISupportsPKcPKDs + 736
94 XUL 0x00000001038c1ad8 _ZN7XREMain11XRE_mainRunEv + 840
95 XUL 0x00000001038c2a8d _ZN7XREMain8XRE_mainEiPPcPK12nsXREAppData + 637
96 XUL 0x00000001038c2df2 XRE_main + 226
97 firefox-bin 0x00000001000b3a6e main + 1710
98 firefox-bin 0x00000001000b33b4 start + 52
99 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Comment 2•8 years ago
|
||
Crash still happens if I make a new profile, or nuke ~/Library/Application Support/Firefox.
Reporter | ||
Updated•8 years ago
|
Component: General → Widget: Cocoa
Product: Firefox → Core
Reporter | ||
Comment 3•8 years ago
|
||
smfr, is there any chance you've got a strange value or no value for City in your Mac settings? It looks like the first Firefox line in the stack is where we try to get your city from Mac OS.
Comment 4•8 years ago
|
||
Closest City: Cupertino - United States.
What prefs domain is Firefox reading from there?
Comment 5•8 years ago
|
||
It says
> '-[__NSCFString objectForKey:]: unrecognized selector
and in GetSelectedCityInfo, we call objectForKey on two things, one is return value of [NSUserDefaults standardUserDefaults], and the other is the NSDictionary from that.
I'm not familiar with Obj-C's type check. If the NSDictionary pointer holds a different thing, would it also yelled?
smfr, can you probably try to run the function and report what does that happen?
[1] https://dxr.mozilla.org/mozilla-central/rev/7c8216f48c38a8498f251fe044509b930af44de6/xpcom/base/MacHelpers.mm#15
Assignee | ||
Comment 6•8 years ago
|
||
Oh, I hadn't seen that second call! We should definitely type check that the thing we're getting is really an NSDictionary.
There have been 52 reported crashes in GetSelectedCityInfo over the last 6 months:
https://crash-stats.mozilla.com/search/?proto_signature=~GetSelectedCityInfo&date=%3E%3D2016-04-17T22%3A07%3A36.000Z&date=%3C2016-10-17T22%3A07%3A36.000Z&_sort=version&_sort=-date&_facets=signature&_columns=date&_columns=signature&_columns=product&_columns=version&_columns=build_id&_columns=platform#crash-reports
Comment 7•8 years ago
|
||
defaults read /Library/Preferences/.GlobalPreferences* shows:
"com.apple.preferences.timezone.selected_city" = {
AppleMapID = "\032t\020\032u\024\033x\024\034r\020\035w\020\033t\024";
};
Comment 8•8 years ago
|
||
According to the crash report, this crash happens at the second call to objectForKey, so it looks like |selected_city| is not holding an NSDictionary. But from the result shown in comment 7, it seems it should still be an NSDictionary, just don't contain the "CountryCode" we want anymore, but that shouldn't crash. Hmm...
Comment 9•8 years ago
|
||
It seems that visiting the prefs panel is enough to fix it. Before visiting the panel, in macOS Sierra:
"com.apple.preferences.timezone.selected_city" = "\032t\020\032u\024\033x\024\034r\020\035w\020\033t\024";
after:
"com.apple.preferences.timezone.selected_city" = {
AppleMapID = "\032t\020\032u\024\033x\024\034r\020\035w\020\033t\024";
};
Comment 10•8 years ago
|
||
And this fixes the crash in release Firefox too.
Comment 11•8 years ago
|
||
By "prefs panel" I mean the "Date & Time" panel in System Preferences, possibly visiting the "Time Zone" tab.
Comment 12•8 years ago
|
||
Sounds like macOS should probably avoid setting "com.apple.preferences.timezone.selected_city" to a string, and Firefox should probably do a type check on the return value of "com.apple.preferences.timezone.selected_city". And in the mean time, we could ask users to visit the prefs panel to workaround this issue.
Comment 13•8 years ago
|
||
What you should really do is to stop relying on undocumented prefs, and file a radar requesting API to get the data you need.
Comment 14•8 years ago
|
||
FWIW, the code was initially introduced in bug 1102295. I guess there should be some existing API we can use.
Blocks: 1102295
Assignee | ||
Comment 15•8 years ago
|
||
(In reply to Simon Fraser from comment #13)
> What you should really do is to stop relying on undocumented prefs, and file
> a radar requesting API to get the data you need.
Absolutely. I'm disappointed about what happened there.
It looks like Apple already added the API we need in 10.12: [[NSLocale currentLocale] countryCode]
https://developer.apple.com/reference/foundation/nslocale/1643060-countrycode?language=objc
Assignee | ||
Comment 16•8 years ago
|
||
In fact, [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] has existed since 10.4.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 18•8 years ago
|
||
Thank you very much for tracking this down, Simon.
Assignee: nobody → mstange
Status: NEW → ASSIGNED
Assignee | ||
Updated•8 years ago
|
No longer blocks: 1102295
status-firefox49:
--- → affected
status-firefox50:
--- → affected
status-firefox51:
--- → affected
status-firefox52:
--- → affected
status-firefox-esr45:
--- → affected
Depends on: 1102295
Keywords: regression
Hardware: Unspecified → All
Version: unspecified → Trunk
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Updated•8 years ago
|
Attachment #8801963 -
Flags: review?(benjamin) → review?(spohl.mozilla.bugs)
Updated•8 years ago
|
Attachment #8802157 -
Flags: review?(benjamin) → review?(spohl.mozilla.bugs)
Comment 21•8 years ago
|
||
mozreview-review |
Comment on attachment 8801963 [details]
Bug 1310814 - Use public NSLocale API for getting the system country code.
https://reviewboard.mozilla.org/r/86538/#review87396
::: xpcom/base/MacHelpers.mm:19
(Diff revision 2)
> nsresult
> GetSelectedCityInfo(nsAString& aCountryCode)
> {
> - NSDictionary* selected_city =
> - [[NSUserDefaults standardUserDefaults]
> - objectForKey:@"com.apple.preferences.timezone.selected_city"];
> + // Can be replaced with [[NSLocale currentLocale] countryCode] once we build
> + // with the 10.12 SDK.
> + id countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
I see references online to [NSLocale currentLocal] going back to approximately 10.4, but the Apple docs say 10.12 (presumably since the implementation changed in 10.12). I do see release notes stating that NSLocale was introduced in 10.4. I'm assuming [NSLocale currentLocale] was there from the beginning?
::: xpcom/base/MacHelpers.mm:25
(Diff revision 2)
> - NSString *countryCode = (NSString *)
> - [selected_city objectForKey:@"CountryCode"];
> - const char *countryCodeUTF8 = [countryCode UTF8String];
> +
> + if (![countryCode isKindOfClass:[NSString class]]) {
> + return NS_ERROR_FAILURE;
> + }
> +
> + const char *countryCodeUTF8 = [(NSString*)countryCode UTF8String];
nit: s/const char \*countryCodeUTF8/const char\* countryCodeUTF8/
Attachment #8801963 -
Flags: review?(spohl.mozilla.bugs) → review+
Comment 22•8 years ago
|
||
mozreview-review |
Comment on attachment 8802157 [details]
Bug 1310814 - Add ObjC exception guards.
https://reviewboard.mozilla.org/r/86652/#review87384
Attachment #8802157 -
Flags: review?(spohl.mozilla.bugs) → review+
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: tpi:+
Assignee | ||
Comment 23•8 years ago
|
||
(In reply to Stephen A Pohl [:spohl] from comment #21)
> ::: xpcom/base/MacHelpers.mm:19
> (Diff revision 2)
> > nsresult
> > GetSelectedCityInfo(nsAString& aCountryCode)
> > {
> > - NSDictionary* selected_city =
> > - [[NSUserDefaults standardUserDefaults]
> > - objectForKey:@"com.apple.preferences.timezone.selected_city"];
> > + // Can be replaced with [[NSLocale currentLocale] countryCode] once we build
> > + // with the 10.12 SDK.
> > + id countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
>
> I see references online to [NSLocale currentLocal] going back to
> approximately 10.4, but the Apple docs say 10.12 (presumably since the
> implementation changed in 10.12). I do see release notes stating that
> NSLocale was introduced in 10.4. I'm assuming [NSLocale currentLocale] was
> there from the beginning?
Probably. When I said "available since 10.4", I was looking at an AppKit class-dump from 10.4 that I had still lying around, so it could have been a private API back then. But for example the 10.6 SDK has +[NSLocale currentLocale] in the public NSLocale.h header file.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 26•8 years ago
|
||
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/55ccd7f2591a
Use public NSLocale API for getting the system country code. r=spohl
https://hg.mozilla.org/integration/autoland/rev/d9413eb3db64
Add ObjC exception guards. r=spohl
Assignee | ||
Comment 27•8 years ago
|
||
Comment on attachment 8801963 [details]
Bug 1310814 - Use public NSLocale API for getting the system country code.
Approval Request Comment
[Feature/regressing bug #]: bug 1102295
[User impact if declined]: startup crashes on macOS 10.12 under some configurations
[Describe test coverage new/current, TreeHerder]: none
[Risks and why]: makes our country detection more correct, can cause us to show Yahoo as a default search engine to people in the US who were not getting it before
[String/UUID change made/needed]: none
Attachment #8801963 -
Flags: approval-mozilla-beta?
Attachment #8801963 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•8 years ago
|
Attachment #8802157 -
Flags: approval-mozilla-beta?
Attachment #8802157 -
Flags: approval-mozilla-aurora?
Comment on attachment 8801963 [details]
Bug 1310814 - Use public NSLocale API for getting the system country code.
Fixes a crash on Sierra, patch seems low risk, Aurora51+, Beta50+
Attachment #8801963 -
Flags: approval-mozilla-beta?
Attachment #8801963 -
Flags: approval-mozilla-beta+
Attachment #8801963 -
Flags: approval-mozilla-aurora?
Attachment #8801963 -
Flags: approval-mozilla-aurora+
Hi Asa, once this lands on Nightly, could you please verify this issue is fixed as expected? Thanks!
Flags: needinfo?(asa)
Attachment #8802157 -
Flags: approval-mozilla-beta?
Attachment #8802157 -
Flags: approval-mozilla-beta+
Attachment #8802157 -
Flags: approval-mozilla-aurora?
Attachment #8802157 -
Flags: approval-mozilla-aurora+
Comment 30•8 years ago
|
||
bugherder uplift |
Comment 31•8 years ago
|
||
bugherder uplift |
Comment 32•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/55ccd7f2591a
https://hg.mozilla.org/mozilla-central/rev/d9413eb3db64
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Reporter | ||
Updated•6 years ago
|
Flags: needinfo?(asa)
You need to log in
before you can comment on or make changes to this bug.
Description
•