Do you need GM_ functions in Firefox 57 and later?

May 2017 modifié dans Développement Firefox
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

Réponses

  • If Anthony can't do it, so where to us
  • 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.

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

  • July 2017 modifié Chrome
    • 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.

    • 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").

  • Yep, GM_xmlHttpRequest is the only one I can't live without.
Connectez-vous ou Inscrivez-vous pour répondre.