1. 13 Aug, 2018 2 commits
  2. 23 Jul, 2018 1 commit
    • Philip Chimento's avatar
      debugger: GJS Debugger · ee89551e
      Philip Chimento authored
      This adds a simple debugger, adapted from the "jorendb" program in the
      SpiderMonkey source. It has basic stepping, breaking, and printing
      commands, that work like GDB. Activate it by running the GJS console
      interpreter with the -d or --debugger flag _before_ the name of the JS
      program on the command line.
      
      To integrate it into programs that embed the GJS interpreter, call
      gjs_context_setup_debugger_console() before executing the JS program.
      
      It will print when Promises are launched and resolved, although it's not
      yet possible to break at those points.
      
      Closes: #110
      ee89551e
  3. 28 Dec, 2016 2 commits
  4. 10 Dec, 2016 1 commit
    • Philip Chimento's avatar
      js: Call JS_Init() and JS_ShutDown() · 6b25ce3b
      Philip Chimento authored
      Starting with mozjs31, JS_Init() is required. Calling JS_ShutDown() on
      exit is not required, but may become so in the future.
      
      This does so in the constructor and destructor of a static object.
      Normally this is discouraged because the order in which the constructors
      and destructors are called is not guaranteed, but I don't think that is a
      problem here since it's unlikely that anyone will try to use GJS API from
      a static constructor.
      
      However, API clients still must unref any GjsContext before the program
      shuts down. Usually this is not a problem, unless a JS script calls
      System.exit(), in which case the code would exit immediately without
      unreffing the GjsContext before JS_ShutDown was called. Instead, we make
      System.exit() throw an uncatchable exception, which is propagated all the
      way up to JS::Evaluate() and turned into a GError with code
      GJS_ERROR_SYSTEM_EXIT, thrown from gjs_context_eval().
      
      For this, we need to expose GjsError and its error codes in the public
      API. (They should have been exposed already, because gjs_context_eval()
      could already throw GJS_ERROR_FAILED.)
      
      Finally, the tests added as part of this patch made the testSystemExit
      script obsolete.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=751252
      6b25ce3b
  5. 30 Nov, 2016 3 commits
    • Philip Chimento's avatar
      build: Reorganize testing makefiles · 838a7f34
      Philip Chimento authored
      These were a bit hard to navigate before, it was difficult to determine
      where to look if you wanted to write a test for new functionality. Now
      everything devoted to making "make check" work is in Makefile-test.am.
      The file is delineated into sections and comments are added.
      
      All the rules for converting some of the tests into installed tests, and
      installing them in the right place, are in Makefile-insttest.am now.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=775205
      838a7f34
    • Philip Chimento's avatar
      build: Remove privlibdir in favour of pkglibdir · 8cda645e
      Philip Chimento authored
      Elsewhere in the makefiles this is referred to as pkglibdir, so it would
      have been broken anyhow if they were not the same.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=775205
      8cda645e
    • Philip Chimento's avatar
      build: Use Automake test driver with TAP output · 8feb2e49
      Philip Chimento authored
      For better integration with the build system and nicer output, use
      Automake's TAP driver and gtester's TAP output mode.
      
      There are a few things going on in this commit:
      
      - We don't put logs in test_user_data/logs anymore. That really assumed
        in the first place that all tests would be run serially, and we want
        them to be run in parallel. So we'll let Automake take care of the
        stderr and debug outputs and redirect them to a per-test log file.
      
      - We use the significant-to-Automake variable TESTS instead of
        TEST_PROGS. TESTS contains whatever is in check_PROGRAMS plus whatever
        else we put into it (our test script.)
      
      - TESTS_ENVIRONMENT is also significant to Automake, but should not be
        set within Automake, instead the AM_TESTS_ENVIRONMENT variable should
        be used so that the developer can override TESTS_ENVIRONMENT from the
        command line. This variable consists of a sequence of commands and
        needs to end with a semicolon. (So we can stuff XVFB_START in there
        too.)
      
      - We need to put the test invocation in a separate script since gtester
        doesn't pass the --tap option on to its test binary.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=775205
      8feb2e49
  6. 29 Nov, 2016 1 commit
  7. 22 Oct, 2016 2 commits
  8. 30 Sep, 2016 5 commits
  9. 10 Feb, 2016 1 commit
    • Philip Chimento's avatar
      build: Untangle (AM_) CFLAGS, CPPFLAGS, CXXFLAGS · 0f92f6be
      Philip Chimento authored
      In Automake, CPPFLAGS stands for C PreProcessor flags. C source files are
      compiled with CPPFLAGS and CFLAGS, while C++ source files are compiled
      with CPPFLAGS and CXXFLAGS. The exception to this naming convention is
      the PKG_CHECK_MODULES macro which substs a variable named <FOO>_CFLAGS
      which should properly be called <FOO>_CPPFLAGS.
      
      This untangles all the flags definitions so that -I and -D flags, which
      are preprocessor arguments, are put into CPPFLAGS variables, not into
      CFLAGS or CXXFLAGS. Otherwise they won't apply to both C and C++ source
      files.
      
      In addition, when using per-target flags, make sure to include the AM_
      prefixed variable as well, because otherwise per-target flags will
      override it. Conversely, if an assignment sets a per-target flags variable
      to only be the AM_ prefixed variable (e.g., "something_CFLAGS =
      $(AM_CFLAGS)") then it is redundant.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=761072
      0f92f6be
  10. 25 Jan, 2016 1 commit
    • Philip Chimento's avatar
      build: Only force shared libraries if necessary · a3b22071
      Philip Chimento authored
      The libtool argument -rpath /nowhere is the (bizarrely) recommended way
      to force generation of a shared library even if Automake thinks you
      should not have a shared library. This happens when your library is part
      of the check or noinst target.
      
      We only need to force a shared library if --enable-installed-tests is not
      given to configure. Normally the extra -rpath does not matter in the case
      of --enable-installed tests, but OS X's linker chokes if a second -rpath
      argument is given.
      
      This change makes sure the -rpath argument is only added when necessary.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=737702
      a3b22071
  11. 28 Oct, 2015 1 commit
  12. 27 Oct, 2015 1 commit
  13. 31 Jul, 2015 1 commit
  14. 13 Jul, 2015 1 commit
    • Philip Chimento's avatar
      lang: Pure Javascript Lang.Interface · 1eab5f69
      Philip Chimento authored
      This introduces Lang.Interface, a counterpart to Lang.Class that allows
      Lang.Class-created objects to implement interfaces. The interface's
      properties will be copied to the implementing object, so that you can
      have default implementations of methods.
      
      Any properties with the value Lang.Interface.UNIMPLEMENTED must be
      overridden by the implementing class. You will get an exception if you
      try to define a class that doesn't override one of these.
      
      An interface can require other interfaces or classes, just as with
      GObject interfaces. If an interface requires a class, it means that a
      class implementing that interface must inherit from the required class.
      
      GObject.Object-derived classes can also implement Lang.Interfaces. This
      commit does not yet let you define new GObject-style interfaces with
      properties and signals and a GType.
      
      The Lang.Interface._check() mechanism is loosely based on a MooTools
      plugin: https://github.com/sebwoh/Mootools-Class-Interfaces/
      
      Implementation notes / Discussion points
      ========================================
      
      - An alternative would be to make Lang.Interface a metaclass. (See
        installed-tests/js/testMetaclass.js for an example of metaclasses.)
        This patch assumes that we don't want Lang.Interface to inherit from
        Lang.Class but instead only have _Base as a shared parent. The
        metaclass approach would mean that you would create a new interface as
        a Lang.Class that extends Lang.Interface.
      
      - There is no this.parent() equivalent for interfaces. That's on purpose
        because there is also no such thing in C GObject; unlike parent classes
        where you get a convenient my_object_parent_class pointer to the class
        struct, you have to explicitly get the interface's vtable if you want
        to chain up. That would additionally require us to define a method
        resolution order, which is a bit of an alien concept in Javascript.
      
      - Interfaces purposely don't have an _init function. This is because
        GObject interfaces don't have an instance init function either, because
        they can't have any private data. However, I can see it being useful in
        Javascript, since your `this` is the implementing object, and you can
        stick any properties you want on there already in your interface
        methods. However, same concern about method resolution order applies.
      
      (Collaboration by Philip Chimento <philip@endlessm.com> and Roberto
      Goizueta <goizueta@endlessm.com>)
      
      https://bugzilla.gnome.org/show_bug.cgi?id=751343
      1eab5f69
  15. 19 Jun, 2015 1 commit
    • Philip Chimento's avatar
      build: Fix installed test GResource dependencies · 90160487
      Philip Chimento authored
      The jsunit binary did not have its dependencies complete; it has a
      GResource compiled into it but the GResource was not properly picking up
      its dependencies due to some incorrect variable names. The generated
      GResource C files also need to be added to BUILT_SOURCES and .gitignore.
      90160487
  16. 12 Jun, 2015 1 commit
  17. 21 Dec, 2014 1 commit
  18. 26 Nov, 2014 1 commit
  19. 17 Nov, 2014 1 commit
  20. 29 Sep, 2014 2 commits
  21. 02 May, 2014 1 commit
  22. 04 Mar, 2014 1 commit
  23. 27 Feb, 2014 1 commit
  24. 24 Feb, 2014 1 commit
  25. 29 Jan, 2014 1 commit
    • Sam Spilsbury's avatar
      coverage: Add GjsCoverage · 7ef7d25d
      Sam Spilsbury authored
      GjsCoverage is a wrapper around coverage.js, a new module
      which uses the JS Debugger API and JS Reflect API to collect
      hits counts for lines, branches and functions.
      
      Pass -C or --coverage-path to specify a file that should be
      added to the coverage report. --coverage-output must also
      be passed when using these options and specifies a directory
      to write coverage reports to. This will copy the directory
      structure of covered files into this directory and generate
      an lcov compatible coverage report at coverage.lcov. This file
      will be opened in append-mode and should be deleted when coverage
      reports need to be regenerated.
      7ef7d25d
  26. 02 Jan, 2014 1 commit
  27. 29 Oct, 2013 1 commit
  28. 25 Oct, 2013 1 commit
  29. 16 Oct, 2013 1 commit
  30. 25 Sep, 2013 1 commit