Move scrobble service calls to service worker #3818
Merged
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.
This PR has the potential to cause massive destruction if it is not working correctly.
Achieves a few things.
First of all, the code now gets around adblockers no problem.
Second, this sets us up nicely to add code to avoid requiring users to refresh on every update being applied without risking it resulting in double scrobbles, as all scrobble control is now in the service worker, which we know will be gone when our new one is up. We have no control over content scripts and they stay loaded after update.
Third, it also removes some not that necessary logs from content script which I think is a good thing.
Some additional testing on this to make sure it works would be appreciated.
Note that a couple of the automated tests break due to a lack of a polyfill.
This needs a fixing before merge though doesn't represent an actual regression FWIW.
EDIT: Also another nice side effect of this PR is that the extension is a lot more gung-ho about reattempting to get session, which should mean that it is harder to accidentally get a service error after going through authentication.