pieroxy / lz-string

LZ-based compression algorithm for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please investigate the slow (irresponsible) LZString issue in Edge

cyfung1031 opened this issue · comments

I wonder why this would become an Edge specific issue.

See cvzi/Spotify-Genius-Lyrics-userscript#34
See cvzi/Youtube-Music-Genius-Lyrics-userscript#18

Here is the userscripts zip file for your reproduction.

Userscripts.zip

Note: I cannot reproduce the issue from my side as I am using MacOS

Is the code slow in LZString or is it slow in Greasemonkey? (reference code below)

Maybe when compressed data is passed to GM.setValue() it's triggering an anti-malware security check in Edge (assuming that's actually a thing). Someone will have to strip the code down to a much simpler test case to isolate the actual issue because there's a lot of moving parts.

async function setJV (key, text) {
    if (typeof text === 'object') text = JSON.stringify(text)
    if (typeof text !== 'string') return null
    const z = LZString.compressToUTF16(text) // eslint-disable-line no-undef
    return await custom.GM.setValue(key, z)
 }