Wrong circuit & padlock displayed when using an onion service through Alt-Svc discovery

TBB version 8.5a2, Linux/amd64

When connecting to a website that offers an onion service through the Alt-Svc header, the circuit (and padlock icon) aren't updated when the browser reconnects through the onion service.

I confirmed the bug occurs by connecting to an endpoint, on an Alt-Svc-enabled service, that returns “tor” when going over an exit node and “onion” when going over the onion service:

https://www.facebook.com/si/proxy

(This is a facebook-internal endpoint, and I will replace the suggested reproduction endpoint once I setup an Alt-Svc-enabled website and reproduce the issue on it.)

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