Backed out changeset ffda592c113d (bug 1573924) for failures in browser_sessionRestore.js

This commit is contained in:
Noemi Erli 2019-08-24 02:43:14 +03:00
Родитель a9c174c337
Коммит e9426c83aa
3 изменённых файлов: 77 добавлений и 166 удалений

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

@ -2,19 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let aboutLogins = {
loaded: false,
handleEvent(event) {
// Run the initialization code for DOMContentLoaded and
// pageshow to handle normal loads and sessionrestore/bfcache.
if (this.loaded) {
return;
}
this.loaded = true;
this._onLoad(event);
},
_onLoad(event2) {
// The init code isn't wrapped in a DOMContentLoaded/load event listener so the
// page works properly when restored from session restore.
const gElements = {
fxAccountsButton: document.querySelector("fxaccounts-button"),
loginList: document.querySelector("login-list"),
@ -37,10 +26,7 @@ let aboutLogins = {
gElements.loginFilter.focus();
function updateNoLogins() {
document.documentElement.classList.toggle(
"no-logins",
numberOfLogins == 0
);
document.documentElement.classList.toggle("no-logins", numberOfLogins == 0);
gElements.loginList.classList.toggle("no-logins", numberOfLogins == 0);
}
@ -95,13 +81,4 @@ let aboutLogins = {
}
});
document.dispatchEvent(
new CustomEvent("AboutLoginsInit", { bubbles: true })
);
},
};
// Run the initialization code for DOMContentLoaded and
// pageshow to handle normal loads and sessionrestore/bfcache.
window.addEventListener("DOMContentLoaded", aboutLogins, { once: true });
window.addEventListener("pageshow", aboutLogins, { once: true });
document.dispatchEvent(new CustomEvent("AboutLoginsInit", { bubbles: true }));

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

@ -26,5 +26,4 @@ skip-if = (os != "win") # import is only available on Windows
[browser_openPreferences.js]
[browser_openPreferencesExternal.js]
[browser_openSite.js]
[browser_sessionRestore.js]
[browser_updateLogin.js]

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

@ -1,65 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const { TabState } = ChromeUtils.import(
"resource:///modules/sessionstore/TabState.jsm"
);
add_task(async function() {
TEST_LOGIN1 = await addLogin(TEST_LOGIN1);
const testGuid = TEST_LOGIN1.guid;
const tab = BrowserTestUtils.addTab(gBrowser, "about:logins");
const browser = gBrowser.getBrowserForTab(tab);
await BrowserTestUtils.browserLoaded(browser);
await ContentTask.spawn(browser, testGuid, async function(guid) {
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
let loginFound = await ContentTaskUtils.waitForCondition(() => {
return (
loginList._loginGuidsSortedOrder.length == 1 &&
loginList._loginGuidsSortedOrder[0] == guid
);
}, "Waiting for login to be displayed in page");
ok(loginFound, "Confirming that login is displayed in page");
});
BrowserTestUtils.removeTab(tab);
info("Adding a lazy about:logins tab...");
let lazyTab = BrowserTestUtils.addTab(gBrowser, "about:logins", {
createLazyBrowser: true,
});
is(lazyTab.linkedPanel, "", "Tab is lazy");
let tabLoaded = new Promise(resolve => {
gBrowser.addTabsProgressListener({
async onLocationChange(aBrowser) {
if (lazyTab.linkedBrowser == aBrowser) {
gBrowser.removeTabsProgressListener(this);
await Promise.resolve();
resolve();
}
},
});
});
info("Switching tab to cause it to get restored");
await BrowserTestUtils.switchTab(gBrowser, lazyTab);
await tabLoaded;
let lazyBrowser = lazyTab.linkedBrowser;
await ContentTask.spawn(lazyBrowser, testGuid, async function(guid) {
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
let loginFound = await ContentTaskUtils.waitForCondition(() => {
return (
loginList._loginGuidsSortedOrder.length == 1 &&
loginList._loginGuidsSortedOrder[0] == guid
);
}, "Waiting for login to be displayed in restored page");
ok(loginFound, "Confirming that login is displayed in restored page");
});
BrowserTestUtils.removeTab(lazyTab);
});