Commit 8efdd760 authored by Simon McVittie's avatar Simon McVittie

New upstream version 1.53.90

parents 0b59d12b 6989c629
......@@ -8,24 +8,30 @@ gjsinsttestdir = $(pkglibexecdir)/installed-tests
installedtestmetadir = $(datadir)/installed-tests/gjs
jstestsdir = $(gjsinsttestdir)/js
jsscripttestsdir = $(gjsinsttestdir)/scripts
debuggertestsdir = $(gjsinsttestdir)/debugger
gjsinsttest_PROGRAMS =
gjsinsttest_DATA =
gjsinsttest_SCRIPTS =
installedtestmeta_DATA =
jstests_DATA =
jsscripttests_DATA =
debuggertests_DATA =
gjsinsttest_PROGRAMS += minijasmine
gjsinsttest_SCRIPTS += installed-tests/
installedtestmeta_DATA += \
$(jasmine_tests:.js=.test) \
$(simple_tests:%=%.test) \
installedtestmeta_DATA += \
$(jasmine_tests:.js=.test) \
$(simple_tests:%=%.test) \
$(debugger_tests:.debugger=.test) \
jstests_DATA += $(jasmine_tests)
jsscripttests_DATA += $(simple_tests)
debuggertests_DATA += $(debugger_tests)
%.test: %.js installed-tests/ Makefile
......@@ -35,6 +41,13 @@ pkglib_LTLIBRARIES +=
< $(srcdir)/installed-tests/ > $@.tmp && \
mv $@.tmp $@
%.test: %.debugger installed-tests/ Makefile
$(AM_V_GEN)$(MKDIR_P) $(@D) && \
$(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
-e s,@name\@,$(notdir $<), \
< $(srcdir)/installed-tests/ > $@.tmp && \
mv $@.tmp $@
%.test: % installed-tests/ Makefile
$(AM_V_GEN)$(MKDIR_P) $(@D) && \
$(SED) -e s,@pkglibexecdir\@,$(pkglibexecdir), \
......@@ -204,6 +204,7 @@ common_jstests_files = \
installed-tests/js/testGio.js \
installed-tests/js/testImporter.js \
installed-tests/js/testLang.js \
installed-tests/js/testLegacyByteArray.js \
installed-tests/js/testLegacyClass.js \
installed-tests/js/testLegacyGObject.js \
installed-tests/js/testLocale.js \
......@@ -228,6 +229,10 @@ jasmine_tests += \
installed-tests/js/testGObjectDestructionAccess.js \
installed-tests/js/testLegacyGtk.js \
......@@ -279,8 +284,9 @@ AM_TESTS_ENVIRONMENT = \
export G_FILENAME_ENCODING=latin1; \
export LSAN_OPTIONS="suppressions=$(abs_top_srcdir)/installed-tests/extra/lsan.supp"; \
export NO_AT_BRIDGE=1; \
export LC_ALL=C.UTF-8; \
export LC_ALL=C.UTF-8; \
......@@ -291,13 +297,39 @@ simple_tests = \
EXTRA_DIST += $(simple_tests)
debugger_tests = \
installed-tests/debugger/backtrace.debugger \
installed-tests/debugger/breakpoint.debugger \
installed-tests/debugger/continue.debugger \
installed-tests/debugger/delete.debugger \
installed-tests/debugger/detach.debugger \
installed-tests/debugger/down-up.debugger \
installed-tests/debugger/finish.debugger \
installed-tests/debugger/frame.debugger \
installed-tests/debugger/keys.debugger \
installed-tests/debugger/next.debugger \
installed-tests/debugger/print.debugger \
installed-tests/debugger/quit.debugger \
installed-tests/debugger/return.debugger \
installed-tests/debugger/set.debugger \
installed-tests/debugger/step.debugger \
installed-tests/debugger/throw.debugger \
installed-tests/debugger/until.debugger \
$(debugger_tests) \
$(debugger_tests:%=%.js) \
$(debugger_tests:%=%.output) \
gjs-tests.gtester \
$(simple_tests) \
$(jasmine_tests) \
$(debugger_tests) \
TEST_EXTENSIONS = .gtester .sh .js
TEST_EXTENSIONS = .gtester .sh .js .debugger
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/
......@@ -309,6 +341,10 @@ SH_LOG_DRIVER = $(LOG_DRIVER)
JS_LOG_COMPILER = $$LOG_COMPILER $$LOG_FLAGS $(top_builddir)/minijasmine
DEBUGGER_LOG_COMPILER = $(top_srcdir)/installed-tests/
EXTRA_DIST += installed-tests/
CODE_COVERAGE_IGNORE_PATTERN = */{include,mfbt,gjs/test}/*
This diff is collapsed.
Version 1.53.90
- GJS now depends on SpiderMonkey 60 and requires a compiler capable of C++14.
- GJS includes a simple debugger now. 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.
- New API for programs that embed GJS: gjs_context_setup_debugger_console().
To integrate the debugger into programs that embed the GJS interpreter, call
this before executing the JS program.
- New JavaScript features! This version of GJS is based on SpiderMonkey 60, an
upgrade from the previous ESR (Extended Support Release) of SpiderMonkey 52.
Here are the highlights of the new JavaScript features.
For more information, look them up on MDN or
* New syntax
+ `for await (... of ...)` syntax is used for async iteration.
+ The rest operator is now supported in object destructuring: e.g.
`({a, b,} = {a: 1, b: 2, c: 3, d: 4});`
+ The spread operator is now supported in object literals: e.g.
`mergedObject = {...obj1, ...obj2};`
+ Generator methods can now be async, using the `async function*` syntax,
or `async* f() {...}` method shorthand.
+ It's now allowed to omit the variable binding from a catch statement, if
you don't need to access the thrown exception: `try {...} catch {}`
* New APIs
+ Promise.prototype.finally(), popular in many third-party Promise
libraries, is now available natively.
+ String.prototype.toLocaleLowerCase() and
String.prototype.toLocaleUpperCase() now take an optional locale or
array of locales.
+ Intl.PluralRules is now available.
+ Intl.NumberFormat.protoype.formatToParts() is now available.
+ Intl.Collator now has a caseFirst option.
+ Intl.DateTimeFormat now has an hourCycle option.
* New behaviour
+ There are a lot of minor behaviour changes as SpiderMonkey's JS
implementation conforms ever closer to ECMAScript standards. For complete
information, read the Firefox developer release notes:
* Backwards-incompatible changes
+ Conditional catch clauses have been removed, as they were a Mozilla
extension which will not be standardized. This requires some attention in
GJS programs, as previously we condoned code like `catch (e if
e.matches(Gio.IOError, Gio.IOError.EXISTS))` with a comment in
overrides/GLib.js, so it's likely this is used in several places.
+ The nonstandard `for each (... in ...)` loop was removed.
+ The nonstandard legacy lambda syntax (`function(x) x*x`) was removed.
+ The nonstandard Mozilla iteration protocol was removed, as well as
nonstandard Mozilla generators, including the Iterator and StopIteration
objects, and the Function.prototype.isGenerator() method.
+ Array comprehensions and generator comprehensions have been removed.
+ Several nonstandard methods were removed: ArrayBuffer.slice() (but not
the standard version, ArrayBuffer.prototype.slice()),
Date.prototype.toLocaleFormat(), Function.prototype.isGenerator(),, and Object.prototype.unwatch().
- Many of the above backwards-incompatible changes can be caught by scanning
your source code using, or
- Deprecation: the custom ByteArray is now discouraged. Instead of ByteArray,
use Javascript's native Uint8Array. The ByteArray module still contains
functions for converting between byte arrays, strings, and GLib.Bytes
The old ByteArray will continue to work as before, except that Uint8Array
will now be returned from introspected functions that previously returned a
ByteArray. To keep your old code working, change this:
let byteArray = functionThatReturnsByteArray();
to this:
let byteArray = new ByteArray.ByteArray(functionThatReturnsByteArray());
To port to the new code:
* ByteArray.ByteArray -> Uint8Array
* ByteArray.fromArray() -> Uint8Array.from()
* ByteArray.ByteArray.prototype.toString() -> ByteArray.toString()
* ByteArray.ByteArray.prototype.toGBytes() -> ByteArray.toGBytes()
* ByteArray.fromString(), ByteArray.fromGBytes() remain the same
* Unlike ByteArray, Uint8Array's length is fixed. Assigning an element past
the end of a ByteArray would lengthen the array. Now, it is ignored.
Instead use Uint8Array.of(), for example, this code:
let a = ByteArray.fromArray([97, 98, 99, 100]);
a[4] = 101;
should be replaced by this code:
let a = Uint8Array.from([97, 98, 99, 100]);
a = Uint8Array.of(...a, 101);
The length of the byte array must be set at creation time. This code will
not work anymore:
let a = new ByteArray.ByteArray();
a[0] = 255;
Instead, use "new Uint8Array(1)" to reserve the correct length.
- Closed bugs and merge requests:
* Run tests using real software [#178, !192, Claudio André]
* Script tests are missing some errors [#179, !192, Claudio André]
* Create a '--disable-readline' option and use it [!196, Claudio André]
* CI: stop using Fedora for clang builds [!198, Claudio André]
* Expose GObject static property symbols. [!197, Evan Welsh]
* CI fixes [!200, Claudio André]
* Docker images creation [!201, Claudio André]
* Get Docker images built and stored in GJS registry [#185, !203, !208,
Claudio André, Philip Chimento]
* Clear the static analysis image a bit more [!205, Claudio André]
* Rename the packaging job to flatpak [!210, Claudio André]
* Create SpiderMonkey 60 docker images [!202, Claudio André]
* Debugger [#110, !204, Philip Chimento]
* Add convenience g_object_set() replacement [!213, Florian Müllner]
* Add dependencies of the real tests (examples) [!215, Claudio André]
* CWE-126 [#174, !218, Philip Chimento]
* gjs no longer builds after recent autoconf-archive updates [#149, !217,
Philip Chimento]
* gjs-1.52.0 fails to compile against x86_64 musl systems [#132, !214, Philip
* Run the GTK real tests (recently added) [!212, Claudio André]
* Fix thorough tests failures [!220, Philip Chimento]
* Port to SpiderMonkey 60 [#161, !199, Philip Chimento]
* Replace ByteArray with native ES6 TypedArray [#5, !199, Philip Chimento]
* Overriding GInterface properties broke [#186, !216, Florian Müllner, Philip
* Avoid segfault when checking for GByteArray [!221, Florian Müllner]
- Various build fixes [Philip Chimento]
Version 1.53.4
......@@ -1235,7 +1235,7 @@ m4_include([m4/ax_compiler_flags_cxxflags.m4])
......@@ -15,8 +15,8 @@
/* The gjs version as an integer */
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* define if the compiler supports basic C++14 syntax */
#undef HAVE_CXX14
/* Define to 1 if SpiderMonkey was compiled with --enable-debug */
This diff is collapsed.
......@@ -3,7 +3,7 @@
m4_define(pkg_major_version, 1)
m4_define(pkg_minor_version, 53)
m4_define(pkg_micro_version, 4)
m4_define(pkg_micro_version, 90)
m4_define(pkg_version, pkg_major_version.pkg_minor_version.pkg_micro_version)
m4_define(pkg_int_version, (pkg_major_version * 100 + pkg_minor_version) * 100 + pkg_micro_version)
......@@ -32,7 +32,7 @@ PKG_INSTALLDIR
# no stupid static libraries
......@@ -65,7 +65,7 @@ GOBJECT_INTROSPECTION_REQUIRE([1.41.4])
GOBJECT_REQUIREMENT="gobject-2.0 >= glib_required_version"
gjs_base_packages="$GOBJECT_REQUIREMENT gio-2.0"
common_packages="gthread-2.0 gio-2.0 >= glib_required_version mozjs-52"
common_packages="gthread-2.0 gio-2.0 >= glib_required_version mozjs-60"
gjs_packages="gobject-introspection-1.0 libffi $common_packages"
gjs_cairo_packages="cairo cairo-gobject $common_packages"
gjs_gtk_packages="gtk+-3.0 >= 3.20"
......@@ -152,39 +152,59 @@ AS_IF([test x$have_gtk = xyes], [
[AS_HELP_STRING([--disable-profiler], [Don't build profiler])])
AS_IF([test x$enable_profiler != xno], [
# Requires timer_settime() - only on Linux
AS_IF([test x$ac_cv_func_timer_settime = xno],
# Requires SIGEV_THREAD_ID - not in some stdlibs
AC_LANG_PROGRAM([[#include <signal.h>]], [return SIGEV_THREAD_ID;])
], [
], [AC_MSG_RESULT([no])])
AS_IF([test x$ac_cv_func_timer_settime = xno -o x$have_sigev_thread_id = xno],
[AC_MSG_ERROR([The profiler is currently only supported on Linux.
The standard library must support timer_settime() and SIGEV_THREAD_ID.
Configure with --disable-profiler to skip it on other platforms.])])
AC_DEFINE([ENABLE_PROFILER], [1], [Define if the profiler should be built.])
AM_CONDITIONAL([ENABLE_PROFILER], [test x$enable_profiler != xno])
# Optional redline dep (enabled by default)
[AS_HELP_STRING([--disable-readline], [Don't build readline-related code @<:@default=no@:>@])])
PKG_CHECK_VAR([GI_DATADIR], [gobject-introspection-1.0], [gidatadir])
# readline
# On some systems we need to link readline to a termcap compatible
# library.
AC_MSG_CHECKING([how to link readline libs])
for gjs_libtermcap in "" ncursesw ncurses curses termcap; do
if test -z "$gjs_libtermcap"; then
READLINE_LIBS="-lreadline -l$gjs_libtermcap"
if test $gjs_cv_lib_readline = yes; then
AS_IF([test x$enable_readline != xno],[
# On some systems we need to link readline to a termcap compatible
# library.
AC_MSG_CHECKING([how to link readline libs])
for gjs_libtermcap in "" ncursesw ncurses curses termcap; do
if test -z "$gjs_libtermcap"; then
READLINE_LIBS="-lreadline -l$gjs_libtermcap"
if test $gjs_cv_lib_readline = yes; then
if test $gjs_cv_lib_readline = no; then
AS_IF([test x$enable_readline != xno],
[AC_MSG_ERROR([Readline requested but not found. Configure with --disable-readline.])])
......@@ -287,6 +307,16 @@ AX_APPEND_COMPILE_FLAGS([$lt_prog_compiler_pic], [CXXFLAGS])
AX_APPEND_COMPILE_FLAGS([$lt_prog_compiler_pic], [CFLAGS])
dnl If SpiderMonkey was compiled with this configure option, then GJS needs to
dnl be compiled with it as well, because we inherit from a SpiderMonkey class in
dnl context.cpp. See build/autoconf/compiler-opts.m4 in mozjs52.
[needs to match SpiderMonkey's config option @<:@default=off@:>@])])
AS_IF([test "x$enable_cpp_rtti" != "xyes"],
[Run all tests under an XVFB server @<:@default=no@:>@])])
The ByteArray type in the `imports.byteArray` module is based on an
ECMAScript 4 proposal that was never adopted. This can be found at:
and the wikitext of that page is appended to this file.
The `imports.byteArray` module was originally based on an
ECMAScript 4 proposal that was never adopted.
Now that ES6 has typed arrays, we use `Uint8Array` to represent byte
arrays in GJS and add some extra functions for conversion to and from
strings and `GLib.Bytes`.
The main difference from the ECMA proposal is that gjs's ByteArray is
inside a module, and `toString()`/`fromString()` default to UTF-8 and take
optional encoding arguments.
There are a number of more elaborate byte array proposals in the
Common JS project at
We went with the ECMA proposal because it seems simplest, and the main
Unlike the old custom `ByteArray`, `Uint8Array` is not resizable. The main
goal for most gjs users will be to shovel bytes between various C
APIs, for example reading from an IO stream and then pushing the bytes
into a parser. Actually manipulating bytes in JS is likely to be
......@@ -20,138 +14,30 @@ messing with bytes, can be done in C.
ECMAScript proposal follows; remember it's almost but not quite like
gjs ByteArray, in particular we use UTF-8 instead of busted Latin-1 as
default encoding.
# ByteArray #
(Also see the [discussion page][1] for this proposal)
## Overview ##
In previous versions of ECMAScript, there wasn't a good way to efficiently represent a packed array of arbitrary bytes. The predefined core object Array is inefficient for this purpose; some developers have (mis)used character strings for this purpose, which may be slightly more efficient for some implementations, but still a misuse of the string type and either a less efficient use of memory (if one byte per character was stored) or cycles (if two bytes per char).
Edition 4 will add a new predefined core object, ByteArray. A ByteArray can be thought of as similar to an Array of uint ([uint]) with each element truncated to the integer range of 0..255.
## Creating a ByteArray ##
To create a ByteArray object:
byteArrayObject = new ByteArray(byteArrayLength:uint)
byteArrayLength is the initial length of the ByteArray, in bytes. If omitted, the initial length is zero.
All elements in a ByteArray are initialized to the value of zero.
Unlike Array, there is no special form that allows you to list the initial values for the ByteArray's elements. However, the ByteArray class has an `intrinsic::to` static method that can convert an Array to a ByteArray, and implementations are free to optimize away the Array instance if it is used exclusively to initialize a ByteArray:
var values:ByteArray = [1, 2, 3, 4]; // legal by virtue of ByteArray.intrinsic::to
## Populating a ByteArray ##
You can populate a ByteArray by assigning values to its elements. Each element can hold only an unsigned integer in the range 0..255 (inclusive). Values will be converted to unsigned integer (if necessary), then truncated to the least-significant 8 bits.
For example,
var e = new ByteArray(3);
e[0] = 0x12; // stores 18
e[1] = Math.PI; // stores 3
e[2] = "foo"; // stores 0 (generates compile error in strict mode)
e[2] = "42"; // stores 42 (generates compile error in strict mode)
e[2] = null; // stores 0
e[2] = undefined; // stores 0
## Referring to ByteArray Elements ##
You refer to a ByteArray's elements by using the element's ordinal number; you refer to the first element of the array as `myArray[0]` and the second element of the array as `myArray[1]`, etc. The index of the elements begins with zero (0), but the length of array (for example, `myArray.length`) reflects the number of elements in the array.
## ByteArray Methods ##
The ByteArray object has the follow methods:
### `static function fromString(s:String):ByteArray` ###
Convert a String into newly constructed ByteArray; this creates a new ByteArray of the same length as the String, then assigns each ByteArray entry the corresponding charCodeAt() value of the String. As with other ByteArray assignments, only the lower 8 bits of the charCode value will be retained.
class ByteArray {
static function fromString(s:String):ByteArray
var a:ByteArray = new Bytearray(s.length);
for (var i:int = 0; i < s.length; ++i)
a[i] = s.charCodeAt(i);
return a;
### `static function fromArray(s:Array):ByteArray` ###
Converts an Array into a newly constructed ByteArray; this creates a new ByteArray of the same length as the input Array, then assigns each ByteArray entry the corresponding entry value of the Array. As with other ByteArray assignments, only the lower 8 bits of the charCode value will be retained.
class ByteArray {
static function fromArray(s:Array):ByteArray
var a:ByteArray = new Bytearray(s.length);
for (var i:int = 0; i < s.length; ++i)
a[i] = s[i];
return a;
### `function toString():String` ###
Converts the ByteArray into a literal string, with each character entry set to the value of the corresponding ByteArray entry.
The resulting string is guaranteed to round-trip back into an identical ByteArray by passing the result to `ByteArray.fromString()`, i.e., `b === ByteArray.fromString(b.toString())`. (Note that the reverse is not guaranteed to be true: `ByteArray.fromString(s).toString != s` unless all character codes in `s` are <= 255)
class ByteArray {
function toString():String
// XXX return String.fromCharCode.apply(String, this);
var s:String = "";
for (var i:int = 0; i < this.length; ++i)
s += String.fromCharCode(this[i]);
return s;
## ByteArray Functions ##
## ByteArray Properties ##
The ByteArray module has the following functions:
The ByteArray object has the following properties:
### `fromString(s:String, encoding:String):Uint8Array` ###
### `length:uint` ###
Convert a String into a newly constructed `Uint8Array`; this creates a
new `Uint8Array` of the same length as the String, then assigns each
`Uint8Array` entry the corresponding byte value of the String encoded
according to the given encoding (or UTF-8 if not given).
This property contains the number of bytes in the ByteArray. Setting the length property to a smaller value decreases the size of the ByteArray, discarding the unused bytes. Setting the length property to a larger value increases the size of the ByteArray, initializing all newly-allocated elements to zero.
### `toString(a:Uint8Array, encoding:String):String` ###
### `prototype:Object` ###
Converts the `Uint8Array` into a literal string. The bytes are
interpreted according to the given encoding (or UTF-8 if not given).
This property contains the methods of ByteArray.
The resulting string is guaranteed to round-trip back into an identical ByteArray by passing the result to `ByteArray.fromString()`, i.e., `b === ByteArray.fromString(ByteArray.toString(b, encoding), encoding)`.
## Prior Art ##
### `fromGBytes(b:GLib.Bytes):Uint8Array` ###
Adobe's ActionScript 3.0 provides [`flash.utils.ByteArray`][2], which was the primary inspiration for this proposal. Note that the ActionScript version of ByteArray includes additional functionality which has been omitted here for the sake of allowing small implementations; it is anticipated that the extra functionality can be written in ES4 itself and provided as a standard library.
Convert a `GLib.Bytes` instance into a newly constructed `Uint8Array`.
The contents are copied.
[Synopsis of ActionScript's implementation too detailed and moved to [discussion][1] page]
### `toGBytes(a:Uint8Array):GLib.Bytes` ###
Converts the `Uint8Array` into a `GLib.Bytes` instance.
The contents are copied.
......@@ -19,10 +19,10 @@ Even if your system includes a development package for mozjs, we
recommend building it on JHBuild so that you can enable the debugging
features. Add this to your JHBuild configuration file:
module_autogenargs['mozjs52'] = '--enable-debug'
module_autogenargs['mozjs60'] = '--enable-debug'
Make sure it is built first with `jhbuild build mozjs52`, otherwise
Make sure it is built first with `jhbuild build mozjs60`, otherwise
`jhbuild build gjs` will skip it if you have the system package
......@@ -46,7 +46,7 @@ mozjs, but you can grab them from your JHBuild copy of mozjs.
After reaching a breakpoint in your program, type this to activate the
source ~/.cache/jhbuild/build/mozjs-52.Y.Z/js/src/shell/
source ~/.cache/jhbuild/build/mozjs-60.Y.Z/js/src/shell/
(replace `Y.Z` with mozjs's minor and micro version numbers)
......@@ -1666,10 +1666,9 @@ gjs_value_to_g_argument(JSContext *context,
/* Handle Struct/Union first since we don't necessarily need a GType for them */
/* We special case Closures later, so skip them here */
!g_type_is_a(gtype, G_TYPE_CLOSURE)) {
if (g_type_is_a(gtype, G_TYPE_BYTES)
&& gjs_typecheck_bytearray(context, obj, false)) {
arg->v_pointer = gjs_byte_array_get_bytes(context, obj);
if (g_type_is_a(gtype, G_TYPE_BYTES) &&
JS_IsUint8Array(obj)) {
arg->v_pointer = gjs_byte_array_get_bytes(obj);
} else if (g_type_is_a(gtype, G_TYPE_ERROR)) {
if (!gjs_typecheck_gerror(context, obj, true)) {
arg->v_pointer = NULL;
......@@ -1955,13 +1954,13 @@ _Pragma("GCC diagnostic pop")
GIArrayType array_type = g_type_info_get_array_type(type_info);
/* First, let's handle the case where we're passed an instance
* of our own byteArray class.
* of Uint8Array and it needs to be marshalled to GByteArray.
if (value.isObjectOrNull()) {
if (value.isObject()) {
JS::RootedObject bytearray_obj(context, value.toObjectOrNull());
if (gjs_typecheck_bytearray(context, bytearray_obj, false)
&& array_type == GI_ARRAY_TYPE_BYTE_ARRAY) {
arg->v_pointer = gjs_byte_array_get_byte_array(context, bytearray_obj);
if (JS_IsUint8Array(bytearray_obj) &&
array_type == GI_ARRAY_TYPE_BYTE_ARRAY) {
arg->v_pointer = gjs_byte_array_get_byte_array(bytearray_obj);
} else {
/* Fall through, !handled */
......@@ -2273,13 +2272,7 @@ gjs_array_from_carray_internal (JSContext *context,
/* Special case array(guint8) */
if (element_type == GI_TYPE_TAG_UINT8) {
GByteArray gbytearray; = (guint8 *) array;
gbytearray.len = length;
JS::RootedObject obj(context,
gjs_byte_array_from_byte_array(context, &gbytearray));
JSObject* obj = gjs_byte_array_from_data(context, length, array);
if (!obj)
return false;
......@@ -2487,13 +2480,8 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
/* Special case array(guint8) */
if (element_type == GI_TYPE_TAG_UINT8) {
GByteArray gbytearray; = (guint8 *) c_array;
gbytearray.len = strlen((const char *) c_array);
JS::RootedObject obj(context,
gjs_byte_array_from_byte_array(context, &gbytearray));
size_t len = strlen(static_cast<char*>(c_array));
JSObject* obj = gjs_byte_array_from_data(context, len, c_array);
if (!obj)
return false;
......@@ -3004,10 +2992,12 @@ gjs_value_from_g_argument (JSContext *context,
return gjs_array_from_fixed_size_array(context, value_p, type_info, arg->v_pointer);
} else if (g_type_info_get_array_type(type_info) == GI_ARRAY_TYPE_BYTE_ARRAY) {
JSObject *array = gjs_byte_array_from_byte_array(context,
auto* byte_array = static_cast<GByteArray*>(arg->v_pointer);
JSObject* array =
gjs_byte_array_from_byte_array(context, byte_array);
if (!array) {
gjs_throw(context, "Couldn't convert GByteArray to a ByteArray");
"Couldn't convert GByteArray to a Uint8Array");
return false;
......@@ -855,19 +855,17 @@ boxed_trace(JSTracer *tracer,
* class have.
static const struct JSClassOps gjs_boxed_class_ops = {
NULL, /* addProperty */
NULL, /* deleteProperty */
NULL, /* getProperty */
NULL, /* setProperty */
NULL, /* enumerate */
nullptr, // addProperty
nullptr, // deleteProperty
nullptr, // enumerate
nullptr, // newEnumerate
nullptr, /* mayResolve */
nullptr, // mayResolve