讨论 » 开发

Do you need GM_ functions in Firefox 57 and later?

§
发表于:2017-05-14
编辑于:2017-05-14

Do you need GM_ functions in Firefox 57 and later?

Anthony Lieuallen is seeking input from script authors on what to do about changes in Fx57 that will affect the standard synchronous functions.

It's cross-posted in two groups:

https://groups.google.com/forum/#!topic/greasemonkey-users/Va5kqhkgVG8
https://groups.google.com/forum/#!topic/greasemonkey-dev/k_CwKkxv97A

§
发表于:2017-05-16

If Anthony can't do it, so where to us

Deleted user 20822
§
发表于:2017-05-16

I just need .wrappedJSObject (unsafeWindow) and cloneInto. Both synchronous.

As @wOxxOm said, asynchronous GM_getValue and GM_setValue are pities. Other GM_ functions are trivial or can become async too.

§
发表于:2017-06-02

unsafeWindow and a way to store data (GM_[gs]etValue) are the most common GM api's I use.

Jixun.Moe管理员
§
发表于:2017-07-05
编辑于:2017-07-05
  • GM_xmlHttpRequest: If there's one I must keep, is this one.
  • GM_[gs]etValue: I can live without it, but those functions are just so handy.
  • unsafeWindow: can be work around (e.g. <script> injection, then communicate using event).

If everything has to be async: we have promise and await/async, which can help migrate.

function GM_getValue_async ( key, defaultValue ) {
  return new Promise((resolve, reject) => {
    // TODO: message passing
    resolve(666);
  });
}

let x = await GM_getValue_async ('x', 1);

I think we can get started using the new API(under different or same API name?). And in the meanwhile, Script Manager can give warning to those API calls, and finally complete the transition in the future.

Deleted user 20822
§
发表于:2017-07-06
  • GM_xmlHttpRequest: If there's one I must keep, is this one.
  • GM_[gs]etValue: I can live without it, but those functions are just so handy.
  • unsafeWindow: can be work around (e.g. <script> injection, then communicate using event).

<script> injection won't work if the Content-Security-Policy (CSP) of the website does not allow inline scripts ("unsafe-inline").

§
发表于:2017-07-08

Yep, GM_xmlHttpRequest is the only one I can't live without.

发表回复

登录以发表回复。