Skip to content

Commit c9b6fbb

Browse files
committed
Bug 1378191 - Use JSON to send capabilities in "Marionette:listenersAttached" 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 --HG-- extra : rebase_source : 206e45755d3ea9b6cbf2f2022a9a364dcf22d78e
1 parent 0a0f015 commit c9b6fbb

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

testing/marionette/driver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3181,7 +3181,7 @@ GeckoDriver.prototype.receiveMessage = function(message) {
31813181
// If remoteness gets updated we need to call newSession. In the case
31823182
// of desktop this just sets up a small amount of state that doesn't
31833183
// change over the course of a session.
3184-
this.sendAsync("newSession", this.capabilities);
3184+
this.sendAsync("newSession", this.capabilities.toJSON());
31853185
this.curBrowser.flushPendingCommands();
31863186
}
31873187
break;

testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,20 +613,22 @@ def test_deactivation(self):
613613

614614
class TestPageLoadStrategy(BaseNavigationTestCase):
615615

616-
def setUp(self):
617-
super(TestPageLoadStrategy, self).setUp()
616+
def tearDown(self):
617+
self.marionette.delete_session()
618+
self.marionette.start_session()
618619

619-
if self.marionette.session is not None:
620-
self.marionette.delete_session()
620+
super(TestPageLoadStrategy, self).tearDown()
621621

622622
def test_none(self):
623+
self.marionette.delete_session()
623624
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "none"}})
624625

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

629630
def test_eager(self):
631+
self.marionette.delete_session()
630632
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "eager"}})
631633

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

637639
def test_normal(self):
640+
self.marionette.delete_session()
638641
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "normal"}})
639642

640643
self.marionette.navigate(self.test_page_slow_resource)
641644
self.assertEqual(self.test_page_slow_resource, self.marionette.get_url())
642645
self.assertEqual("complete", self.ready_state)
643646
self.marionette.find_element(By.ID, "slow")
647+
648+
@run_if_e10s("Requires e10s mode enabled")
649+
def test_strategy_after_remoteness_change(self):
650+
"""Bug 1378191 - Reset of capabilities after listener reload"""
651+
self.marionette.delete_session()
652+
self.marionette.start_session({"desiredCapabilities": {"pageLoadStrategy": "eager"}})
653+
654+
# Trigger a remoteness change which will reload the listener script
655+
self.assertTrue(self.is_remote_tab, "Initial tab doesn't have remoteness flag set")
656+
self.marionette.navigate("about:robots")
657+
self.assertFalse(self.is_remote_tab, "Tab has remoteness flag set")
658+
self.marionette.navigate(self.test_page_slow_resource)
659+
self.assertEqual("interactive", self.ready_state)

0 commit comments

Comments
 (0)