1. 16 Sep, 2018 2 commits
  2. 15 Sep, 2018 1 commit
  3. 14 Sep, 2018 2 commits
    • Philip Chimento's avatar
      GLib: add shortcut for bytestring GVariant · e59888dc
      Philip Chimento authored
      GVariant has two semantically different uses for variants of the 'ay'
      type: array of bytes, and bytestring (encoded string data.) Arrays of
      bytes can contain anything, including embedded 0 bytes. Bytestrings must
      be 0-terminated. See the docs:
      https://developer.gnome.org/glib/stable/gvariant-text.html#gvariant-text-bytestrings
      
      The existing API to create a GVariant with 'ay' type is `new
      GLib.Variant('ay', someByteArray)`. This remains unchanged, but this
      commit adds a new convenience API where you can pass a string instead of
      a byte array. If a string is passed in, the GVariant is assumed to be a
      bytestring, and so will be 0-terminated.
      
      The existing, probably unintended, behaviour of `new GLib.Variant('ay',
      someString)` was to always strip the 0-terminator, even if it was
      explicitly provided (`new GLib.Variant('ay', 'pizza\0')`). This is probably
      never what client code intended, but also that was not an actual API so
      technically the behaviour was undefined.
      
      Closes: #203
      e59888dc
    • Philip Chimento's avatar
      byte array: toString() should stop at 0 bytes · 2a0c56fd
      Philip Chimento authored
      This was a regression from 1.50 to 1.52. JS strings with embedded 0
      bytes will behave in unexpected ways, and is almost never what client
      code wants, so we should avoid this.
      
      Additionally, avoids an extra copy in the non-fast-path of toString().
      
      The BOM in the output of toString('LATIN1') was a surprise to me, but I
      verified that it happened even before this patch, so that behaviour has
      not changed.
      
      Closes: #195
      2a0c56fd
  4. 13 Sep, 2018 2 commits
  5. 03 Sep, 2018 2 commits
  6. 02 Sep, 2018 2 commits
  7. 01 Sep, 2018 12 commits
  8. 30 Aug, 2018 1 commit
  9. 29 Aug, 2018 1 commit
  10. 28 Aug, 2018 3 commits
  11. 20 Aug, 2018 3 commits
    • Philip Chimento's avatar
      byteArray: Add compatibility toString property · 8f0dff8d
      Philip Chimento authored
      This overrides, on each Uint8Array returned from an introspected function
      or from ByteArray.fromString() or ByteArray.fromGBytes(), the toString()
      property with a compatibility shim that preserves the old behaviour of
      ByteArray.prototype.toString() while logging a compatibility warning
      asking people to fix their code.
      
      This ByteArray.toString() -> Uint8Array.toString() change has had more
      fallout in application code than I expected, so it seems better to
      preserve backwards compatibility. (The old behaviour was to decode the
      byte array into a string with default encoding UTF-8, and the default
      behaviour of Uint8Array is to return a string with the decimal digits of
      each byte joined with commas. So the effect was that strings like
      "97,98,99,100" would show up in UIs where previously "abcd" would have
      been printed.
      
      This is only on specific instances, so Uint8Array.prototype.toString()
      remains untouched.
      8f0dff8d
    • Philip Chimento's avatar
      deprecation: Add deprecation warning framework · f55c0123
      Philip Chimento authored
      This adds a framework for deprecation warnings. It consists of an enum of
      deprecated features, and the API _gjs_warn_deprecated_once_per_callsite()
      which warns only once in each place the feature is used, even if that
      code is executed more than once.
      
      This is meant to be joined in the future by _gjs_warn_deprecated_once()
      and _gjs_warn_deprecated_once_per_file(), since we have unconditional
      deprecation warnings elsewhere in GJS that could very well use those
      APIs.
      f55c0123
    • Philip Chimento's avatar
      3276e0c1
  12. 19 Aug, 2018 3 commits
    • Avi's avatar
      Added _promisify to GJS GIO overrides · decae6d1
      Avi authored
      The _promisify function is a new internal feature for GJS, providing
      developers the option to write asynchronous operations with either
      the original callbacks from GNOME's original C (using GObject)
      libraries or to write them using async/await, a new modern way to
      write asynchronous code in JavaScript. This feature hides all of the
      original callbacks from developers in a Promise, allowing one to call
      the _async function like a variable by calling it with await in an async
      function. This is a backwards compatible feature, thus it will not
      impact already existing code using callbacks.
      
      Please note that if you use this feature, to be ready for the official
      API version coming out in 3.32 where slight changes to your code will
      be necessary (in a good way, you can remove an extra line or two of
      your code)!
      
      To use this feature, instead of nesting your _async and _finish function
      in your code (e.g. load_contents_async, load_contents_finish), you can
      update your program to an "async function", and call the _async function
      with an await leading it. You will also need to call the feature in your
      program, too, until the 3.32 release.
      
      Example:
      Gio._promisify(..., 'load_contents_async', 'load_contents_finish');
      let [raw_content] = file.load_contents_async(cancellable);
      decae6d1
    • Philip Chimento's avatar
      Merge branch 'temporary-gio-file' into 'master' · 06aae445
      Philip Chimento authored
      Temporary fix for Gio.File.prototype
      
      See merge request !226
      06aae445
    • Avi's avatar
      Temporary fix for Gio.File.prototype · 42be3ff2
      Avi authored
      Issue #189 details the current dilemma of being unable to add or
      monkeypatch methods on a GObject interface. At this time developers
      must add an additional line of code to their applications to use
      Gio.File.prototype. This is a temporary fix faking it until such a
      fix has been made for that issue.
      
      Example:
      promisify(Gio._LocalFilePrototype, load_contents_async, load_contents_finish);
      42be3ff2
  13. 16 Aug, 2018 2 commits
  14. 14 Aug, 2018 1 commit
  15. 13 Aug, 2018 3 commits