scriptcat
scriptcat copied to clipboard
[BUG] early-start 无视了 urlPattern
Problem Description
在 example.com 执行此脚本
// ==UserScript==
// @name New Userscript SL74-1
// @namespace https://docs.scriptcat.org/
// @version 0.1.0
// @description try to take over the world!
// @author You
// @match https://*/*
// @exclude /.*examp.e\.com.*/
// @grant none
// @run-at document-start
// @early-start
// @noframes
// ==/UserScript==
(function() {
'use strict';
console.log(`run in ${location.href}. exclusion: ${/.*examp.e\.com.*/.test(location.href)}`);
// Your code here...
})();
目前做法时, @include @exclude 含有 regex 的话,会在 pageLoad 里面检查排除
如果加了 @early-start, 就没有urlPatterns 检查,只依赖 userScript API 的 match patterns 和 glob patterns
因此有 regex 的话,不能使用 early-start, 除非把 pageLoad 里面的 urlPatterns 检查 移到 early-start 相关的代码
Reproduction Steps
ScriptCat Version
Operating System and Browser Information
Additional Information (Optional)
No response
可以在 content/inject 里读取match/include信息,再使用 url match决定是否执行
我觉得这个问题不急着处理,再留到下一个版本 1.2.3
感觉周末比工作日还忙