Skip to content

Commit

Permalink
Bug 1378191 - Use JSON to send capabilities in "Marionette:listenersA…
Browse files Browse the repository at this point in the history
…ttached" r=automatedtester

By not using the JSON format when sending the capabilities to the
frame script, the values cannot be correctly decoded. As result
the capabilities will be reset to their default values for the
listener, and can cause various failures.

MozReview-Commit-ID: KaryoJiyd30
  • Loading branch information
whimboo committed Jul 4, 2017
1 parent 005357a commit f0f9f0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion testing/marionette/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3181,7 +3181,7 @@ GeckoDriver.prototype.receiveMessage = function(message) {
// If remoteness gets updated we need to call newSession. In the case
// of desktop this just sets up a small amount of state that doesn't
// change over the course of a session.
this.sendAsync("newSession", this.capabilities);
this.sendAsync("newSession", this.capabilities.toJSON());
this.curBrowser.flushPendingCommands();
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,20 +613,22 @@ def test_deactivation(self):

class TestPageLoadStrategy(BaseNavigationTestCase):

def setUp(self):
super(TestPageLoadStrategy, self).setUp()
def tearDown(self):
self.marionette.delete_session()
self.marionette.start_session()

if self.marionette.session is not None:
self.marionette.delete_session()
super(TestPageLoadStrategy, self).tearDown()

def test_none(self):
self.marionette.delete_session()
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "none"}})

# With a strategy of "none" there should be no wait for the page load, and the
# current load state is unknown. So only test that the command executes successfully.
self.marionette.navigate(self.test_page_slow_resource)

def test_eager(self):
self.marionette.delete_session()
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "eager"}})

self.marionette.navigate(self.test_page_slow_resource)
Expand All @@ -635,9 +637,23 @@ def test_eager(self):
self.marionette.find_element(By.ID, "slow")

def test_normal(self):
self.marionette.delete_session()
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "normal"}})

self.marionette.navigate(self.test_page_slow_resource)
self.assertEqual(self.test_page_slow_resource, self.marionette.get_url())
self.assertEqual("complete", self.ready_state)
self.marionette.find_element(By.ID, "slow")

@run_if_e10s("Requires e10s mode enabled")
def test_strategy_after_remoteness_change(self):
"""Bug 1378191 - Reset of capabilities after listener reload"""
self.marionette.delete_session()
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "eager"}})

# Trigger a remoteness change which will reload the listener script
self.assertTrue(self.is_remote_tab, "Initial tab doesn't have remoteness flag set")
self.marionette.navigate("about:robots")
self.assertFalse(self.is_remote_tab, "Tab has remoteness flag set")
self.marionette.navigate(self.test_page_slow_resource)
self.assertEqual("interactive", self.ready_state)

0 comments on commit f0f9f0d

Please sign in to comment.