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:

committed by
Marge Bot

parent
b21b43e318
commit
ef70364e81
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user