Closed Bug 1932916 Opened 3 months ago Closed 3 months ago

"TypeError: can't access property "getActor", browsingContext.currentWindowGlobal is null" when an action closes the window

Categories

(Remote Protocol :: Agent, defect, P2)

defect
Points:
5

Tracking

(firefox135 fixed)

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: whimboo)

References

(Blocks 2 open bugs)

Details

(Keywords: intermittent-failure, intermittent-testcase, Whiteboard: [webdriver:m14], [wptsync upstream])

Attachments

(3 files)

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


[task 2024-11-21T22:29:17.045Z] 22:29:17     INFO -  1732228157045	Marionette	DEBUG	2 -> [0,255,"WebDriver:PerformActions",{"actions":[{"type":"key","id":"keyboard_id","actions":[{"type":"keyDown","value":"\ue009"},{"type":"keyDown","value":"w"},{"type":"keyUp","value":"w"},{"type":"keyUp","value":"\ue009"}]}]}]
[task 2024-11-21T22:29:17.052Z] 22:29:17     INFO -  1732228157051	Marionette	TRACE	Dispatching tick 1/4
[task 2024-11-21T22:29:17.053Z] 22:29:17     INFO -  1732228157052	Marionette	TRACE	 Dispatch KeyDownAction with keyboard_id \ue009
[task 2024-11-21T22:29:17.063Z] 22:29:17     INFO -  1732228157063	Marionette	TRACE	Dispatching tick 2/4
[task 2024-11-21T22:29:17.064Z] 22:29:17     INFO -  1732228157063	Marionette	TRACE	 Dispatch KeyDownAction with keyboard_id w
[task 2024-11-21T22:29:17.108Z] 22:29:17     INFO -  1732228157108	Marionette	TRACE	Dispatching tick 3/4
[task 2024-11-21T22:29:17.109Z] 22:29:17     INFO -  1732228157108	Marionette	TRACE	 Dispatch KeyUpAction with keyboard_id w
[task 2024-11-21T22:29:17.110Z] 22:29:17     INFO -  1732228157108	Marionette	DEBUG	2 <- [1,255,{"error":"unknown error","message":"TypeError: can't access property \"getActor\", browsingContext.currentWindowGlobal is null","stacktrace":"getMarionetteCommandsActorProxy/get/<@chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs:409:17\ndispa ... chrome://remote/content/shared/webdriver/Actions.sys.mjs:2597:27\nobserve@resource://gre/modules/AsyncShutdown.sys.mjs:569:17\n"},null]
[task 2024-11-21T22:29:17.110Z] 22:29:17     INFO -  Marionette threw an error: TypeError: can't access property "getActor", browsingContext.currentWindowGlobal is null
[task 2024-11-21T22:29:17.110Z] 22:29:17     INFO -  getMarionetteCommandsActorProxy/get/<@chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs:409:17
[task 2024-11-21T22:29:17.110Z] 22:29:17     INFO -  dispatchEvent@chrome://remote/content/marionette/driver.sys.mjs:168:44
[task 2024-11-21T22:29:17.111Z] 22:29:17     INFO -  dispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:1141:11
[task 2024-11-21T22:29:17.111Z] 22:29:17     INFO -  dispatch/pendingEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2705:14
[task 2024-11-21T22:29:17.111Z] 22:29:17     INFO -  dispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2704:39
[task 2024-11-21T22:29:17.111Z] 22:29:17     INFO -  dispatch/chainEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2597:27
[task 2024-11-21T22:29:17.112Z] 22:29:17     INFO -  observe@resource://gre/modules/AsyncShutdown.sys.mjs:569:17
[task 2024-11-21T22:29:17.113Z] 22:29:17     INFO -  console.error: "Marionette threw an error: TypeError: can't access property \"getActor\", browsingContext.currentWindowGlobal is null\ngetMarionetteCommandsActorProxy/get/<@chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs:409:17\ndispatchEvent@chrome://remote/content/marionette/driver.sys.mjs:168:44\ndispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:1141:11\ndispatch/pendingEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2705:14\ndispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2704:39\ndispatch/chainEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2597:27\nobserve@resource://gre/modules/AsyncShutdown.sys.mjs:569:17\n"
[task 2024-11-21T22:29:17.602Z] 22:29:17     INFO -  1732228157602	Marionette	TRACE	Received observer notification quit-application
[task 2024-11-21T22:29:17.603Z] 22:29:17     INFO -  1732228157603	Marionette	DEBUG	Marionette stopped listening
[task 2024-11-21T22:29:17.605Z] 22:29:17     INFO -  1732228157604	Marionette	TRACE	[1] MarionetteCommands actor destroyed for window id 2
[task 2024-11-21T22:29:17.613Z] 22:29:17     INFO -  1732228157612	Marionette	DEBUG	2 -> [0,256,"Marionette:AcceptConnections",{"value":true}]
[task 2024-11-21T22:29:17.613Z] 22:29:17     INFO -  1732228157613	Marionette	INFO	Listening on port 2828
[task 2024-11-21T22:29:17.614Z] 22:29:17     INFO -  1732228157613	Marionette	DEBUG	2 <- [1,256,null,{"value":null}]
[task 2024-11-21T22:29:17.621Z] 22:29:17     INFO -  JavaScript error: chrome://remote/content/marionette/cert.sys.mjs, line 47: NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsICertOverrideService.setDisableAllSecurityChecksAndLetAttackersInterceptMyData]
[task 2024-11-21T22:29:17.866Z] 22:29:17     INFO -  Failed to gather test failure debug: Process has been unexpectedly closed (Exit code: 0) (Reason: [WinError 10053] An established connection was aborted by the software in your host machine)
[task 2024-11-21T22:29:17.874Z] 22:29:17    ERROR -  TEST-UNEXPECTED-ERROR | browser/components/sessionstore/test/marionette/test_restore_windows_after_close_last_tabs.py TestSessionStoreEnabledAllWindows.test_close_tabs | marionette_driver.errors.UnknownException: TypeError: can't access property "getActor", browsingContext.currentWindowGlobal is null
[task 2024-11-21T22:29:17.874Z] 22:29:17     INFO -  stacktrace:
[task 2024-11-21T22:29:17.874Z] 22:29:17     INFO -  	getMarionetteCommandsActorProxy/get/<@chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs:409:17
[task 2024-11-21T22:29:17.874Z] 22:29:17     INFO -  	dispatchEvent@chrome://remote/content/marionette/driver.sys.mjs:168:44
[task 2024-11-21T22:29:17.875Z] 22:29:17     INFO -  	dispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:1141:11
[task 2024-11-21T22:29:17.875Z] 22:29:17     INFO -  	dispatch/pendingEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2705:14
[task 2024-11-21T22:29:17.875Z] 22:29:17     INFO -  	dispatch@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2704:39
[task 2024-11-21T22:29:17.875Z] 22:29:17     INFO -  	dispatch/chainEvents<@chrome://remote/content/shared/webdriver/Actions.sys.mjs:2597:27
[task 2024-11-21T22:29:17.876Z] 22:29:17     INFO -  	observe@resource://gre/modules/AsyncShutdown.sys.mjs:569:17

It looks like we missed this case when working on bug 1662808. The following comment explicitly states that it should have been done:

https://searchfox.org/mozilla-central/rev/5da13af5e6be251b70e994c8b4bd35fb5271f1e3/remote/marionette/actors/MarionetteCommandsParent.sys.mjs#402-407

If the window actually got closed by eg. pressing a shortcut like Ctrl/Cmd+W we should handle it gracefully and not retrying to run the action.

This blocks enabling async events by default on bug 1922077.

Blocks: 1922077
See Also: → 1662808
Summary: Intermittent browser/components/sessionstore/test/marionette/test_restore_windows_after_close_last_tabs.py | single tracking bug → "TypeError: can't access property "getActor", browsingContext.currentWindowGlobal is null" when an action closes the window
Severity: S4 → S3
Points: --- → 3
Priority: P5 → P2
Whiteboard: [webdriver:m14]

To handle that case we as well need an update of the WebDriver specification: https://github.com/w3c/webdriver/pull/1861

Actually this is not only an issue with Marionette but also with our implementation of the RootTransport as used in WebDriver BiDi`.

Component: Marionette → Agent

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

To handle that case we as well need an update of the WebDriver specification: https://github.com/w3c/webdriver/pull/1861

This PR got merged so that I'm unblocked for this bug.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Points: 3 → 5
Blocks: 1934326
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a8d71ef02fc4 [remote] Throw DiscardedBrowsingContextError if currentWindowGlobal cannot be found in waitForCurrentWindowGlobal().. r=webdriver-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/0d3362d9b4e9 [remote] Don't retry to run a command when the browsing context was discarded. r=webdriver-reviewers,sessionstore-reviewers,jdescottes,sclements https://hg.mozilla.org/integration/autoland/rev/0bab96f9e196 [wdspec] Add "Perform Actions" tests for a scenario when an action discards a navigable. r=webdriver-reviewers,jdescottes
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/49469 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m14] → [webdriver:m14], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
Upstream PR merged by moz-wptsync-bot
See Also: → 1935324
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: