Này người xa lạ!

Còn chờ gì nữa mà không mau đăng nhập hoặc đăng ký để cùng tham gia thảo luận với cộng đồng!

Do you need GM_ functions in Firefox 57 and later?

đã sửa May 2017 trong Phát triển 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

Bình luận

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

  • đã sửa July 2017 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.
Đăng nhập hoặc Đăng ký để gửi bình luận.