* Add a UIPhases / getUIPhase to figure out where we are in the flow, and get the UI into the right state * Refactor to get rid of a bunch of implicit side-effects: - Separate out getting the panel from creating it - closePanel only closes the buttons panel - Add a closeOverlay so we do that and only that when needed * When the preview dialog closes, we expect to exit unless exitOnPreviewClose was set false * Keep some state for each browser using a weakmap so we can better handle re-entry (and later, re-focusing) Differential Revision: https://phabricator.services.mozilla.com/D185379