Explorar o código

fix: deduplicate `@grant` array

Previously the following wouldn't work as expected:

// @grant       none
// @grant       none
tophf %!s(int64=5) %!d(string=hai) anos
pai
achega
52a738e861
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      src/background/utils/db.js

+ 1 - 0
src/background/utils/db.js

@@ -144,6 +144,7 @@ preInitialize.push(async () => {
         custom: { pathMap = {} } = {},
         meta = {},
       } = script;
+      meta.grant = [...new Set(meta.grant || [])]; // deduplicate
       meta.require?.forEach(rememberUrl, pathMap);
       Object.values(meta.resources || {}).forEach(rememberUrl, pathMap);
       pathMap::rememberUrl(meta.icon);