cleanup: Replace non-standard ByteArray module

gjs landed support for TextDecoder/TextEncoder. Use those instead
of gjs' own ByteArray module.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1946>
This commit is contained in:
Florian Müllner
2021-08-12 16:38:57 +02:00
committed by Marge Bot
parent b21b43e318
commit ef70364e81
11 changed files with 19 additions and 30 deletions

View File

@ -1,7 +1,6 @@
// -*- 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;
@ -110,8 +109,8 @@ function _loadMode(file, info) {
let fileContent, success_, newMode;
try {
[success_, fileContent] = file.load_contents(null);
fileContent = ByteArray.toString(fileContent);
newMode = JSON.parse(fileContent);
const decoder = new TextDecoder();
newMode = JSON.parse(decoder.decode(fileContent));
} catch (e) {
return;
}