V3.2.1 Release - #30
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR prepares the v3.2.1 release by upgrading build/runtime dependencies and adjusting TypeScript configuration/types, alongside a functional fix in the background script to prevent creating duplicate blank tabs when overlapping close attempts occur (e.g., redirect races).
Changes:
- Fixes a race in scheduled/immediate tab closing so the “prevent last tab close” behavior doesn’t open multiple blank tabs for redundant close attempts.
- Refactors
inspectUrlclose logic into a sharedattemptTabClosehelper and introduces a “tab does not exist” classification helper. - Updates tooling/dependencies (TypeScript, webpack-cli, etc.) and adjusts TypeScript config/types to accommodate the upgrade.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/background.ts | Refactors close flow and changes last-tab prevention logic to check tab existence before opening a blank tab. |
| src/helpers/env.ts | Adjusts environment detection helpers (incl. Firefox detection) and visibility of getEnvironment. |
| src/helpers/logger.ts | Updates interval timer typing to be derived from setInterval. |
| src/storage/storage-api.ts | Adjusts typing/casts when decompressing stored configs. |
| src/storage/storage-api.local.ts | Casts storage quota constants to avoid type issues across browsers. |
| src/storage/storage-api.cloud.ts | Casts sync storage constants to avoid type issues across browsers. |
| src/types/index.d.ts | Adds a global process.env.NODE_ENV declaration. |
| src/tsconfig.json | Updates TS target/lib/moduleResolution and explicitly includes Node types. |
| src/package.json | Upgrades key dependencies/devDependencies for the release. |
| src/package-lock.json | Lockfile updates corresponding to dependency upgrades. |
| src/manifest.json | Bumps extension version to 3.2.1.0. |
| src/manifest.firefox.json | Bumps Firefox extension version to 3.2.1.0. |
Files not reviewed (1)
- src/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- src/package-lock.json: Generated file
Comments suppressed due to low confidence (1)
src/background.ts:213
IsTabDoesNotExistErroris a function but is named in PascalCase, which is inconsistent with the surrounding functions in this file (e.g.,closeTheTab,acquireTabLock). Renaming it to lowerCamelCase will better match existing conventions.
} catch (error: any) {
if (IsTabDoesNotExistError(error)) {
Logger.logTrace(`Tab ${tabId} was already closed for ${matchedBy} '${matchedPattern}' that matched pattern '${pattern}'`);
} else {
const errorMessage = error?.message || "";
Logger.logError(`Something went wrong while closing tab ${tabId} for ${matchedBy} '${matchedPattern}' that matched pattern '${pattern}': ${errorMessage}`);
}
} finally {
if (wasClosed) {
Logger.logDebug(successMessage);
}
}
}
//Distinguishes "tab was already closed by another call" (expected, benign) from real failures
// E.g. Tab might not exist if it matched by both Url and Title since one will be faster to close the tab before the other
function IsTabDoesNotExistError(error: any): boolean {
const errorMessage = error?.message || "";
return errorMessage.startsWith("No tab with id:") /*Chrome*/ || errorMessage.startsWith("Invalid tab ID:") /*Firefox*/;
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades packages, updates to ES6 instead of ES5 as our build target, and fixes a bug, details below.
Fix duplicate blank tab on redirected close
🐛 Bug
When a scheduled tab close overlapped with a client-side redirect (e.g. Zoom's page changing to
#success), the tab could get flagged for closure twice. With "prevent last tab close" enabled, this sometimes opened two blank tabs instead of one.🔍 Root cause
closeTheTabdecided whether to open a blank tab based on a tab count taken before confirming the target tab still existed — so a redundant second close attempt could still see itself as "closing the last tab."✅ Fix
closeTheTabnow checks whether the tab still exists before deciding to open a blank tab; if it's already gone, it returnsfalseand does nothing.inspectUrl(immediate + delayed paths) into a sharedattemptTabClosehelper.IsTabDoesNotExistErrorto distinguish expected "already closed" races from real failures.🧪 Testing
Manually verified via a local repro page simulating a client-side redirect: