Improve locked vault browser workflow
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user