Skip to content

Investigate: find root cause of moat/networking failure in connection assist on android

Prior work: !1455 (merged)

Android Connection Assist when censorship level is even 1 crashes after trying 'automatic' from the region dropdown instead of successding

using a ton of added logging (see: https://gitlab.torproject.org/dan/tor-browser/-/tree/bug_43576_log_gv_moat_domainfront?ref_type=heads )

  • TorConnect calls Moat which calls DomainFronting
    • DomainFrontedRequest gets a httpHandler which is from Services.io.getProtocolHandler("http")
    • that is given to a ResponseListener defined in that file.
    • onStartRequest is called immediatly followed by a onStopRequest which starts the error state rollup ending with a (if i recall) a NS_ERROR_FAILURE being returned up the stack through TorConnect all the way to Connection Assist's ui which goes to the failure state right away

When a page, any page is loaded (like 'about:config`) then this request works and connection assist works.

The above linked fix was to quietly dummy load about: and then unload it.

This isn't a bad fix, but I suspect we might be able to or want to be more targeted or understand this better.

On the Fenix side I recall tracing calls from loadDummyPage components.useCases.tabsUseCases.addTab.invoke("about:") getting to EngineDelegateMiddleware before I gave up.

On one hand it was doing things like initializing an Engine but all the work in this path was tied to a tabID and a Tab which a hypothetical ideal initialization wouldn't have.

On the Geckoview side, I lost track/ran out of time of where the channel/httpHandler/Services.io were/are defined to try and find what error it might be having causing it to call the ResponseListener's onStopRequest prematurely

It would appear that somewhere in geckoview resources to allow JS to do networking require some part of the engine to be initialized and that path isn't invoked by Fenix until the first tab is initialized.

A successful improvement would find the root cause in the supplier of the channel/httpHandler in Services.io's provider and find a path from Fenix to initialize what ever resource it needs with out invoking semi UI components like Tabs to host engine references and than wire in that path instead of the loadDummyPage path so that connection assist and moat can work before the browser is shown.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information