Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest v3 (Chrome) - Idle Trigger #30

Closed
Rayquaza01 opened this issue Feb 1, 2024 · 3 comments
Closed

Manifest v3 (Chrome) - Idle Trigger #30

Rayquaza01 opened this issue Feb 1, 2024 · 3 comments
Labels

Comments

@Rayquaza01
Copy link
Owner

With Manifest v3, all event listeners in the background script must be at the top level. In History Cleaner, the idle listener is not set at the top level. Because the idle length is user set, we need to fetch the idle length from storage before creating the event listener (which can't be done at the top level), and the listener is removed if the trigger mode is not idle.

Because of this, having a user set idle length seems to be impossible with Manifest v3. Removing the event listener when it's not in use also seems impossible.

There are a couple ways to handle this:

Option 1:
Deprecate the idle length option on Manifest v3, but keep idle support in. Idle length will always be 60 seconds. Even if the trigger mode is not idle, the idle event listener will still trigger (but it won't do anything).

Option 2:
Deprecate idle entirely on Manifest v3. Change the default trigger mode to the new timer mode. (Triggers at a set interval, Defaults to 24 hours).

Personally, I'm leaning towards option 2. Clearing history on idle doesn't make a lot of sense (the cutoff time is set to midnight, so unless the extension behavior is set to delete all history, history is only actually deleted once per day anyway). Clearing history only once per day was the intention of the startup trigger mode, but if you always leave your browser open then it will only trigger once. With the timer trigger mode, it will still trigger once every day even if you always leave your browser open.

What I want feedback on is:

  1. Should the idle trigger be deprecated on Manifest v3? Or just idle length?
  2. Should the timer trigger be made default on all versions?

(Note: I am planning on keeping the Firefox version on Manifest v2 for the foreseeable future. Neither idle length nor the idle trigger will not be deprecated on the Firefox version. However, I am considering making timer mode be the default for new installs on all versions.)

@ejona86
Copy link

ejona86 commented Feb 25, 2024

I'm a fan of the new timer trigger. I waited a bit after the update to comment to see how well it works. Every time it fires it does something, and it fires rarely. The idle timer was most frequently a noop. But I think that behavior is dependent on which delete behavior.

  • "Delete history older than a specified number of days." Simple timer makes sense here because running more than once a day is not beneficial. Idleness has nothing to do with it. Startup is weird, because then it keeps the history for potentially long periods; shutdown would make more sense, but that's not feasible I believe
  • "Delete all history." This setting only makes sense with a short (day or less) interval, as otherwine the history available will vary widely. I think idle timer makes the most sense here, although having startup in addition makes some sense (again, ideally shutdown, but I don't think that's feasible)

@herrbrixter
Copy link

I'm fine to default to timer mode and depreciate idle mode. You could explain it better that timer 1440 means it deletes once every 24 hours. Just so it's easier to understand.

@Rayquaza01 Rayquaza01 added the chrome-issue A Chrome specific issue label Jun 21, 2024
@Rayquaza01
Copy link
Owner Author

Just as an update to this:

The idle trigger was deprecated in Chrome in 1.6.0, and the Timer was made default. Idle trigger is still the default in Firefox, however I am planning to change that for 1.6.2

(For clarity, 1.6.1 is being skipped because I made a mistake while publishing the Firefox version of 1.6.0, so 1.6.1 and 1.6.0 are the same version)

Due to WebExtension Polyfill not currently supporting Manifest v3 (see mozilla/webextension-polyfill#329), I split the code base to remove the dependency on WebExtension Polyfill in Chrome. The Chrome source is under cr-src/ and the Firefox source is under src/. I'm planning to undo this split and remove the runtime dependency on WebExtension Polyfill entirely. (There will still need to be some duplicated files (such as the webpack config, manifest file, and background script), however much of the code works in both Manifest v2 and v3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants