Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Bug 1169180 - Workaround latent race caused by interacting with newly…
Browse files Browse the repository at this point in the history
… opened chrome windows too soon. r=whimboo

(cherry picked from commit b70fbbf)
  • Loading branch information
chmanchester authored and whimboo committed Jun 4, 2015
1 parent 2d36192 commit ab5010b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion firefox_puppeteer/ui/windows.py
Expand Up @@ -95,6 +95,14 @@ def create_window_instance(self, handle, expected_class=None):
window = None

try:
# Bug 1169180 - Workaround for handling newly opened chrome windows
# Once fixed revert back to make use of self.loaded
Wait(self.marionette).until(lambda mn: self.marionette.execute_script("""
Components.utils.import("resource://gre/modules/Services.jsm");
let win = Services.wm.getOuterWindowWithId(Number(arguments[0]));
return win.document.readyState == 'complete';
""", script_args=[handle]))

# Retrieve window type to determine the type of chrome window
if handle != self.marionette.current_chrome_window_handle:
self.switch_to(handle)
Expand Down Expand Up @@ -340,7 +348,6 @@ def window_opened(mn):
assert new_handle is not None

window = self._windows.create_window_instance(new_handle, expected_window_class)
Wait(self.marionette).until(lambda _: window.loaded)

Wait(self.marionette).until(lambda _: window.focused == expect_focus)

Expand Down

0 comments on commit ab5010b

Please sign in to comment.