Lutz Roeder 4 лет назад
Родитель
Сommit
852df117c7
2 измененных файлов с 10 добавлено и 6 удалено
  1. 1 1
      package.json
  2. 9 5
      test/models.js

+ 1 - 1
package.json

@@ -26,6 +26,6 @@
         "electron-builder": "22.10.5",
         "electron-notarize": "1.0.0",
         "eslint": "7.24.0",
-        "xmldom": "0.5.0"
+        "xmldom": "0.6.0"
     }
 }

+ 9 - 5
test/models.js

@@ -9,6 +9,9 @@ const process = require('process');
 const child_process = require('child_process');
 const http = require('http');
 const https = require('https');
+const util = require('util');
+const xmldom = require('xmldom');
+
 const json = require('../source/json');
 const protobuf = require('../source/protobuf');
 const flatbuffers = require('../source/flatbuffers');
@@ -18,26 +21,27 @@ const zip = require('../source/zip');
 const gzip = require('../source/gzip');
 const tar = require('../source/tar');
 const base = require('../source/base');
-const xmldom = require('xmldom');
 
 global.Int64 = base.Int64;
 global.Uint64 = base.Uint64;
+
 global.json = json;
 global.protobuf = protobuf;
 global.flatbuffers = flatbuffers;
+
 global.DOMParser = xmldom.DOMParser;
+
 global.TextDecoder = class {
 
     constructor(encoding) {
-        global.TextDecoder._TextDecoder = global.TextDecoder._TextDecoder || require('util').TextDecoder;
         if (encoding !== 'ascii') {
-            this._textDecoder = new global.TextDecoder._TextDecoder(encoding);
+            this._decoder = new util.TextDecoder(encoding);
         }
     }
 
     decode(data) {
-        if (this._textDecoder) {
-            return this._textDecoder.decode(data);
+        if (this._decoder) {
+            return this._decoder.decode(data);
         }
 
         if (data.length < 32) {