Closed Bug 1312675 Opened 8 years ago Closed 8 years ago

Try to close all open windows after each test

Categories

(Testing :: web-platform-tests, defect)

defect
Not set
normal

Tracking

(firefox52 fixed)

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: jgraham, Unassigned)

Details

Attachments

(1 file)

To reduce the possibility of leaking environments.
Comment on attachment 8804178 [details]
Bug 1312675 - Try harder to close existing windows after each testharness test,

https://reviewboard.mozilla.org/r/88290/#review87310

Can we see a try run before landing this?

::: testing/web-platform/harness/wptrunner/executors/executormarionette.py:128
(Diff revision 3)
> +    def set_timeout(self, timeout):
> +        self.marionette.set_script_timeout(timeout * 1000)
> +        self.timeout = timeout

Document that the `timeout` argument takes seconds.

::: testing/web-platform/harness/wptrunner/executors/executormarionette.py:157
(Diff revision 3)
> +        try:
> +            handles.remove(self.runner_handle)
> +            runner_handle = self.runner_handle
> +        except ValueError:
> +            # The runner window probably changed id but we can restore it
> +            runner_handle = handles[0]

It’s not guaranteed by the WebDriver spec that the handles are sorted, but I guess that is the case with Marionette currently… in any case it shouldn’t matter what window you continue with as long as the others are cleaned up.

::: testing/web-platform/harness/wptrunner/executors/executormarionette.py:157
(Diff revision 3)
> +            runner_handle = handles[0]
> +            handles = handles[1:]

`runner_handle = handles.pop(0)` to do this in one atomic action.

::: testing/web-platform/harness/wptrunner/executors/executormarionette.py:162
(Diff revision 3)
> +            runner_handle = handles[0]
> +            handles = handles[1:]
> +
> +        for handle in handles:
> +            self.marionette.switch_to_window(handle)
> +            self.marionette.close()

FYI I’m currently working on a patch that returns the number of window handles on calling `close()`.
Attachment #8804178 - Flags: review?(ato) → review+
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b71ce57f747f
Try harder to close existing windows after each testharness test, r=ato
https://hg.mozilla.org/mozilla-central/rev/b71ce57f747f
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: