"WebDriver:SwitchToWindow" can fail when window is closed at the same time (TypeError: can't access property "addMessageListener", this.mm is null)
Categories
(Remote Protocol :: Marionette, defect, P1)
Tracking
(firefox81 fixed, firefox82 fixed)
People
(Reporter: whimboo, Assigned: whimboo)
References
()
Details
Attachments
(1 file)
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
Originally filed as https://github.com/mozilla/geckodriver/issues/1770
When WebDriver:SwitchToWindow
is called at the exact same time as when the target window gets closed, the following exception will be raised:
1599480854548 Marionette DEBUG 3 -> [0,18,"WebDriver:SwitchToWindow",{"handle":"40","focus":true}]
1599480854554 Marionette TRACE Received DOM event TabSelect for [object XULElement]
1599480854572 Marionette DEBUG 3 <- [1,18,{"error":"unknown error","message":"TypeError: can't access property \"addMessageListener\", this.mm is null","stacktra ... ementEventTarget@chrome://marionette/content/dom.js:46:5\nswitchToTab@chrome://marionette/content/browser.js:491:26\n"},null]
Marionette threw an error: TypeError: can't access property "addMessageListener", this.mm is null
WebElementEventTarget@chrome://marionette/content/dom.js:46:5
switchToTab@chrome://marionette/content/browser.js:491:26
The best solution here would be to move all the code in setWindowHandle()
into a try/catch and raise a NoSuchWindowError
instead.
Assignee | ||
Comment 1•4 years ago
|
||
There is a race condition in the "WebDriver:SwitchToWindow" command
that would throw an UnknownError instead of NoSuchWindowError when
the window gets closed at the same time as the command gets called.
Updated•4 years ago
|
Comment 2•4 years ago
|
||
Hi Henrik. Should this bug be included as part of the Marionette MVP?
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
(In reply to Marco Mucci [:MarcoM] from comment #2)
Hi Henrik. Should this bug be included as part of the Marionette MVP?
You can consider "No" when we don't set the whiteboard entry.
Comment 5•4 years ago
|
||
bugherder |
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
Comment on attachment 9174224 [details]
Bug 1663429 - [marionette] Only throw NoSuchWindow error in "WebDriver:SwitchToWindow".
Beta/Release Uplift Approval Request
- User impact if declined: There is a race condition where WebDriver tests can fail if a switch to a tab happens at the same time when it gets closed. In such cases we don't return the expected error type as given by the WebDriver specification.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): The code only catches further possible errors and returns the correct error type.
- String changes made/needed: no
Comment 7•4 years ago
|
||
Comment on attachment 9174224 [details]
Bug 1663429 - [marionette] Only throw NoSuchWindow error in "WebDriver:SwitchToWindow".
This needs a rebased patch for Beta.
Assignee | ||
Comment 8•4 years ago
|
||
Here the try build with the rebased patch:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=60c5358ed8e176cb703b45c2f36711d3780832d7
The commit is:
https://hg.mozilla.org/try/rev/91dff485fcda25fcf772f9997128441506887aad
Comment 9•4 years ago
|
||
Comment on attachment 9174224 [details]
Bug 1663429 - [marionette] Only throw NoSuchWindow error in "WebDriver:SwitchToWindow".
Approved for 81.0b9.
Comment 10•4 years ago
|
||
bugherder uplift |
Updated•2 years ago
|
Comment hidden (Intermittent Failures Robot) |
Description
•