Skip to content

Commit

Permalink
Don't retry hide and update requests for already destroyed tooltip frame
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Nov 29, 2024
1 parent cdd9f03 commit bcaf1e6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions webextensions/sidebar/tab-preview-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ async function sendTabPreviewMessage(tabId, message, deferredReturnedValueResolv
type: 'treestyletab:ask-tab-preview-frame-id',
}).catch(_error => {});
if (!frameId) {
if (!message.canRetry)
return false;

if (retrying) {
// Retried to load tab preview frame, but failed, so
// now we fall back to the in-sidebar tab preview.
Expand Down Expand Up @@ -217,6 +220,9 @@ async function sendTabPreviewMessage(tabId, message, deferredReturnedValueResolv
deferredReturnedValueResolver(returnValue);
}
catch (_error) {
if (!message.canRetry)
return false;

if (retrying) {
// Retried to load tab preview frame, but failed, so
// now we fall back to the in-sidebar tab preview.
Expand Down Expand Up @@ -315,6 +321,7 @@ async function onTabSubstanceEnter(event) {
url,
hasPreview,
timestamp: startAt, // Don't call Date.now() here, because it can become larger than the timestamp on mouseleave.
canRetry: !!targetTabId,
}).catch(_error => {});

let previewURL = null;
Expand Down

0 comments on commit bcaf1e6

Please sign in to comment.