1. Install and start Firefox. There is one container and one directory full of profiles.
2. Start the upgrade. This creates a second Firefox installation (container) sharing the same profile directory.
3. Try to run Firefox without quitting the old one. Does nothing because the runtime is smart enough to know that the old one is running. Maybe pop up a message suggesting restarting Firefox.
4. Quit Firefox. Start it again. The new one runs. All the data is still there.
5. The old installation goes away.
The runtime has plenty of flexibility in how to make this work. There could be multiple containers. There could be one container with multiple parallel versions. There could be one container with a staged upgrade that can swap in essentially instantaneously once the container is idle (although this may fall apart on multi-user systems or where the containerized program regularly has multiple running copies of itself at once, e.g. a program like bash).
But the fact that snap apparently has trouble with this seems a bit embarrassing.
Every critical piece of information is available to Snapd, and yet, they have chosen the wrong and broken implementation.
You don't need to serialize or reload anything.
> if a container is running for the current user, execute firefox in its context
So there is no need for snap to fancy serialization, just have new and old firefox ready, and keep using old one while it has running processeses. And if the old one exits for any reason, start new one instead.
That's all snap has to do! But it does not, because it really likes to make strange texhnical decisions for some reason.
(For "coordination", snap could make a common file in old app dir like "bin/new_version_availablec, and if firefox detects it, it shows that "your browser needs to be updated" button. I would not be surprised if something like this already exists in firefox. But I doubt snap would use this approach because it is not complex enough for it :) )
Would you like to run a completely new Firefox with a completely new profile whenever you update it? You do know that you can't use the same profile even with the same version of Firefox in two separate Firefox instances concurrently, right? If the updater was aware of snap and snap aware of the application it's updating, you could have a graceful update procedure that serializes the current state and reloads the new container, but that's a lot of hoops to jump through, and the jumping must be coordinated between multiple stakeholders.