Bug 1888841 - Fix typo when passing sourceWindowId to SessionStore's forgetClosedTabById. r=fxview-reviewers,jsudiaman,kcochrane
Differential Revision: https://phabricator.services.mozilla.com/D206431
This commit is contained in:
@@ -249,13 +249,22 @@ class RecentlyClosedTabsInView extends ViewPage {
|
||||
onDismissTab(e) {
|
||||
const closedId = parseInt(e.originalTarget.closedId, 10);
|
||||
const sourceClosedId = parseInt(e.originalTarget.sourceClosedId, 10);
|
||||
const sourceWindowId = e.originalTarget.souceWindowId;
|
||||
if (sourceWindowId || !isNaN(sourceClosedId)) {
|
||||
const sourceWindowId = e.originalTarget.sourceWindowId;
|
||||
if (!isNaN(sourceClosedId)) {
|
||||
// the sourceClosedId is an identifier for a now-closed window the tab
|
||||
// was closed in.
|
||||
lazy.SessionStore.forgetClosedTabById(closedId, {
|
||||
sourceClosedId,
|
||||
});
|
||||
} else if (sourceWindowId) {
|
||||
// the sourceWindowId is an identifier for a currently-open window the tab
|
||||
// was closed in.
|
||||
lazy.SessionStore.forgetClosedTabById(closedId, {
|
||||
sourceWindowId,
|
||||
});
|
||||
} else {
|
||||
// without either identifier, SessionStore will need to walk its window collections
|
||||
// to find the close tab with matching closedId
|
||||
lazy.SessionStore.forgetClosedTabById(closedId);
|
||||
}
|
||||
|
||||
|
||||
@@ -372,6 +372,12 @@ add_task(async function test_dismiss_tab() {
|
||||
|
||||
info("calling dismiss_tab on the top, most-recently closed tab");
|
||||
let closedTabItem = listItems[0];
|
||||
// the most recently closed tab was in window 3 which got closed
|
||||
// so we expect a sourceClosedId on the item element
|
||||
ok(
|
||||
!isNaN(closedTabItem.sourceClosedId),
|
||||
"Item has a sourceClosedId property"
|
||||
);
|
||||
|
||||
// dismiss the first tab and verify the list is correctly updated
|
||||
await dismiss_tab(closedTabItem);
|
||||
@@ -390,6 +396,12 @@ add_task(async function test_dismiss_tab() {
|
||||
|
||||
// dismiss the last tab and verify the list is correctly updated
|
||||
closedTabItem = listItems[listItems.length - 1];
|
||||
ok(
|
||||
isNaN(closedTabItem.sourceClosedId),
|
||||
"Item does not have a sourceClosedId property"
|
||||
);
|
||||
ok(closedTabItem.sourceWindowId, "Item has a sourceWindowId property");
|
||||
|
||||
await dismiss_tab(closedTabItem);
|
||||
await listElem.getUpdateComplete;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user