瀏覽代碼

fix: avoid using prototype methods

Gerald 7 年之前
父節點
當前提交
34fcea2ecf
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 2 1
      src/injected/content/clipboard.js
  2. 3 3
      src/injected/web/index.js

+ 2 - 1
src/injected/content/clipboard.js

@@ -12,7 +12,8 @@ export default function setClipboard({ type, data }) {
   document.addEventListener('copy', onCopy, false);
   const ret = document.execCommand('copy', false, null);
   document.removeEventListener('copy', onCopy, false);
-  if (!ret && process.env.DEBUG) {
+  clipboardData = null;
+  if (process.env.DEBUG && !ret) {
     console.warn('Copy failed!');
   }
 }

+ 3 - 3
src/injected/web/index.js

@@ -179,9 +179,9 @@ function wrapGM(script, code, cache) {
     version: bridge.version,
     script: {
       description: script.meta.description || '',
-      excludes: script.meta.exclude.concat(),
-      includes: script.meta.include.concat(),
-      matches: script.meta.match.concat(),
+      excludes: [...script.meta.exclude],
+      includes: [...script.meta.include],
+      matches: [...script.meta.match],
       name: script.meta.name || '',
       namespace: script.meta.namespace || '',
       resources: Object.keys(resources).map(name => ({