Closed Bug 1311275 Opened 4 years ago Closed 4 years ago
Assertion failed in mozilla::net::ns
IOService::Get Cached Protocol Handler
Bug 1308275 breaks the assertion |NS_IsMainThread()| in |nsIOService::GetCachedProtocolHandler|
Instead of using NS_GetFileFromURLSpec you will have to decompose that function similar way as I did that in bug 1293327 (your are cc'ed now). You simply need to get the file protocol directly (do_GetService) and call the GetFileFromURLSpec on it. The goal is to not use the 'cached protocol' path, which is not thread safe. That's all.
You can also cache the protocol yourself if that would be used too often (do_GetService is relatively slow).
Another way to fix this would be to change nsIOService::GetCachedProtocolHandler() to be thread safe (but I assume that option was already considered). For developers, is there a way to know which functions are thread safe? In other words, how could I have known in advance that NS_GetFileFromURLSpec() is not thread safe?
Attachment #8802790 - Flags: review?(honzab.moz) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/ee15d36745a8 use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer
You need to log in before you can comment on or make changes to this bug.