mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-02-06 02:30:56 +00:00
34 lines
962 B
JavaScript
34 lines
962 B
JavaScript
function test() {
|
|
waitForExplicitFinish();
|
|
|
|
let tab = gBrowser.addTab("http://example.com");
|
|
|
|
tab.linkedBrowser.addEventListener("load", function() {
|
|
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
let numLocationChanges = 0;
|
|
|
|
let listener = {
|
|
onLocationChange: function(browser, webProgress, request, uri, flags) {
|
|
info("location change: " + (uri && uri.spec));
|
|
numLocationChanges++;
|
|
}
|
|
};
|
|
|
|
gBrowser.addTabsProgressListener(listener);
|
|
|
|
// 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() {
|
|
gBrowser.removeTab(tab);
|
|
gBrowser.removeTabsProgressListener(listener);
|
|
is(numLocationChanges, 1,
|
|
"pushState should cause exactly one LocationChange event.");
|
|
finish();
|
|
});
|
|
|
|
}, true);
|
|
}
|