mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(webdriver): prefer globalThis over window to make it work in Firefox (#12438)
This commit is contained in:
@@ -21,11 +21,16 @@ export const ariaQuerySelector = (
|
||||
root: Node,
|
||||
selector: string
|
||||
): Promise<Node | null> => {
|
||||
return window.__ariaQuerySelector(root, selector);
|
||||
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
|
||||
return (globalThis as unknown as Window).__ariaQuerySelector(root, selector);
|
||||
};
|
||||
export const ariaQuerySelectorAll = async function* (
|
||||
root: Node,
|
||||
selector: string
|
||||
): AsyncIterable<Node> {
|
||||
yield* await window.__ariaQuerySelectorAll(root, selector);
|
||||
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
|
||||
yield* await (globalThis as unknown as Window).__ariaQuerySelectorAll(
|
||||
root,
|
||||
selector
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user