diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py index 22794aa7fa39..4b4dbd5fa8ab 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py @@ -340,6 +340,7 @@ class TestClickNavigation(MarionetteTestCase): self.marionette.go_back() self.marionette.find_element(By.ID, "anchor") + self.marionette.find_element(By.ID, "history-back").click() with self.assertRaises(errors.NoSuchElementException): self.marionette.find_element(By.ID, "anchor") diff --git a/testing/marionette/listener.js b/testing/marionette/listener.js index f1c7447362f4..7c1a5919a72b 100644 --- a/testing/marionette/listener.js +++ b/testing/marionette/listener.js @@ -206,7 +206,8 @@ var loadListener = { * Callback for registered DOM events. */ handleEvent: function (event) { - logger.debug(`Received DOM event "${event.type}" for "${event.originalTarget.baseURI}"`); + let location = event.target.baseURI || event.target.location.href; + logger.debug(`Received DOM event "${event.type}" for "${location}"`); switch (event.type) { case "unload": @@ -227,8 +228,10 @@ var loadListener = { break; case "hashchange": - this.stop(); - sendOk(this.command_id); + if (event.target === curContainer.frame) { + this.stop(); + sendOk(this.command_id); + } break; case "DOMContentLoaded":