Skip to content

[BUG] early-start 无视了 urlPattern #1075

@cyfung1031

Description

@cyfung1031

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0🚑 需要紧急处理的内容hotfix需要尽快更新到扩展商店

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions