Open Bug 1403528 Opened 2 years ago Updated 2 years ago

Remove special-casing of close()/closeChromeWindow() if only one tab/window is present

Categories

(Testing :: Marionette, enhancement, P3)

57 Branch
enhancement

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

Details

While trying to get a testcase with Marionette for bug 1403510 I noticed that we have this workaround in the driver for `close`:

https://dxr.mozilla.org/mozilla-central/source/testing/marionette/driver.js#2744-2749

I feel more and more that this is a wrong thing to do. Also because it causes inconsistencies between a click which triggers `window.close()`. I would expect that Marionette behaves exactly the same in both cases, which means it closes the tab/window even if only one is remaining.

I cannot remember why we actually put this code in place, and why we don't want to close the last window.

Andreas, what do you think?
Flags: needinfo?
Flags: needinfo? → needinfo?(ato)
A click that causes the window to close is not meant to end the
session given the current specification text.  It can be argued that
it should, but it’s not called out specifically at the moment.

Regarding the piece of code you referenced that returns an empty
array if WebDriver:CloseWindow is called and there is only one tlbc
open:

>   // If there is only one window left, do not close it. Instead return
>   // a faked empty array of window handles.  This will instruct geckodriver
>   // to terminate the application.
>   if (nwins === 1) {
>     return [];
>   }

This is there because it is geckodriver that needs to end the
Firefox child process.  If Marionette quits Firefox we are unable to
guarantee that the response is sent back to geckodriver before the
process exits.
Flags: needinfo?(ato)
[Mass Change 2018-01-15] Moving bugs to backlog
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.