toggl / track-extension

Toggl Track browser extension for Chrome and Firefox
http://toggl.github.io/track-extension
Apache License 2.0
1.09k stars 568 forks source link

"Stop timer automatically" feature issue on Windows #1893

Open VeljkoTN opened 3 years ago

VeljkoTN commented 3 years ago

🐛 Describe the bug

With the "Stop timer automatically" feature enabled, the running timer does not stop when you close your browser. ON WINDOWS.

Expected behaviour

Any running timer should be stopped when you close your browser if the "Stop timer automatically" feature is enabled on the settings page for the extension.

Steps to reproduce

Steps to reproduce the behaviour:

  1. Get the Track extension
  2. Enable the "Stop timer automatically" feature
  3. Leave a timer running
  4. Close your browser

Other details or context

Intercom reference

dianetoggl commented 3 years ago

Case reference

almirbi commented 3 years ago

Cannot reproduce on macOS. Dont have a Windows machine to try it on. Time was stopped after closing ALL chrome windows.

Screen Shot 2021-01-11 at 2 45 35 PM
VeljkoTN commented 3 years ago

@almirbi I just tried it on Chrome/Windows and it didn't stop after closing the browser (so all tabs). I have two desktops so made sure to only use one as well where I have chrome running to make sure and the same thing happens.. closing the browser does not stop a running timer

almirbi commented 3 years ago

Maybe someone with Windows should try to take on this one 🤔 I don't think it's possible to try this on browserstack.

Phenome commented 3 years ago

Can reproduce.

Tried on Windows with both an already running TE, and then with a TE created from Track Extension itself. Also tried chrome://restart, and made sure there were no more chrome processes running after close.

leafi commented 3 years ago

This doesn't work on Linux, either. At least not for a simple 1 window session in Chromium - I could never get it to automatically stop the timer.

(Reproduced in a Windows VM, too.)

dianetoggl commented 2 years ago

Case reference

hazem3500 commented 2 years ago

Shouldn't this issue be moved to https://github.com/toggl/track-extension-core ?

nidarasheed commented 2 years ago

Case reference

marksteve commented 2 years ago

I was also able to replicate the issue in macOS so I don't think it's a platform issue. It seems that neither the onbeforeunload nor the browser.windows.onRemoved event is reliable enough to submit the stop time entry API request. Tried the browser.runtime.onSuspend event but that doesn't trigger at all. I experimented with the Beacon API, which is supposedly meant for submitting requests before unload, but even that wasn't able to trigger in time.

Video of closing the browser with the extension failing to send a request: https://user-images.githubusercontent.com/26679/156544586-648cfc20-5a54-4f04-9224-62e4f8441bde.mp4

Video of closing the browser with the extension successfully sending a request because a DevTool console window is left open: https://user-images.githubusercontent.com/26679/156543194-a301fd17-6b69-4808-8342-0ff28e959d61.mp4

langri-sha commented 2 years ago

I guess we didn't really figure out where to go with this. I believe we said something about leaving a note that this option isn't reliable.

marksteve commented 2 years ago

@langri-sha I have this PR with the not so pretty solution: https://github.com/toggl/track-extension-core/pull/132

DivineMK commented 2 months ago

This is still the issue. I am using Linux Firefox with extension version 3.0.29.