FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 213 forks source link

Account for TB-sized drives. #997

Closed ghost closed 3 years ago

ghost commented 3 years ago

My Yomichan settings page states that Yomichan is using approximately 125.9MB of 1.9undefined. I have a terabyte sized hard drive, so I looked into it and saw that TB wasn't in the _bytesToLabeledString(size) array that tracks size constants. This method is located under ext/bg/js/settings/storage-controller.js.

I would appreciate it you updated it, would be a very simple one-line fix. Thanks for Yomichan and your continued work!

ghost commented 3 years ago

There appears to be different behavior on Firefox 82.0.2, as it incorrectly reports the GB constant. Could it involve different underlying implementations of navigator.storage between the browsers?

The value returned from the _bytesToLabeledString(size) appears to be off by 1 with FF. That is, the value returned from the array was 3 (GB) when I expected 4 (undefined or NULL) according to existing Chrome behavior. navigator.storage.estimate could have different underlying implementations on the two browsers, but I can't help but feel that's unlikely given how modern they are.

toasted-nutbread commented 3 years ago

Firefox and Chrome have radically different implementations for how much available storage space they report, so that part is expected. Created a PR to fix the label issue.