Bug 1360466 - Only handle hashchange event for the current window. r=ato

Similar to the other unload and load events during a page load,
the hashchange event should only be handled if the event's target
document is the current window.

MozReview-Commit-ID: F1LMBh5Cy4A

--HG--
extra : rebase_source : 668fd6946067989e7e732b24baf6de2e85541f21
This commit is contained in:
Henrik Skupin 2017-04-28 14:16:59 +02:00
Родитель 5b9b18e398
Коммит ea0737e52e
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -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")

Просмотреть файл

@ -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":