Browse Source

fix: use sendCmdDirectly only when background is ready

tophf 4 years ago
parent
commit
9fc8b6b2f8
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/common/index.js

+ 1 - 1
src/common/index.js

@@ -42,7 +42,7 @@ export function sendCmd(cmd, data, options) {
 
 export function sendCmdDirectly(cmd, data, options) {
   const bg = browser.extension.getBackgroundPage?.();
-  return bg && bg !== window
+  return bg && bg !== window && bg.deepCopy
     ? bg.handleCommandMessage(bg.deepCopy({ cmd, data })).then(deepCopy)
     : sendCmd(cmd, data, options);
 }