mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 09:19:28 +00:00
![David Keeler](/assets/img/avatar_default.png)
Modified from bug 1248818 comment 11: Before this patch, if a user had a smart card (PKCS#11 device) with removable slots, Firefox would launch a thread for each module and loop, calling SECMOD_WaitForAnyTokenEvent to be alerted to any insertions/removals. At shutdown, we would call SECMOD_CancelWait, which would cancel any waiting threads. However, since that involved calling 3rd party code, we really had no idea if these modules were behaving correctly (and, indeed, they often weren't, judging by the shutdown crashes we were getting). The real solution is to stop relying on PKCS#11, but since that's unlikely in the near future, the next best thing would be to load these modules in a child process. That way, misbehaving modules don't cause Firefox to hang/crash/etc. That's a lot of engineering work, though, so what this patch does is avoids the issue by never calling SECMOD_WaitForAnyTokenEvent (and thus we never have to call SECMOD_CancelWait, etc.). Instead, every time Firefox performs an operation that may be affected by a newly added or removed smart card, it first has NSS refresh its view of any removable slots. This is similar to how we ensure the loadable roots module has been loaded (see bug 1372656). MozReview-Commit-ID: JpmLdV7Vvor --HG-- extra : rebase_source : d3503d19fa9297106d661a017a38c30969fa39b4