public async initialize()

in src/injected/window-initializer.ts [73:218]


    public async initialize(): Promise<void> {
        const asyncInitializationSteps: Promise<void>[] = [];
        const userAgentParser = new UAParser(window.navigator.userAgent);
        const browserAdapterFactory = new BrowserAdapterFactory(userAgentParser);
        const browserAdapter = browserAdapterFactory.makeFromUserAgent();

        this.browserAdapter = browserAdapter;
        this.appDataAdapter = browserAdapter;
        this.windowUtils = new WindowUtils();
        const htmlElementUtils = new HTMLElementUtils();
        this.clientUtils = new ClientUtils(window);
        const logger = createDefaultLogger();

        new RootContainerCreator(htmlElementUtils).create(rootContainerId);

        this.shadowInitializer = new ShadowInitializer(
            this.browserAdapter,
            htmlElementUtils,
            logger,
        );
        asyncInitializationSteps.push(this.shadowInitializer.initialize());

        this.visualizationConfigurationFactory = new WebVisualizationConfigurationFactory();

        const backchannelWindowMessageTranslator = new BackchannelWindowMessageTranslator(
            this.browserAdapter,
            this.windowUtils,
            generateUID,
        );

        this.windowMessagePoster = new BrowserBackchannelWindowMessagePoster(
            this.windowUtils,
            this.browserAdapter,
            backchannelWindowMessageTranslator,
        );

        this.respondableCommandMessageCommunicator = new RespondableCommandMessageCommunicator(
            this.windowMessagePoster,
            generateUID,
            createDefaultPromiseFactory(),
            logger,
        );

        this.frameMessenger = new FrameMessenger(this.respondableCommandMessageCommunicator);
        const axeFrameMessenger = new AxeFrameMessenger(
            this.respondableCommandMessageCommunicator,
            this.windowUtils,
            logger,
        );

        axeFrameMessenger.registerGlobally(axe);

        const singleFrameListener = new SingleFrameTabStopListener(
            'manual-tab-stop-listener',
            getUniqueSelector,
            document,
        );
        this.manualTabStopListener = new AllFrameRunner<TabStopEvent>(
            this.frameMessenger,
            htmlElementUtils,
            this.windowUtils,
            singleFrameListener,
        );
        this.manualTabStopListener.initialize();

        const tabbableElementGetter = new TabbableElementGetter(
            document,
            getUniqueSelector,
            tabbable,
        );
        const tabStopRequirementEvaluator = new DefaultTabStopsRequirementEvaluator(
            htmlElementUtils,
            getUniqueSelector,
        );
        const tabStopsOrchestrator = new TabStopRequirementOrchestrator(
            document,
            tabbableElementGetter,
            this.windowUtils,
            tabStopRequirementEvaluator,
            getUniqueSelector,
        );
        this.tabStopRequirementRunner = new AllFrameRunner<TabStopRequirementResult>(
            this.frameMessenger,
            htmlElementUtils,
            this.windowUtils,
            tabStopsOrchestrator,
        );
        this.tabStopRequirementRunner.initialize();

        const drawerProvider = new DrawerProvider(
            htmlElementUtils,
            this.windowUtils,
            new NavigatorUtils(window.navigator, logger),
            new ShadowUtils(new HTMLElementUtils()),
            new DrawerUtils(document),
            this.clientUtils,
            document,
            this.frameMessenger,
            this.browserAdapter,
            getRTL,
            new DetailsDialogHandler(htmlElementUtils, this.windowUtils),
        );
        this.drawingController = new DrawingController(
            this.frameMessenger,
            new HtmlElementAxeResultsHelper(htmlElementUtils, logger),
            htmlElementUtils,
        );
        this.scrollingController = new ScrollingController(this.frameMessenger, htmlElementUtils);
        this.frameUrlFinder = new FrameUrlFinder(
            this.frameMessenger,
            this.windowUtils,
            htmlElementUtils,
        );
        this.windowMessagePoster.initialize();
        this.respondableCommandMessageCommunicator.initialize();
        this.drawingController.initialize();
        this.scrollingController.initialize();
        this.frameUrlFinder.initialize();

        const visualizationTypeDrawerRegistrar = new VisualizationTypeDrawerRegistrar(
            this.drawingController.registerDrawer,
            this.visualizationConfigurationFactory,
            Assessments,
            drawerProvider,
        );

        EnumHelper.getNumericValues(VisualizationType).forEach(
            visualizationTypeDrawerRegistrar.registerType,
        );

        const port = this.browserAdapter.connect();
        port.onDisconnect.addListener(() => this.dispose());

        this.elementFinderByPosition = new ElementFinderByPosition(
            this.frameMessenger,
            this.clientUtils,
            getUniqueSelector,
            document,
        );
        this.elementFinderByPosition.initialize();

        this.elementFinderByPath = new ElementFinderByPath(htmlElementUtils, this.frameMessenger);
        this.elementFinderByPath.initialize();

        await Promise.all(asyncInitializationSteps);
    }