Add fuse search in undo and fix undo session id is undefind

Allow fuse search with url in undo completion.
Fix undo access undefined value in session,
though I don't see anyone cares the return value of undo.
This commit is contained in:
Gold Holk 2022-08-11 15:04:34 +08:00 committed by gholk
parent c90482042e
commit b81c9dcdb7
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ class SessionCompletionOption
this.value = (session.tab || session.window).sessionId
const [howLong, qualifier] = computeDate(session)
const [tab, extraInfo] = getTabInfo(session)
this.fuseKeys.push(tab.title)
this.fuseKeys.push(tab.title, tab.url)
this.html = html`<tr class="SessionCompletionOption option">
<td class="type">${session.tab ? "T" : "W"}</td>
<td class="time">${howLong}${qualifier}</td>

View file

@ -2997,8 +2997,8 @@ export async function undo(item = "recent"): Promise<number> {
const session = sessions.find(predicate)
if (session) {
browser.sessions.restore((session.tab || session.window).sessionId)
return (session.tab || session.window).id
const restore = await browser.sessions.restore((session.tab || session.window).sessionId)
return (restore.tab || restore.window).id
}
return -1
}