Jelajahi Sumber

Revert "fix: match nothing when no match or include rule is set"

This reverts commit a43c29a58907ba64893d28fbf2ca8a88681d1f24.

fix #404
Gerald 7 tahun lalu
induk
melakukan
b52974c543
2 mengubah file dengan 2 tambahan dan 4 penghapusan
  1. 2 1
      src/background/utils/tester.js
  2. 0 3
      test/background/tester.js

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

@@ -53,7 +53,8 @@ export function testScript(url, script) {
   const inc = mergeLists(custom.origInclude && meta.include, custom.include);
   const exc = mergeLists(custom.origExclude && meta.exclude, custom.exclude);
   const excMat = mergeLists(custom.origExcludeMatch && meta.excludeMatch, custom.excludeMatch);
-  let ok = false;
+  // match all if no @match or @include rule
+  let ok = !mat.length && !inc.length;
   // @match
   ok = ok || testMatch(url, mat);
   // @include

+ 0 - 3
test/background/tester.js

@@ -194,9 +194,6 @@ test('exclude', t => {
   t.test('should support magic TLD', q => {
     const script = buildScript({
       meta: {
-        match: [
-          '*://*/*',
-        ],
         exclude: [
           'https://www.google.tld/*',
         ],