| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
We're currently keeping a list of trampolines in a static vector, this
is acceptable (at least for a single-context scenario), but trampolines are
bound to a specific context so better to move the handling in the context.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GjsMaybeOwned had a notification support that was used only by Closures
(other than tests), this was causing adding an extra pointer to all
the types using it (including Object) that was mostly unused.
So, move this into private context, re-implementing it using our own
notifier (instead of relying on GObject's that needs a specific order) and
use it in closures.
Also add an hook to handle gc events on private context that will be in
later changes to cleanup more things, but for now is used to shrink the
closures vector once we've done.
|
|
|
|
|
|
|
|
| |
The 'S' specifier also expects a string argument, or additionally null if
it is given as '?S'. Unlike 's' and 'F', it does not convert the string
value at all, and instead puts it into a JS::MutableHandleString.
This will be used in the Encoding specification.
|
|
|
|
|
|
|
|
|
|
| |
Apparently I never checked what happened when this assertion failed. Since
it is only used directly in run_code_expect_exception(), the string and
pattern are generated dynamically, so the error message would be something
like '("message" matches "pattern")', totally unhelpful.
Use g_assertion_message_cmpstr() with a made-up comparison operator, to
give a more helpful message.
|
|
|
|
|
|
|
|
|
| |
Fedora removed this from their build dependencies of mozjs78, but they had
to add a big patch which we don't want to carry in ptomato/mozjs. So add
autoconf213 to the list of dependencies to install manually.
See commit:
https://src.fedoraproject.org/rpms/mozjs78/c/0be21c3fd170b1e5e5920c4a59d6c7d6c6b9c7f7?branch=f33
|
|
|
|
|
| |
We print out the value % INT64_MAX in this debug function because printing
out the full value requires a JSContext and may be fallible.
|
| |
|
|
|
|
|
|
| |
We can safely compare integers of different sizes, assuming they're
both signed (or unsigned). So assert this instead of requiring two
arguments of the very same type.
|
|
|
|
| |
Following what GLib did as well everywhere.
|
|
|
|
| |
Will help avoiding clashes in unity builds
|
|
|
|
|
|
| |
Instead of relying only on (at times unpredictible) JS tests for toggle
queue handling and Objects memory management, add unit tests in which we
manually handle an ObjectInstance and we simulate toggle events on it.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
...And the other way around, so that we won't include more than needed
both in code and pch headers
As per this we need to install actual bash and grep on alpine as this
script needs those features (which are not provided by buysbox).
|
|
|
|
|
|
|
|
|
| |
In order to go along with the other source-like representations in
gjs_debug_value(), such as Symbol("foo") and 42n, print quotes around
strings.
However, when printing strings as a property key in gjs_debug_id(), don't
print quotes.
|
| |
|
|
|
|
|
| |
(Changes from Philip folded in: use native function with reserved slot to
store built argv array)
|
|
|
|
|
| |
To allow import() from scripts we must set script privates
with an object similar to the ModulePrivate class.
|
|
|
|
|
|
| |
(Changes from Philip folded in: tests, moving file operations into
internal.cpp, store module loader in global, some renames, some added
comments)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
std::ostringstream is the C++ standard library version of GString. If we
are not doing any formatting but only appending other strings, then we can
even just use std::string and the + operator.
This allows using RAII so we can get rid of a goto, and just generally be
more memory-safe.
We continue using GString in gjs_hyphen_from_camel() for performance
reasons, because we would like a modifiable C buffer that we can pass to
canonicalize_key(), and the only way to get a modifiable buffer out of
std::string would be to copy it.
Note: stream.str() _creates_ a std::string object, and copies the string
data. string.c_str() returns a const char* _without_ copying.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use git-merge-base to calculate the newest common ancestor, which should
be more reliable.
Also increase the horizon to 28 days since the newest common ancestor of
this very merge request is more than 14 days old. Check that any commits
were fetched (if not, "the remote end hung up unexpectedly") and fetch the
last 30 commits instead if it didn't work. (Code review suggestion from
Evan)
As well, it seems that this feature does not always work quite correctly,
so it would be good to have some debug output.
|
|
|
|
|
| |
Clang also understands the idiom `a = *&a` to silence warnings about self-
assignment if it is done intentionally.
|
|
|
|
|
| |
g_assert can be compiled out with G_DISABLE_ASSERT, so it should not be
used in unit tests.
|
|
|
|
| |
JHBuild is no longer used.
|
|
|
|
|
| |
Now that we've upgraded to Fedora 33, we can avoid building sysprof
ourselves and just use the distro package.
|
|
|
| |
This reverts merge request !544
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Instead of always comparing against GNOME/gjs/master, try to find the
place where the current branch was branched off of the upstream repository
using an adaptation of the script that GLib uses.
The main adaptation compared to GLib is that we are running on a
lightweight image with sh and busybox, so we don't have fancy things like
process redirection and diff formatting options.
|
|
|
|
|
|
|
|
| |
Clone everything at depth 1, omitting tags, and fetching a specific branch
only.
Thanks to:
https://tecnocode.co.uk/2020/07/09/easily-speed-up-ci-by-reducing-download-size/
|
|
|
|
|
|
|
| |
IWYU 0.15 improves the accuracy of detecting missing includes, and also
removes a few false positives but also adds new false positives. Since we
are now running 0.15 in CI, we must adapt the postprocessing script, and
make the necessary changes to the source files.
|
|
|
|
| |
Replace with nullptr which is a keyword.
|
|
|
|
|
| |
There were a few instances of this false positive already in the code base
so remove those includes and add the files to the false positive list.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Based on looking at the git logs, add copyright notices to files which
were missing them, assuming the copyright belongs to people who made major
contributions to each file.
Some assumptions were made as to who to assign the copyright to, such as,
what copyright assignment did the contributor make in other files added in
the same commit? What email address did they use to make the commit? What
copyright assignment did they make in other commits using the same email
address?
|
|
|
|
|
|
| |
Allows us to move back to the distro's latest version of Meson, which no
longer has the bug that considers skipped tests as failed. Also upgrades
IWYU to 0.15, the version that goes along with Clang 11.
|
|
|
|
|
|
|
| |
Now that we have switched to mozjs78 there's no longer a need to continue
building new mozjs68 images. We can just use the one we currently have,
until it's no longer needed. Switch the defaults in the Dockerfiles to
build mozjs78 instead.
|
|
|
|
| |
And use them for mozjs78 builds, as build-deps may change
|
|
|
|
|
| |
Hopefully these are just drop-in replacements. We cannot rely on DockerHub
anymore because they are rate-limiting pulls.
|
|
|
|
|
| |
Since we are already building a light image with linters, add cpplint to
it as well and remove the separate Dockerfile build.
|
|
|
|
|
|
|
| |
The GObject.ref_count field is private, who knew! It is still accessible
but apparently it messes up cppcheck, so we use GObject weak pointers
instead to track the reference count of these objects, as demonstrated in
https://stackoverflow.com/a/24459058/172999
|
|
|
|
| |
A newer version of cppcheck catches this.
|
|
|
|
|
|
|
|
|
|
|
| |
ESLint has deprecated jsdoc and instead recommends eslint-plugin-jsdoc.
lint-condo does not have eslint-plugin-jsdoc. We only use lint-condo for
eslint currently and it is simpler to instead use yarn to install and
manage eslint.
Some module files had JSDoc comments which violated the jsdoc
plugin's more stringent rules.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As per C++ standard is perfectly legal for the compiler to check
template definitions both during instantation (so looking at potential
issues) and after their actual usage, so while g++ is more liberal on this
and will not try to define functions which are disabled when allocating
the template, clang++ will do it.
So, in the case of using a void pointer to hold GjsAutoPointer it will
complain when using void[] type.
To avoid this, let's change the array constructor definition to use an
implicit template value, while we still check it properly as part of the
enable_if check, so that we'll eventually have the same result.
Also fix other compilation issues due to clang being a bit more
stricter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had FIXME's about this for some time now, but we had a quite nice way
to check whether we're handling nullptr functions at compile time, so
that we can produce safe code with less dynamic checks:
- Previously we were trying to use `if constexpr (ref_func != nullptr)`
- The error we were getting was because we were trying to compare
a template value (that will be evaluated at link time) with
a null pointer (that yes, is a constant value).
- However, C++ provides us since the long C++11 times a nice tool that
allows to generate a type out from any constant value and that we can
do use it to do constexpr checks.
- Thus for each template function parameter we can just compute its
integral constant type, and ensure that it's not matching null.
Under the hood this will generate such types for examples:
for g_object_ref:
std::integral_constant<GObject* (*)(GObject*), g_object_ref>;
for nullptr:
std::integral_constant<GObject* (*)(GObject*), 0>
And those types are indeed different.
Added few tests, although to test invalid types we should add some
no-compilation tests.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not being an unique_ptr anymore we've some more freedom (that will be
way more when C++ will allow us to do more static checks), one of the
good gain we've now, is that we can easily implement a copy and swap
idiom to allow to pass the wrappers by value ensuring an internal copy.
This will not work (unfortunately only with runtime checks! :-( ) if the
wrapper doesn't provide a copy function, but this is still nice.
Tests included.
|
| |
|
|
|
|
|
|
|
|
| |
As per moving away from std::unique_ptr we lost support for C++ native
objects, even this may be optional (as we can just use stl containers
for that), it's still nice to have.
So add it back and include tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduced GjsAutoPointer as part of commit dab3c7d06, to avoid duplication
of the same code everywhere, and that served us well to create multiple
smart pointer types, however since we were relying on std::unique_ptr,
all the times we created a pointer with a custom destructor, we were
allocating 8bits more, and this can be sensitive when used around in
wrappers.
However, since we are already constructing the auto-pointers passing all
these information as template (generating some custom code, for sure),
we can just rely on the template parameters also for the destructor, and
so ensuring that the struct size always matches the wrapped pointer,
removing all the overhead.
This will allow to use GjsAutoPointer's everywhere without increasing
the size of the wrapped objects.
As per this being all new (even though the API is mainly inspired to
unique_ptr), adding various unit tests to ensure we behave correctly.
|
| |
|
|
|
|
|
|
| |
GCC accepts this, but when compiling with Clang we get an error that the
random number generator cannot be instantiated in a constant expression.
That makes sense.
|