Reviews for Tab Sleep Timer Fix
Tab Sleep Timer Fix by Mitch Crane
Review by irwanwr
7 reviews
- Nice, but apart from "Close" and "Mute", I suggest "Reload", so that the music really stops but the tab is not lost ("Unload" would be nice but I get into trouble).
I also made a few minor improvements. Here is my diff, fell free to integrate or modify it:
diff -u1 -r sleep_timer_fix-1.0.5/background.js sleep_timer_fix-1.0.5+reload/background.js
--- sleep_timer_fix-1.0.5/background.js 2026-04-02 20:31:06.000000000 +0200
+++ sleep_timer_fix-1.0.5+reload/background.js 2026-05-22 19:08:09.692509102 +0200
@@ -11,2 +11,15 @@
+ let tabTimerConfig = tabTimerConfigsMap[currentTab.id];
+ if (!tabTimerConfig) {
+ tabTimerConfig = {
+ tabID: currentTab.id,
+ isRunning: false,
+ expirationBehavior: 'reload',
+ numSeconds: 0,
+ targetTime: null,
+ };
+ tabTimerConfigsMap[currentTab.id] = tabTimerConfig;
+ }
+
+
const cancelTimer = () => {
@@ -16,3 +29,4 @@
}
- delete tabTimerConfigsMap[currentTab.id];
+ tabTimerConfigsMap[currentTab.id].isRunning = false;
+ tabTimerConfigsMap[currentTab.id].numSeconds = 0;
};
@@ -27,3 +41,3 @@
const statusForConfig = tabTimerConfig => {
- return !tabTimerConfig ? { numSeconds: 0, isRunning: false, expirationBehavior: 'close' } : {
+ return !tabTimerConfig ? { numSeconds: 0, isRunning: false, expirationBehavior: 'reload' } : {
// FIX #7: Guard against negative countdown values
@@ -38,14 +52,2 @@
if (message.type === 'updateNumSeconds') {
- let tabTimerConfig = tabTimerConfigsMap[currentTab.id];
- if (!tabTimerConfig) {
- tabTimerConfig = {
- tabID: currentTab.id,
- isRunning: false,
- expirationBehavior: 'close',
- numSeconds: 0,
- targetTime: null,
- };
- tabTimerConfigsMap[currentTab.id] = tabTimerConfig;
- }
-
if (tabTimerConfig.isRunning) {
@@ -69,5 +71,3 @@
} else if (message.type === 'updateExpirationBehavior') {
- if (tabTimerConfigsMap[currentTab.id]) {
- tabTimerConfigsMap[currentTab.id].expirationBehavior = message.newExpirationBehavior;
- }
+ tabTimerConfigsMap[currentTab.id].expirationBehavior = message.newExpirationBehavior;
// FIX #6: Send a response to close the message port cleanly
@@ -105,2 +105,5 @@
switch (tabTimerConfig.expirationBehavior) {
+ case 'reload':
+ chrome.tabs.reload(tabID);
+ break;
case 'close':
diff -u1 -r sleep_timer_fix-1.0.5/popup/popup.html sleep_timer_fix-1.0.5+reload/popup/popup.html
--- sleep_timer_fix-1.0.5/popup/popup.html 2026-04-02 20:31:06.000000000 +0200
+++ sleep_timer_fix-1.0.5+reload/popup/popup.html 2026-05-22 18:20:50.738805149 +0200
@@ -56,2 +56,6 @@
+
+ Reload tab
+
+
- Rated 5 out of 5by Ninetynine, 2 years ago
- Rated 5 out of 5by Firefox user 17736256, 3 years ago
- Rated 5 out of 5by Firefox user 14246260, 4 years ago
- Rated 5 out of 5by Maxdout, 4 years agoThanks for fixing the original. This version always works without issue.
- Rated 5 out of 5by Andrey, 4 years ago