From dda4c0dfef93b30e1f60b5a1c18b6c651c6cd227 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 24 Apr 2024 11:33:00 +0200 Subject: [PATCH] performance: turn on a11y caches (#2153) Fixes [OOM](https://crbug.com/336718011) from trying to re-build a11y caches. --- src/bidiMapper/modules/context/BrowsingContextImpl.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bidiMapper/modules/context/BrowsingContextImpl.ts b/src/bidiMapper/modules/context/BrowsingContextImpl.ts index dd9683c3e..dc0d87d0b 100644 --- a/src/bidiMapper/modules/context/BrowsingContextImpl.ts +++ b/src/bidiMapper/modules/context/BrowsingContextImpl.ts @@ -1234,6 +1234,15 @@ export class BrowsingContextImpl { 'Either name or role has to be specified' ); } + + // The next two commands cause a11y caches for the target to be + // preserved. We probably do not need to disable them if the + // client is using a11y features but we could by calling + // Accessibility.disable. + await Promise.all([ + this.#cdpTarget.cdpClient.sendCommand('Accessibility.enable'), + this.#cdpTarget.cdpClient.sendCommand('Accessibility.getRootAXNode'), + ]); const bindings = await realm.evaluate( /* expression=*/ '({getAccessibleName, getAccessibleRole})', /* awaitPromise=*/ false,