fune/browser/base/content/test/urlbar/browser_populateAfterPushState.js
Gijs Kruitbosch 22172a0279 Bug 1441039 - same-document changes should cause empty URL bar to fill back up for current tab, r=mak
Make URLBarSetURI more explicit about what it's looking for in `value`,
and ensure the tabbrowser's progress listeners reset the userTypeValue if it's
empty already and there's a same-site document change.

Differential Revision: https://phabricator.services.mozilla.com/D2181

--HG--
extra : moz-landing-system : lando
2018-07-19 10:47:23 +00:00

23 lines
1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* When a user clears the URL bar, and then the page pushes state, we should
* re-fill the URL bar so it doesn't remain empty indefinitely. See bug 1441039.
* For normal loads, this happens automatically because a non-same-document state
* change takes place.
*/
add_task(async function() {
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
await BrowserTestUtils.withNewTab(TEST_PATH + "dummy_page.html", async function(browser) {
gURLBar.value = "";
let locationChangePromise = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_PATH + "dummy_page2.html");
await ContentTask.spawn(browser, null, function() {
content.history.pushState({}, "Page 2", "dummy_page2.html");
});
await locationChangePromise;
ok(gURLBar.value, TEST_PATH + "dummy_page2.html", "Should have updated the URL bar.");
});
});