Improve locked vault browser workflow

This commit is contained in:
Joe Julian
2026-04-23 20:37:49 -07:00
parent 4afbc3c933
commit d60a8d2fbf
5 changed files with 69 additions and 4 deletions
+14 -3
View File
@@ -292,6 +292,16 @@ function approvalHintForState(state) {
return state.pendingMessage || "Approve or deny the fill request in KeePassGO.";
}
function shouldContinueWatchingState(state) {
if (!state?.pageHasLoginForm) {
return false;
}
if (state?.pendingFill) {
return true;
}
return Boolean(state?.status?.locked);
}
function schedulePendingPoll(tabId, pageUrl) {
if (!Number.isInteger(tabId)) {
return;
@@ -492,7 +502,7 @@ async function refreshPageState(tabId, pageUrl, options = {}) {
state.matches = [];
state.updatedAt = Date.now();
const saved = await setPageState(tabId, state);
if (saved.pendingFill) {
if (shouldContinueWatchingState(saved)) {
schedulePendingPoll(tabId, resolvedURL);
} else {
clearPendingPoll(tabId);
@@ -502,7 +512,7 @@ async function refreshPageState(tabId, pageUrl, options = {}) {
if (shouldReuseMatches(state, force)) {
const saved = await setPageState(tabId, state);
if (saved.pendingFill) {
if (shouldContinueWatchingState(saved)) {
schedulePendingPoll(tabId, resolvedURL);
} else {
clearPendingPoll(tabId);
@@ -529,7 +539,7 @@ async function refreshPageState(tabId, pageUrl, options = {}) {
updatedAt: Date.now()
};
const saved = await setPageState(tabId, state);
if (saved.pendingFill) {
if (shouldContinueWatchingState(saved)) {
schedulePendingPoll(tabId, resolvedURL);
} else {
clearPendingPoll(tabId);
@@ -657,6 +667,7 @@ const backgroundTestExports = {
normalizePageState,
actionPresentationForState,
shouldReuseMatches,
shouldContinueWatchingState,
tokenPendingApprovalCount,
defaultSettings
};