Kir-Antipov / GitHub-Defreshed

:octocat: Classical GitHub at its finest
MIT License
83 stars 3 forks source link

Fix storage check for UserScript on Chromium #26

Closed An-dz closed 3 years ago

An-dz commented 3 years ago

Description

The UserScript version is not working because of the check for storage is broken on Chromium browsers.

https://github.com/Kir-Antipov/GitHub-Defreshed/blob/5b7a08d6706938d41b154d8175037e8e7238dfa1/src/tools/storage.js#L99-L105

https://github.com/Kir-Antipov/GitHub-Defreshed/blob/5b7a08d6706938d41b154d8175037e8e7238dfa1/src/tools/storage.js#L78-L81

The problem is that @getAvailableStorage line 101 new ExtensionStorage(chrome) actually runs because chrome is a global on Chromium browsers but it lacks storage. So to skip it we also need to check if storage exists.

Other information

Kir-Antipov commented 3 years ago

Whoops, I thought that chrome works the same way as browser in Firefox, which exists only in web extension environment. What a shame :D

Thanks a lot for pointing this out and fixing it, deeply appreciate that!