Fix 6 bugs: tab hijacking, cache expiry, NaN settings, debugger error handling#2
Draft
Fix 6 bugs: tab hijacking, cache expiry, NaN settings, debugger error handling#2
Conversation
Agent-Logs-Url: https://github.com/vili-pet/Rewards-Search-Automator/sessions/c0af5874-8bf1-458a-8e6d-2c7377abb25f Co-authored-by: vili-pet <199537307+vili-pet@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
vili-pet
March 27, 2026 05:25
View session
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.
Six independent bugs in
background.jsandpopup.jsranging from crashes to silent data corruption.background.js
getTabId()crash + tab hijacking:tabs[0]was accessed unconditionally — undefined when no active tab exists (auto-start alarm). Now falls back tochrome.tabs.create({ active: false })to avoid hijacking the user's current tab and to prevent theTypeError.onConnectpopup-close handler: On popup disconnect, code re-queried the current active tab to detach the debugger — wrong tab entirely. Now usessearchState.tabIddirectly; no-ops if null.trendingWordsCachenever expired: Cached value was a bare array with no timestamp, surviving the full service worker lifetime regardless ofTRENDS_CACHE_DURATION. Now stored as{ terms, timestamp }with expiry checked on every read.Unhandled
chrome.runtime.lastError:enableDebugger/disableDebuggerdidn't readlastErrorin their callbacks, producing unchecked-error console noise when a tab was closed mid-search. Both now handle it.randomDelay()with inverted min/max: If user sets max < min,max - mingoes negative. Fixed withMath.min/Math.maxnormalization:popup.js
parseInt("")returnsNaN, which propagates intototalSearchesand breaks progress math. Added|| defaultfallbacks on everyparseInt()call in bothsendAutoStartSettingsToBackground()andstartSearches().