cleanup: Remove old compatibility code

Since gjs moved to mozjs60, return values of int8_t arrays can
no longer be treated as strings. We originally made the conversion
conditional to keep working with the (then) stable gjs release.

That was two years ago and we require a more recent gjs nowadays,
so there's no good reason for keeping the old code path.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1407
This commit is contained in:
Florian Müllner
2020-08-13 23:35:27 +02:00
committed by Georges Basile Stavracas Neto
parent 923d926345
commit 112b139a9e
5 changed files with 10 additions and 15 deletions

View File

@ -1,6 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported SessionMode, listModes */
const ByteArray = imports.byteArray;
const GLib = imports.gi.GLib;
const Signals = imports.signals;
@ -105,8 +106,7 @@ function _loadMode(file, info) {
let fileContent, success_, newMode;
try {
[success_, fileContent] = file.load_contents(null);
if (fileContent instanceof Uint8Array)
fileContent = imports.byteArray.toString(fileContent);
fileContent = ByteArray.toString(fileContent);
newMode = JSON.parse(fileContent);
} catch (e) {
return;