Skip to content

V3.2.1 Release - #30

Merged
mukunku merged 8 commits into
mainfrom
v3.2.1-release
Jul 29, 2026
Merged

V3.2.1 Release#30
mukunku merged 8 commits into
mainfrom
v3.2.1-release

Conversation

@mukunku

@mukunku mukunku commented Jul 18, 2026

Copy link
Copy Markdown
Owner

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

closeTheTab decided 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

  • closeTheTab now checks whether the tab still exists before deciding to open a blank tab; if it's already gone, it returns false and does nothing.
  • Consolidated duplicate try/catch/logging logic in inspectUrl (immediate + delayed paths) into a shared attemptTabClose helper.
  • Added IsTabDoesNotExistError to distinguish expected "already closed" races from real failures.

🧪 Testing

Manually verified via a local repro page simulating a client-side redirect:

Scenario Result
Two different configs match (delayed + immediate) ✅ one close wins, one no-ops
Same config matched twice via two delayed closes ✅ one close wins, one no-ops
Single tab open (the actual "last tab" case) ✅ exactly one blank tab opens

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 inspectUrl close logic into a shared attemptTabClose helper 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.

Comment thread src/background.ts
Comment thread src/background.ts Outdated
Comment thread src/helpers/env.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • IsTabDoesNotExistError is 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*/;
}

Comment thread src/tsconfig.json
Comment thread src/background.ts
@mukunku
mukunku merged commit 367fc12 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants