Bug 1265208: Restore url if the value of inputed bar that had been inputting is empty upon switching tab. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D118125
This commit is contained in:
Daisuke Akatsuka 2021-06-21 02:30:06 +00:00
Родитель e40714855d
Коммит 0142cb5790
2 изменённых файлов: 7 добавлений и 6 удалений

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

@ -325,10 +325,11 @@ class UrlbarInput {
let value = this.window.gBrowser.userTypedValue;
let valid = false;
// Explicitly check for nulled out value. We don't want to reset the URL
// bar if the user has deleted the URL and we'd just put the same URL
// back. See bug 304198.
if (value === null) {
// Restore the selected browser's current URI if `value` is null or if it's
// an empty string and we're switching tabs. In the latter case, when the
// user makes the input empty, switches tabs, and switches back, we want the
// URI to become visible again so the user knows what URI they're viewing.
if (value === null || (!value && dueToTabSwitch)) {
uri = uri || this.window.gBrowser.currentURI;
// Strip off usernames and passwords for the location bar
try {

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

@ -77,8 +77,8 @@ add_task(async function() {
await BrowserTestUtils.switchTab(gBrowser, deletedURLTab);
is(
gURLBar.value,
"",
'gURLBar.value should be "" after switching back to deletedURLTab'
testURL,
"gURLBar.value should be testURL after switching back to deletedURLTab"
);
await BrowserTestUtils.switchTab(gBrowser, fullURLTab);