Open Bug 1918277 Opened 1 month ago Updated 5 days ago

Intermittent AriaQueryHandler waitForSelector (aria) should throw when frame is detached (ariaqueryhandler.spec.js) | expected PASS

Categories

(Remote Protocol :: Agent, defect, P5)

defect

Tracking

(Not tracked)

People

(Reporter: intermittent-bug-filer, Unassigned)

References

Details

(Keywords: intermittent-failure)

Filed by: nerli [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=473922592&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/HJis5I0mTRmJat6TdV9sBw/runs/0/artifacts/public/logs/live_backing.log


[task 2024-09-11T23:47:51.921Z] PID 752 | 1726098471920	RemoteAgent	DEBUG	WebDriverBiDiConnection 2f7ad453-e6c7-465b-b6b6-2c8ea47139a4 <- {"type":"success","id":677,"result":{"realm":"8ff23d7c-8e07-45d8-86c3-0ff47c9de2c8","type":"success","result":{"type":"undefined"}}}
[task 2024-09-11T23:47:51.955Z] TEST-UNEXPECTED-FAIL | AriaQueryHandler waitForSelector (aria) should throw when frame is detached (ariaqueryhandler.spec.js) | expected PASS
[task 2024-09-11T23:47:51.955Z] TEST-INFO took 226ms
[task 2024-09-11T23:47:51.956Z] PID 752 | ["fail",{"title":"should throw when frame is detached","fullTitle":"AriaQueryHandler waitForSelector (aria) should throw when frame is detached","file":"/builds/worker/checkouts/gecko/remote/test/puppeteer/test/build/ariaqueryhandler.spec.js","duration":225,"currentRetry":0,"err":"\"Waiting for selector `does-not-exist` failed: Protocol error (script.evaluate): no such frame No window found for BrowsingContext with id 53687091201 RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5\nNoSuchFrameError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:572:5\n#getBrowsingContext@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:792:13\n#getContextFromTarget@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:802:38\nevaluate@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:488:53\nhandleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:255:33\nexecute@chrome://remote/content/shared/webdriver/Session.sys.mjs:390:32\nonPacket@chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs:228:37\nonMessage@chrome://remote/content/server/WebSocketTransport.sys.mjs:127:18\nhandleEvent@chrome://remote/content/server/WebSocketTransport.sys.mjs:109:14\n\" didn't contain any of the strings [\"waitForFunction failed: frame got detached.\",\"Browsing context already closed.\"]","stack":"Error: \"Waiting for selector `does-not-exist` failed: Protocol error (script.evaluate): no such frame No window found for BrowsingContext with id 53687091201 RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5\nNoSuchFrameError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:572:5\n#getBrowsingContext@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:792:13\n#getContextFromTarget@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:802:38\nevaluate@chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs:488:53\nhandleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:255:33\nexecute@chrome://remote/content/shared/webdriver/Session.sys.mjs:390:32\nonPacket@chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs:228:37\nonMessage@chrome://remote/content/server/WebSocketTransport.sys.mjs:127:18\nhandleEvent@chrome://remote/content/server/WebSocketTransport.sys.mjs:109:14\n\" didn't contain any of the strings [\"waitForFunction failed: frame got detached.\",\"Browsing context already closed.\"]\n    at Context.<anonymous> (/builds/worker/checkouts/gecko/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts:442:33)"}]
[task 2024-09-11T23:47:51.956Z] PID 752 | 1726098471955	RemoteAgent	DEBUG	WebDriverBiDiConnection 2f7ad453-e6c7-465b-b6b6-2c8ea47139a4 -> {"id":683,"method":"browser.removeUserContext","params":{"userContext":"0a87f6da-6f20-4005-9edc-f501696b1264"}}
[task 2024-09-11T23:47:51.956Z] PID 752 | 1726098471955	RemoteAgent	TRACE	Received command browser.removeUserContext for destination ROOT

The failure happens in line 442 when the error message is compared:

https://searchfox.org/mozilla-central/rev/14a66905574728bc9eb60e927d17d98721167dcf/remote/test/puppeteer/test/src/ariaqueryhandler.spec.ts#434-445

Here the following failure is visible:

Protocol error (script.evaluate): no such frame No window found for BrowsingContext with id 53687091201

Allowed messages are:

       'waitForFunction failed: frame got detached.',
        'Browsing context already closed.',

Both error messages seem to come from Puppeteer internal code.

Alex, do you have an idea where this could come from? It only happened once so far so it has low priority but it's an interesting case.

Flags: needinfo?(alexrudenko)

So "Protocol error (script.evaluate): no such frame No window found for BrowsingContext with id 53687091201" is coming from the browser I believe. And "Browsing context already closed." is the message we set when the browsing context is destroyed and an evaluate call is attempted.
'waitForFunction failed: frame got detached.' is set by Puppeteer when a realm is destroyed. Depending on when exactly the waitForFunction is running when the frame is detached these messages are possible.

Maybe we should also handle no such frame errors. So far we only handled errors defined in WaitTask.getBadError.

Flags: needinfo?(alexrudenko)

I can see failures with currentWindowGlobal being null. As such the patch on bug 1923899 should fix it.

Depends on: 1923899

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #8)

I can see failures with currentWindowGlobal being null. As such the patch on bug 1923899 should fix it.

With the patch from Julian landed we are now back to the failure:

Protocol error (script.evaluate): no such frame No window found for BrowsingContext with id 53687091201

You need to log in before you can comment on or make changes to this bug.