Prechádzať zdrojové kódy

fix: suppress executeScript errors in FF

tophf 5 rokov pred
rodič
commit
be7c1f0714
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      src/background/utils/preinject.js

+ 2 - 1
src/background/utils/preinject.js

@@ -98,8 +98,9 @@ function prepareScript(script, index, scripts) {
     // adding a new line in case the code ends with a line comment
     code.endsWith('\n') ? '' : '\n',
     hasReqs ? '})()' : '',
+    // 0 at the end to suppress errors about non-cloneable result of executeScript in FF
+    `})()}catch(e){${dataKey}(e)}};0`,
     // Firefox lists .user.js among our own content scripts so a space at start will group them
-    `})()}catch(e){${dataKey}(e)}}`,
     `\n//# sourceURL=${extensionRoot}${ua.isFirefox ? '%20' : ''}${name}.user.js#${id}`,
   ].join('');
   cache.put(dataKey, injectedCode, TIME_KEEP_DATA);