1. 12 Nov, 2018 9 commits
    • Philip Chimento's avatar
      release: Prepare for 1.54.3 · 7d5e567b
      Philip Chimento authored
      7d5e567b
    • Philip Chimento's avatar
      build: Stable branch version bump · a011deca
      Philip Chimento authored
      a011deca
    • Philip Chimento's avatar
      object: Fix build with --enable-dtrace · c5698eab
      Philip Chimento authored
      We don't build with this option very often, so this has been broken for a
      while.
      
      Closes: #196
      c5698eab
    • Marco Trevisan's avatar
      350be193
    • Marco Trevisan's avatar
      object: add reference to the property pspec we cache · 0f77ebd6
      Marco Trevisan authored
      When caching the properties param specs we get them from the class object, which
      is currently owning them, however since we're caching them we should add a
      reference to them in order to keep the ownership and clean them up properly
      when the cache is destroyed
      
      Fixes #213
      0f77ebd6
    • Marco Trevisan's avatar
      jsapi-util: add ability to ref added GjsAutoParam · ecd7e786
      Marco Trevisan authored
      Add an overloaded method to initialize a GjsAutoParam with with a reffed pspec.
      This helps to ref param specs we're consuming.
      
      Fixes #213
      ecd7e786
    • Philip Chimento's avatar
      arg: Handle case with null array and garbage length · 2190ed7d
      Philip Chimento authored
      It happens sometimes in the case of an array out argument with a
      separate length argument, that C code passess a NULL array pointer with
      garbage as the length.
      
      In the particular case that caused the crash in the associated bug
      report, gtk_selection_data_get_targets() passed NULL as the array
      pointer and -1 as the length, which later got interpreted as an unsigned
      int and so caused a failure to allocate memory.
      
      I doubt that the C code should be doing this, but in any case we should
      not crash in this case. This adds a check for this situation to
      gjs_array_from_carray_internal() as well as to all the shortcuts and
      special cases called from there.
      
      Closes: #201
      2190ed7d
    • Andrea Azzarone's avatar
      engine: mozjs60 changes for GC sweeping tracking · d4fe34a2
      Andrea Azzarone authored
      With the switch to mozjs60, the sweeping happens in three phases insted of two:
      JSFINALIZE_GROUP_PREPARE, JSFINALIZE_GROUP_START, and JSFINALIZE_GROUP_END.
      Update the code to keep track of whether the runtime is currently doing GC
      sweeping, and prevent calling JS code at that time.
      
      Fixes: #212
      d4fe34a2
    • Philip Chimento's avatar
      object: Fix write-only properties · 9f53812a
      Philip Chimento authored
      Since the property refactor, write-only properties have not been working.
      The problem was that a getter and setter function were not defined for
      them, because is_gobject_property_name() did not consider them to be
      properties. Now, the setter function works as normal while the getter
      function just pretends a write-only property has the value of undefined.
      
      The test is marked pending until a test is added to the
      gobject-introspection test suite.
      9f53812a
  2. 22 Oct, 2018 3 commits
  3. 08 Oct, 2018 6 commits
    • Marco Trevisan's avatar
      context: use timeout with seconds to schedule a gc trigger · e3f6208a
      Marco Trevisan authored
      We can use lower granularity as we care about seconds anyway
      e3f6208a
    • Daniel van Vugt's avatar
      context: Defer and therefore batch forced GC runs · c281d9c2
      Daniel van Vugt authored
      Since commit e9e96955, forced GC runs get queued very often in some
      cases. For example, during the gnome-shell icon spring animation around
      60% of gnome-shell's CPU time was spent in `trigger_gc_if_needed`.
      That's too much.
      
      We now defer the forced GC runs by 10 seconds, which provides two
      significant performance benefits:
      
        1. Animations triggering garbage collection are unlikely to have their
           performance adversely affected by the run because the animation
           will be finished before it starts.
      
        2. The total number of garbage collection runs is much lower because
           they're more likely to have been batched into the same run.
      
      This has the observed benefit, for example, of reducing the CPU usage
      of the gnome-shell icon spring animation from 78% to 47% on an i7-7700
      (a 40% relative reduction).
      
      Closes: gnome-shell#582
      c281d9c2
    • Philip Chimento's avatar
      tests: Don't time-limit the unit tests · 358a9797
      Philip Chimento authored
      Previously there was code that would intentionally crash if more than 7
      minutes elapsed, in case the tests got stuck on autobuilders. This code
      is more harmful than helpful, see the following table:
      
        Times it has killed a stuck test on GitLab: . . . . . . . . 0
        Times it has killed a JS_GC_ZEAL test:  . . . . . . . . .  34
        Times it has killed my GDB session because I forgot
          to add the stupid environment variable: . . . . . . . . 478
      358a9797
    • Philip Chimento's avatar
      build: Remove useless pkgconfig check · 7e9e35ee
      Philip Chimento authored
      This was necessary because some test code used to use GUnixOutputStream,
      but it no longer does.
      7e9e35ee
    • Philip Chimento's avatar
      tools: Update clang-format scripts · a3e11762
      Philip Chimento authored
      A few bugs have been fixed upstream.
      a3e11762
    • Philip Chimento's avatar
      build: Remove apostrophe from conftest program · cf56080b
      Philip Chimento authored
      I noticed that this apostrophe causes a warning while compiling the
      conftest program. The text of this error message really doesn't matter,
      so just remove the apostrophe.
      cf56080b
  4. 24 Sep, 2018 3 commits
  5. 13 Sep, 2018 2 commits
    • Philip Chimento's avatar
      GLib: Fix regression in GVariant packing · 15cf7c29
      Philip Chimento authored
      This was a use of the old ByteArray API that hadn't been updated.
      
      Closes: #202
      15cf7c29
    • Florian Müllner's avatar
      GObject: Ensure generated GType names are valid · cacdb796
      Florian Müllner authored
      JS classes accept names that aren't valid GType names. Usually this
      is something the programmer can take into account, however sometimes
      a parent class isn't under their control and can therefore change
      unexpectedly (gnome-shell extensions are a primary example).
      
      Handle this case gracefully by replacing any invalid characters with
      underscores.
      
      !229
      cacdb796
  6. 01 Sep, 2018 2 commits
  7. 30 Aug, 2018 1 commit
  8. 28 Aug, 2018 2 commits
  9. 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
  10. 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
  11. 16 Aug, 2018 2 commits
  12. 14 Aug, 2018 1 commit
  13. 13 Aug, 2018 3 commits