Skip to content

Commit

Permalink
fix(webdriver): prefer globalThis over window to make it work in Fire…
Browse files Browse the repository at this point in the history
…fox (#12438)
  • Loading branch information
OrKoN committed May 14, 2024
1 parent 0ef1920 commit 33c6069
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 7 additions & 2 deletions packages/puppeteer-core/src/injected/ARIAQuerySelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
};
7 changes: 0 additions & 7 deletions test/TestExpectations.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@
"expectations": ["FAIL"],
"comment": "WebDriver BiDi locateNodes does not support shadow roots so far"
},
{
"testIdPattern": "[ariaqueryhandler.spec] AriaQueryHandler waitForSelector *",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"],
"comment": "TODO: Needs investigation"
},
{
"testIdPattern": "[autofill.spec] *",
"platforms": ["darwin", "linux", "win32"],
Expand Down

0 comments on commit 33c6069

Please sign in to comment.