Browse Source

fix: use `logging` in injected content

tophf 2 years ago
parent
commit
da3e1507d9
2 changed files with 3 additions and 2 deletions
  1. 2 1
      src/common/browser.js
  2. 1 1
      src/injected/content/index.js

+ 2 - 1
src/common/browser.js

@@ -76,7 +76,8 @@ if (!IS_FIREFOX && !browser?.runtime) {
           safeApply(func, thisArg, args);
         } catch (e) {
           if (e[MESSAGE] === 'Extension context invalidated.') {
-            console.error(`Please reload the tab to restore ${VIOLENTMONKEY} API for userscripts.`);
+            /* global logging */// only used with process.env.IS_INJECTED=content
+            logging.error(`Please reload the tab to restore ${VIOLENTMONKEY} API for userscripts.`);
           } else {
             throw e;
           }

+ 1 - 1
src/injected/content/index.js

@@ -68,7 +68,7 @@ addHandlers({
   UpdateValue: true,
 });
 
-init().catch(IS_FIREFOX && console.error); // Firefox can't show exceptions in content scripts
+init().catch(IS_FIREFOX && logging.error); // Firefox can't show exceptions in content scripts
 
 async function getDataFF(viaMessaging) {
   // global !== window in FF content scripts