Browse Source

fix content scripts matches

Alexandre Lachèze 7 years ago
parent
commit
a2ba4e0a6a
1 changed files with 1 additions and 3 deletions
  1. 1 3
      lib/renderer/content-scripts-injector.js

+ 1 - 3
lib/renderer/content-scripts-injector.js

@@ -26,9 +26,7 @@ const runContentScript = function (extensionId, url, code) {
 // Run injected scripts.
 // https://developer.chrome.com/extensions/content_scripts
 const injectContentScript = function (extensionId, script) {
-  for (const match of script.matches) {
-    if (!matchesPattern(match)) return
-  }
+  if (!script.matches.some(matchesPattern)) return
 
   for (const {url, code} of script.js) {
     const fire = runContentScript.bind(window, extensionId, url, code)