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

Compatibility with other tab unloaders #50

Merged
merged 1 commit into from
May 22, 2018

Conversation

Lej77
Copy link
Contributor

@Lej77 Lej77 commented May 20, 2018

When other tab unloaders want to unload the active tab they will switch away from it and then discard it. When the active tab is changed this triggers the listener to the visibilitychange event in the file auto-tab-discard/data/inject/top.js at line 168. This listener will send a message to the background script and this message causes Firefox to set the discarded property to false.

This pull request fixes this issue by adding a slight delay to the message so that if the tab is being unloaded then the message won't be sent.

Steps to reproduce issue

  1. Install Auto Tab Discard.
  2. Install Unload Tab.
  3. Install an extension that shows if a tab is unloaded. For example Tab Center Redux.
  4. Switch to a tab that supports context script. (For example google.)
  5. Unload the active tab with the Unload Tab extension. (Use alt+x shortcut.)
  6. Observe how the discarded tab look loaded even though it isn't.

Browser: Firefox v60.0.1

@rNeomy rNeomy merged commit 9d1c81e into rNeomy:master May 22, 2018
@rNeomy
Copy link
Owner

rNeomy commented May 22, 2018

Looks good to me.

Install an extension that shows if a tab is unloaded

btw, If a tab gets unloaded by ATD, its favicon also alters.

@Lej77 Lej77 deleted the unload-active-other-unloader branch May 22, 2018 14:38
@rNeomy
Copy link
Owner

rNeomy commented May 23, 2018

just a note; as of the next release you can also ask ATD to perform discarding. It has some advantages like the favicon would be uniform;

code sample:

chrome.runtime.sendMessage('atd-id-here', {
  method: 'discard', 
  query: {} // a query object that is passed to chrome.tabs.query
}, ids => console.log('list of discarded tabs', ids))

@Lej77
Copy link
Contributor Author

Lej77 commented May 23, 2018

@rNeomy Thanks, I will see about implementing support for it in the next version of my Tab Unloader for Tree Style Tab extension.

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.

None yet

2 participants