Diskusie » Vývoj

It is possible ???

§
Pridaný: 20.10.2016
Upravený: 20.10.2016

It is possible ???

It is possible make tampermonkey scripts run on chrome-extension:// in Google Chrome

So I'm wondering why tampermonkey scripts cannot work if you know please tell me

and please don't tell me because is not http I know that ^_^

woxxomZablokovaný
§
Pridaný: 20.10.2016
Upravený: 21.10.2016

No, because in order to be able to inject a userscript on those urls Tampermonkey itself must explicitly request access to chrome-extension:// scheme in its permissions and injection patterns of its own content scripts that create the execution sandbox of a userscript. In addition to that, Chrome chrome://flags/#extensions-on-chrome-urls flag must be enabled by the user manually.

Tampermonkey currently doesn't support this functionality.

As for whether it's possible to implement, the obvious stopper is whether such functionality would be considered acceptable by the webstore review team. I haven't checked but maybe such extensions are okay.

Last time I've tried this, around Chrome 30-40, having one of these patterns in "matches" prevented my extension from being installed with an error about invalid url/scheme if the abovementioned flag wasn't enabled (that is on 99.999% of computers). So I've resorted to a workaround: "chrome://*/*" and "chrome-extension://*/*" were declared only in "permissions" and I've injected my content scripts via executeScript based on tab url.

@derjanb, what do you think?

§
Pridaný: 21.10.2016

@wOxxOm Yes, in theory it's possible. However, Tampermonkey's code is not prepared to handle chrome-extension:// URLs and I think it's a lot of work to test and fix the issue. Also, since this functionality is hidden behind a disabled (and unsupported) flag I'd expect to trigger a lot of bugs in Chrome itself.

Another "downside" of this is that userscripts could make use of every extensions permission at every time. I think there is some potential for abuse.

So finally this is a lot of work for a very little gain. That's why I don't have plans to implement this at the moment.

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.