I tried to fix this but it got too complex for me given my limited understanding of the code. The challenge is that GeckoSessionHandler leaked its thread safety needs to other classes: - if `GeckoSessionHandler.setDelegate` or `GeckoSessionHandler.getDelegate()` is ever called from a background thread for a given handler: - the delegate must be internally thread safe (since the delegate is guaranteed to be used on the ui thread by `handleMessage`) - the usage of the delegate is not mutually exclusive so it must be okay with being interwoven, e.g. `UI thread: getDelegate(); BG thread: setDelegate(newDelegate); UI thread: continues to use old delegate`, or synchronized - `GeckoSessionHandler` registers itself as a listener to `GeckoSession.getEventDispatcher()`. Without an understanding of the code, it's theoretically possible for `handleMessage` to be called at any time other methods are being called on a background thread and I'm not sure if that's safe
Bug 1748927 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I tried to fix this but it got too complex for me given my limited understanding of the code. The challenge is that GeckoSessionHandler leaked its thread safety needs to other classes: - if `GeckoSessionHandler.setDelegate` or `GeckoSessionHandler.getDelegate()` is ever called from a background thread for a given handler: - the delegate must be internally thread safe (since the delegate is guaranteed to be used on the ui thread by `handleMessage`) - the usage of the delegate is not mutually exclusive so it must be okay with being interwoven, e.g. `UI thread: getDelegate(); BG thread: setDelegate(newDelegate); UI thread: continues to use old delegate`, or synchronized - `GeckoSessionHandler` registers itself as a listener to `GeckoSession.getEventDispatcher()`. Without an understanding of the code, it's theoretically possible for `handleMessage` to be called at any time other methods are being called on a background thread and I'm not sure if that's safe I'll push my WIP.