Bug 1543549 - Only switch_to_window() if we have a handle to it. r=jgraham

On android wpt reftests, the window handles list is empty, so we can't use it to switch to a window. Not doing this in that case doesn't seem to break anything, and not doing it in that case prevents the IndexError from being logged to the error log.

Differential Revision: https://phabricator.services.mozilla.com/D27177

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Wes Kocher 2019-04-12 08:59:43 +00:00
parent 7af4153e81
commit a57c781b04

View File

@ -897,7 +897,8 @@ class InternalRefTestImplementation(RefTestImplementation):
# with after closing a window we need to give a new window
# focus
handles = self.executor.protocol.marionette.window_handles
self.executor.protocol.marionette.switch_to_window(handles[0])
if handles:
self.executor.protocol.marionette.switch_to_window(handles[0])
except Exception as e:
# Ignore errors during teardown
self.logger.warning(traceback.format_exc(e))