Greasemonkey: Nightly 无法解析匹配模式

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

下面的脚本失败并出现以下错误: Error: <strong i="5">@match</strong> could not parse pattern

// ==UserScript==
// <strong i="8">@name</strong>        match test
// <strong i="9">@namespace</strong>   https://github.com/an-electric-sheep/
// <strong i="10">@version</strong>     1
// <strong i="11">@match</strong>       *://*.twitter.com/*
// <strong i="12">@grant</strong>       none
// ==/UserScript==

它适用于 FF 稳定版。 我怀疑它很快就会破坏很多脚本。

最有用的评论

最后一个好消息:Firefox 54.0a1 (2017-02-09)
构建自https://hg.mozilla.org/mozilla-central/rev/b772e0f4138540113e91a46c99bb0d14ecc8acca

第一个坏处:Firefox 54.0a1 (2017-02-10)
构建自https://hg.mozilla.org/mozilla-central/rev/25a94c1047e793ef096d8556fa3c26dd72bd37d7

推送日志
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b772e0f4138540113e91a46c99bb0d14ecc8acca&tochange=25a94c1047e793ef096d8556fa3c26ddd772bd

Bug #1337629是嫌疑犯。

__重现步骤:__
1) 打开便签本
2)菜单:“环境-浏览器”
3)插入代码:

var url = "http://*.twitter.com/*";
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
    .getService(Components.interfaces.nsIIOService);
alert(ioService.newURI(url, null, null));

4) 运行
5) 结果:

__Firefox 54.0a1 (2017-02-09)__

警报: http://*.twitter.com/*

__Firefox 54.0a1 (2017-02-10)__

Exception: [Exception... "Component returned failure code: 0x804b000a
(NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]"  nsresult: "0x804b000a
(NS_ERROR_MALFORMED_URI)"
location: "JS frame :: Scratchpad/1 :: <TOP_LEVEL> :: line 15"  data: no]

所有11条评论

最后一个好消息:Firefox 54.0a1 (2017-02-09)
构建自https://hg.mozilla.org/mozilla-central/rev/b772e0f4138540113e91a46c99bb0d14ecc8acca

第一个坏处:Firefox 54.0a1 (2017-02-10)
构建自https://hg.mozilla.org/mozilla-central/rev/25a94c1047e793ef096d8556fa3c26dd72bd37d7

推送日志
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b772e0f4138540113e91a46c99bb0d14ecc8acca&tochange=25a94c1047e793ef096d8556fa3c26ddd772bd

Bug #1337629是嫌疑犯。

__重现步骤:__
1) 打开便签本
2)菜单:“环境-浏览器”
3)插入代码:

var url = "http://*.twitter.com/*";
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
    .getService(Components.interfaces.nsIIOService);
alert(ioService.newURI(url, null, null));

4) 运行
5) 结果:

__Firefox 54.0a1 (2017-02-09)__

警报: http://*.twitter.com/*

__Firefox 54.0a1 (2017-02-10)__

Exception: [Exception... "Component returned failure code: 0x804b000a
(NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]"  nsresult: "0x804b000a
(NS_ERROR_MALFORMED_URI)"
location: "JS frame :: Scratchpad/1 :: <TOP_LEVEL> :: line 15"  data: no]

嗨,这在我看来像是在滥用 URI。 是否有特定原因使用该模式创建 URI? 它如何匹配实际 URI 与模式 URI。
了解这一点将有助于决定是否取消错误 1337629。

@valenting在将正则表达式应用于各个部分之前,它使用 URI 安全地提取各种 URI 部分(方案、主机、路径)。 我认为这个想法是为了避免为匹配模式实现自定义 URI 解析器。

匹配模式.jsm

另请注意,对我而言,这会导致静默删除或无法加载已安装的脚本。 这是相当令人惊讶的,我不知道它是否能够从中恢复,即脚本在重新安装之前不会消失。

测试分支:
https://github.com/janekptacijarabaci/greasemonkey/tree/_testBranch_matchPattern

我还没有提出拉取请求(它没有经过很好的测试)......

我昨晚与 Firefox 开发人员遇到了同样的问题。 GM 删除了 FBP 脚本,因为他的脚本中的两个@match行存在解析错误。 我删除了 2 行,并且能够从磁盘加载脚本以重新安装它。
从 FF 更新重新启动时,GM 还缺少一个禁用的脚本以及纯度脚本。 删除的禁用从剪贴板重新加载没有错误。 谢天谢地,这两个脚本都没有从 gm_scripts 文件夹中删除,只是无法加载。 希望这些有帮助,如果你需要我,在这里。
这两个解析错误;
// @match http:// .facebook.com/
// @match https:// .facebook.com/

测试版似乎运行良好。

测试版还没有更新。 很快就好。

2017 年 2 月 17 日 04:24,Dana MW Chester通知@github.com
写道:

测试版似乎运行良好。


你收到这个是因为你被提到了。
直接回复本邮件,在GitHub上查看
https://github.com/greasemonkey/greasemonkey/issues/2480#issuecomment-280539445
或静音线程
https://github.com/notifications/unsubscribe-auth/ABYyOVjQCE0xIK_k-M2OecXJ6tXrpr0Vks5rdRL1gaJpZM4L-WHI
.

我认为 arantius/greasemonkey @9cb94670994ea326e81ad6df4ec083d56e595166解决了这个问题。 确认会很好。

我把它改写给 arantius/greasemonkey @1531f342d512e9a0981897194bf3bf7ced09a1c7 ,我现在把它推送到测试版频道。

我无法确认 #2481 中提到的配置文件,因为我别无选择,只能让它正常工作,不得不刮擦它并重新开始,这完全是在浪费时间。

更不用说在我发现的过程中,删除/删除脚本显然并没有真正删除/删除它,在配置文件中的驱动器上它保留了所有内容,这没有意义它为什么这样做 - 因为我删除了这些脚本是有原因的,你为什么要收集它们?

解释当新脚本与旧脚本同名(已删除但并未真正消失)时出现的错误,您没有删除并导致问题。 即使与此处解决的问题没有直接关系,也应该真正考虑这一点。

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