Skip to content

單元測試追加 - Exclusion Test - #618

Merged
CodFrm merged 4 commits into
scriptscat:mainfrom
cyfung1031:test_399
Aug 11, 2025
Merged

CodFrm merged 4 commits into
scriptscat:mainfrom
cyfung1031:test_399

Conversation

@cyfung1031

@cyfung1031 cyfung1031 commented Aug 8, 2025 •

Copy link
Copy Markdown
Collaborator

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#host

  • host must not include a port number.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#path

@cyfung1031
cyfung1031 force-pushed the test_399 branch 2 times, most recently from 7492b3a to 92114bf Compare August 8, 2025 23:44
@cyfung1031

cyfung1031 commented Aug 8, 2025 •

Copy link
Copy Markdown
Collaborator Author
Screenshot 2025-08-09 at 8 46 24

parsePatternMatchesURL

host 是 hostname:port ( 若 port有指定 )

port 是 tcp port
0 - 65535

~ 所以 :5545* 可等價於 :5545/*, :55450/*, :55451/*, :55452/*, :55453/*, ... :55459/*, ~

-> 見MDN文檔。MV3 pattern 無視port
-> ** 不清楚TM如何解讀。TM文檔沒標明 **


現在的寫法拆太細了
應該直接兩個參數 matches (@match[]), excludes (@exclude[]) (custom exclude也放在exclude)

然後直接生成 urlMatcher, match patterns, exclude patterns

@cyfung1031

cyfung1031 commented Aug 8, 2025 •

Copy link
Copy Markdown
Collaborator Author
Screenshot 2025-08-09 at 9 07 28
 new RegExp('^.+?://[^/]*?(:5244[^/]*?)?.*?$').test("https://foo.api.bar/baz")

這個rule 出錯了吧

@cyfung1031

cyfung1031 commented Aug 9, 2025 •

Copy link