Bug 496217 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Florian Quèze [:florian] from comment #7)
> I don't remember ever seeing this in my startup profiles, so I doubt this is
> still done during startup. I don't know if this is done on the main thread
> or with async I/O, but I hope the later (in which case we could just resolve
> this as WFM).

At least the personal dictionary loading was moved off the mainthread in bug 880864.

... however, it seems we wait for it in `profile-do-change`: https://searchfox.org/mozilla-central/rev/47aea2f603cc18144afcedbd604a418f11e90f9b/extensions/spellcheck/src/mozPersonalDictionary.cpp#422-427 . However however, it doesn't look like we hit that in practice, because `Init()` gets called too late for that, so the observer is not registered in time. I'm not sure why there does appear to be coverage for that code - perhaps from xpcshell or other tests that force that codepath to be hit.

We initialize spellcheck later on startup from this JS stack:

```
0 registerBuiltinDictionaries() ["resource://gre/modules/addons/XPIProvider.jsm":2447:22]
1 startup(aAppChanged = "undefined", aOldAppVersion = "null", aOldPlatformVersion = """") ["resource://gre/modules/addons/XPIProvider.jsm":2513:11]
2 callProvider(aProvider = "[object Object]", aMethod = ""startup"", aDefault = "null", aArgs = ",,", "null", """") ["resource://gre/modules/AddonManager.jsm":246:30]
3 _startProvider(aProvider = "[object Object]", aAppChanged = "undefined", aOldAppVersion = "null", aOldPlatformVersion = """") ["resource://gre/modules/AddonManager.jsm":554:16]
4 startup() ["resource://gre/modules/AddonManager.jsm":760:13]
5 startup() ["resource://gre/modules/AddonManager.jsm":3678:25]
6 observe(aSubject = "null", aTopic = ""addons-startup"", aData = "null") ["resource://gre/modules/addonManager.js":75:28]
```

via this bit of C++:

```
#01: mozPersonalDictionary::Init()[/toolkit/library/build/XUL +0x3f8a0a4]
#02: mozilla::xpcom::CreateInstanceImpl(mozilla::xpcom::ModuleID, nsID const&, void**)[/toolkit/library/build/XUL +0x229bac]
#03: nsComponentManagerImpl::GetServiceLocked(mozilla::Maybe<mozilla::detail::BaseMonitorAutoLock<mozilla::Monitor> >&, (anonymous namespace)::EntryWrapper&, nsID const&, void**)[/toolkit/library/build/XUL +0x233480]
#04: nsComponentManagerImpl::GetServiceByContractID(char const*, nsID const&, void**)[/toolkit/library/build/XUL +0x233c2c]
#05: nsGetServiceByContractID::operator()(nsID const&, void**) const[/toolkit/library/build/XUL +0x235be0]
#06: nsCOMPtr_base::assign_from_gs_contractid(nsGetServiceByContractID, nsID const&)[/toolkit/library/build/XUL +0x1b2b14]
#07: mozSpellChecker::Init()[/toolkit/library/build/XUL +0x3f8b4d4]
#08: mozSpellChecker::Create()[/toolkit/library/build/XUL +0x2a197c8]
#09: mozilla::dom::ContentParent::NotifyUpdatedDictionaries()[/toolkit/library/build/XUL +0x2a206e4]
#10: mozHunspell::DictionariesChanged(bool)[/toolkit/library/build/XUL +0x3f661b0]
#11: mozHunspell::AddDictionary(nsTSubstring<char16_t> const&, nsIURI*)[/toolkit/library/build/XUL +0x3f66d3c]

I think given we do the IO on a background thread, this is probably better than sync-loading them "just in time", so going to resolve this WFM. If there is still a problem here in practice, let's create a new bug with more specific details.
(In reply to Florian Quèze [:florian] from comment #7)
> I don't remember ever seeing this in my startup profiles, so I doubt this is
> still done during startup. I don't know if this is done on the main thread
> or with async I/O, but I hope the later (in which case we could just resolve
> this as WFM).

At least the personal dictionary loading was moved off the mainthread in bug 880864.

... however, it seems we wait for it in `profile-do-change`: https://searchfox.org/mozilla-central/rev/47aea2f603cc18144afcedbd604a418f11e90f9b/extensions/spellcheck/src/mozPersonalDictionary.cpp#422-427 . However however, it doesn't look like we hit that in practice, because `Init()` gets called too late for that, so the observer is not registered in time. I'm not sure why there does appear to be coverage for that code - perhaps from xpcshell or other tests that force that codepath to be hit.

We initialize spellcheck later on startup from this JS stack:

```
0 registerBuiltinDictionaries() ["resource://gre/modules/addons/XPIProvider.jsm":2447:22]
1 startup(aAppChanged = "undefined", aOldAppVersion = "null", aOldPlatformVersion = """") ["resource://gre/modules/addons/XPIProvider.jsm":2513:11]
2 callProvider(aProvider = "[object Object]", aMethod = ""startup"", aDefault = "null", aArgs = ",,", "null", """") ["resource://gre/modules/AddonManager.jsm":246:30]
3 _startProvider(aProvider = "[object Object]", aAppChanged = "undefined", aOldAppVersion = "null", aOldPlatformVersion = """") ["resource://gre/modules/AddonManager.jsm":554:16]
4 startup() ["resource://gre/modules/AddonManager.jsm":760:13]
5 startup() ["resource://gre/modules/AddonManager.jsm":3678:25]
6 observe(aSubject = "null", aTopic = ""addons-startup"", aData = "null") ["resource://gre/modules/addonManager.js":75:28]
```

via this bit of C++:

```
#01: mozPersonalDictionary::Init()[/toolkit/library/build/XUL +0x3f8a0a4]
#02: mozilla::xpcom::CreateInstanceImpl(mozilla::xpcom::ModuleID, nsID const&, void**)[/toolkit/library/build/XUL +0x229bac]
#03: nsComponentManagerImpl::GetServiceLocked(mozilla::Maybe<mozilla::detail::BaseMonitorAutoLock<mozilla::Monitor> >&, (anonymous namespace)::EntryWrapper&, nsID const&, void**)[/toolkit/library/build/XUL +0x233480]
#04: nsComponentManagerImpl::GetServiceByContractID(char const*, nsID const&, void**)[/toolkit/library/build/XUL +0x233c2c]
#05: nsGetServiceByContractID::operator()(nsID const&, void**) const[/toolkit/library/build/XUL +0x235be0]
#06: nsCOMPtr_base::assign_from_gs_contractid(nsGetServiceByContractID, nsID const&)[/toolkit/library/build/XUL +0x1b2b14]
#07: mozSpellChecker::Init()[/toolkit/library/build/XUL +0x3f8b4d4]
#08: mozSpellChecker::Create()[/toolkit/library/build/XUL +0x2a197c8]
#09: mozilla::dom::ContentParent::NotifyUpdatedDictionaries()[/toolkit/library/build/XUL +0x2a206e4]
#10: mozHunspell::DictionariesChanged(bool)[/toolkit/library/build/XUL +0x3f661b0]
#11: mozHunspell::AddDictionary(nsTSubstring<char16_t> const&, nsIURI*)[/toolkit/library/build/XUL +0x3f66d3c]
```

I think given we do the IO on a background thread, this is probably better than sync-loading them "just in time", so going to resolve this WFM. If there is still a problem here in practice, let's create a new bug with more specific details.

Back to Bug 496217 Comment 8