2010-05-02 08:31:07 +00:00
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
let tab = gBrowser.addTab("http://example.com");
|
|
|
|
|
2011-06-07 14:45:26 +00:00
|
|
|
tab.linkedBrowser.addEventListener("load", function() {
|
|
|
|
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
|
2010-05-02 08:31:07 +00:00
|
|
|
let numLocationChanges = 0;
|
|
|
|
|
|
|
|
let listener = {
|
|
|
|
onLocationChange: function() {
|
|
|
|
numLocationChanges++;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-06-12 05:43:58 +00:00
|
|
|
gBrowser.addTabsProgressListener(listener);
|
2010-05-02 08:31:07 +00:00
|
|
|
|
|
|
|
// pushState to a new URL (http://example.com/foo"). This should trigger
|
|
|
|
// exactly one LocationChange event.
|
|
|
|
tab.linkedBrowser.contentWindow.history.pushState(null, null, "foo");
|
|
|
|
|
|
|
|
executeSoon(function() {
|
2010-06-12 05:43:58 +00:00
|
|
|
gBrowser.removeTab(tab);
|
|
|
|
gBrowser.removeTabsProgressListener(listener);
|
2010-05-02 08:31:07 +00:00
|
|
|
is(numLocationChanges, 1,
|
|
|
|
"pushState should cause exactly one LocationChange event.");
|
|
|
|
finish();
|
|
|
|
});
|
|
|
|
|
|
|
|
}, true);
|
|
|
|
}
|