Greasemonkey: V4 @match 的行为不同于 V3 和 TamperMonkey

创建于 2017-11-15  ·  8评论  ·  资料来源: greasemonkey/greasemonkey

我的脚本有以下条目(在那些是 Intranet 地址的情况下进行了清理):

// <strong i="6">@match</strong>        http://*.some-net.net/*
// <strong i="7">@match</strong>        http://*.some-net.net/*
// <strong i="8">@match</strong>        https://*.some-othernet.net/*
// <strong i="9">@match</strong>        https://*.some-othernet.net/*

在 V3/tampermonkey 上,它适用于以下所有地址示例(http 和 https)

[1] service.some-net.net
[2] service.some-othernet.net
[3] service.some-net。 净:1234
[4] service.some-othernet。 净:1234
[5] service.customer.some-net。 净:1234
[6] service.customer.location.some-net.net

但是 V4 [3][4] 和 [5] 上的功能不起作用。 对于 [3] 的修复是添加那些以匹配端口:

// <strong i="23">@match</strong>        http://*.some-net.net:*/*
// <strong i="24">@match</strong>        http://*.some-net.net:*/*
// <strong i="25">@match</strong>        https://*.some-othernet.net:*/*
// <strong i="26">@match</strong>        https://*.some-othernet.net:*/*

至于 [5] 我试过这个,但即使它也无济于事

// <strong i="30">@match</strong>        http://*.*.some-net.net:*/*
// <strong i="31">@match</strong>        http://*.*.some-net.net:*/*
// <strong i="32">@match</strong>        https://*.*.some-othernet.net:*/*
// <strong i="33">@match</strong>        https://*.*.some-othernet.net:*/*

这对我来说没有任何意义,因为 [6] 仅在第一个(原始)规则集上工作。

所有8条评论

官方文档很简洁,根本没有提到端口。 一定要在修复时进行测试,以防止回归。

也就是说比较新/旧代码:

我不清楚这是怎么发生的,它没有改变。

好吧,也许用于获取当前 URL 的方法发生了一些变化。 每个使用新 Firefox 的人都有这个问题,对于使用旧 FF/Chrome 的其他人来说,它正在工作。
不幸的是,当我想修改 XPI 以添加一些打印时,我发现它需要签名......

有一个关于匹配和端口的 Bugzilla。 不知道决议是什么。 会看看我能不能找到它。

Buzilla 在比赛和港口。 在这里

好的,回到 3.x 天,我们使用nsIURI ,它分别具有hostporthostport 。 现在我们必须使用URL ,它仍然有一个叫做host的东西——但这意味着hostport 。 我们需要使用hostname

与问题功能没有直接关系,但保证与 FF 实现的兼容性。 是否应该实现该 API。

https://bugzilla.mozilla.org/show_bug.cgi?id=1395278

此修复程序应在 4.1beta6 中; 测试并确认这一点将不胜感激!

https://addons.mozilla.org/firefox/downloads/file/800957/greasemonkey-4.1beta6-an+fx.xpi?src=devhub

现在检查,似乎工作正常。 谢谢!

此页面是否有帮助?
0 / 5 - 0 等级