michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let tab = gBrowser.addTab("http://example.com"); michael@0: michael@0: tab.linkedBrowser.addEventListener("load", function() { michael@0: tab.linkedBrowser.removeEventListener("load", arguments.callee, true); michael@0: michael@0: let numLocationChanges = 0; michael@0: michael@0: let listener = { michael@0: onLocationChange: function() { michael@0: numLocationChanges++; michael@0: } michael@0: }; michael@0: michael@0: gBrowser.addTabsProgressListener(listener); michael@0: michael@0: // pushState to a new URL (http://example.com/foo"). This should trigger michael@0: // exactly one LocationChange event. michael@0: tab.linkedBrowser.contentWindow.history.pushState(null, null, "foo"); michael@0: michael@0: executeSoon(function() { michael@0: gBrowser.removeTab(tab); michael@0: gBrowser.removeTabsProgressListener(listener); michael@0: is(numLocationChanges, 1, michael@0: "pushState should cause exactly one LocationChange event."); michael@0: finish(); michael@0: }); michael@0: michael@0: }, true); michael@0: }