@novnc/novnc 1.2.0-test → 1.3.0-g7ad4e60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE.txt +0 -6
  2. package/README.md +4 -4
  3. package/core/decoders/copyrect.js +5 -0
  4. package/core/decoders/hextile.js +57 -3
  5. package/core/decoders/raw.js +12 -2
  6. package/core/decoders/tight.js +24 -8
  7. package/core/display.js +9 -151
  8. package/core/input/domkeytable.js +25 -21
  9. package/core/input/keyboard.js +12 -127
  10. package/core/input/util.js +18 -35
  11. package/core/input/vkeys.js +0 -1
  12. package/core/input/xtscancodes.js +5 -3
  13. package/core/rfb.js +116 -109
  14. package/core/util/browser.js +0 -17
  15. package/core/util/cursor.js +1 -11
  16. package/core/util/events.js +0 -4
  17. package/core/websock.js +76 -17
  18. package/docs/API.md +10 -3
  19. package/docs/LIBRARY.md +3 -7
  20. package/lib/base64.js +4 -4
  21. package/lib/decoders/copyrect.js +7 -2
  22. package/lib/decoders/hextile.js +63 -7
  23. package/lib/decoders/raw.js +13 -4
  24. package/lib/decoders/rre.js +2 -2
  25. package/lib/decoders/tight.js +38 -20
  26. package/lib/decoders/tightpng.js +8 -8
  27. package/lib/deflator.js +4 -4
  28. package/lib/des.js +2 -2
  29. package/lib/display.js +45 -212
  30. package/lib/inflator.js +4 -4
  31. package/lib/input/domkeytable.js +197 -194
  32. package/lib/input/fixedkeys.js +2 -2
  33. package/lib/input/gesturehandler.js +2 -2
  34. package/lib/input/keyboard.js +38 -158
  35. package/lib/input/keysym.js +2 -2
  36. package/lib/input/keysymdef.js +2 -2
  37. package/lib/input/util.js +34 -79
  38. package/lib/input/vkeys.js +2 -4
  39. package/lib/input/xtscancodes.js +11 -5
  40. package/lib/rfb.js +292 -286
  41. package/lib/util/browser.js +8 -26
  42. package/lib/util/cursor.js +4 -16
  43. package/lib/util/events.js +3 -5
  44. package/lib/util/eventtarget.js +3 -3
  45. package/lib/util/int.js +1 -1
  46. package/lib/util/logging.js +2 -2
  47. package/lib/vendor/pako/lib/utils/common.js +2 -2
  48. package/lib/vendor/pako/lib/zlib/adler32.js +1 -1
  49. package/lib/vendor/pako/lib/zlib/constants.js +2 -2
  50. package/lib/vendor/pako/lib/zlib/crc32.js +1 -1
  51. package/lib/vendor/pako/lib/zlib/deflate.js +113 -112
  52. package/lib/vendor/pako/lib/zlib/gzheader.js +1 -1
  53. package/lib/vendor/pako/lib/zlib/inffast.js +5 -5
  54. package/lib/vendor/pako/lib/zlib/inflate.js +50 -48
  55. package/lib/vendor/pako/lib/zlib/inftrees.js +3 -3
  56. package/lib/vendor/pako/lib/zlib/messages.js +2 -2
  57. package/lib/vendor/pako/lib/zlib/trees.js +4 -4
  58. package/lib/vendor/pako/lib/zlib/zstream.js +1 -1
  59. package/lib/websock.js +105 -44
  60. package/package.json +2 -7
  61. package/core/util/polyfill.js +0 -61
  62. package/lib/util/polyfill.js +0 -72
  63. package/lib/vendor/promise.js +0 -255
@@ -5,16 +5,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.inflateReset = inflateReset;
9
- exports.inflateReset2 = inflateReset2;
10
- exports.inflateResetKeep = inflateResetKeep;
11
- exports.inflateInit = inflateInit;
12
- exports.inflateInit2 = inflateInit2;
8
+ exports.Z_TREES = exports.Z_STREAM_ERROR = exports.Z_STREAM_END = exports.Z_OK = exports.Z_NEED_DICT = exports.Z_MEM_ERROR = exports.Z_FINISH = exports.Z_DEFLATED = exports.Z_DATA_ERROR = exports.Z_BUF_ERROR = exports.Z_BLOCK = void 0;
13
9
  exports.inflate = inflate;
14
10
  exports.inflateEnd = inflateEnd;
15
11
  exports.inflateGetHeader = inflateGetHeader;
12
+ exports.inflateInfo = void 0;
13
+ exports.inflateInit = inflateInit;
14
+ exports.inflateInit2 = inflateInit2;
15
+ exports.inflateReset = inflateReset;
16
+ exports.inflateReset2 = inflateReset2;
17
+ exports.inflateResetKeep = inflateResetKeep;
16
18
  exports.inflateSetDictionary = inflateSetDictionary;
17
- exports.inflateInfo = exports.Z_DEFLATED = exports.Z_BUF_ERROR = exports.Z_MEM_ERROR = exports.Z_DATA_ERROR = exports.Z_STREAM_ERROR = exports.Z_NEED_DICT = exports.Z_STREAM_END = exports.Z_OK = exports.Z_TREES = exports.Z_BLOCK = exports.Z_FINISH = void 0;
18
19
 
19
20
  var utils = _interopRequireWildcard(require("../utils/common.js"));
20
21
 
@@ -26,11 +27,11 @@ var _inffast = _interopRequireDefault(require("./inffast.js"));
26
27
 
27
28
  var _inftrees = _interopRequireDefault(require("./inftrees.js"));
28
29
 
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
30
31
 
31
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
33
 
33
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
34
35
 
35
36
  var CODES = 0;
36
37
  var LENS = 1;
@@ -475,7 +476,7 @@ function fixedtables(state) {
475
476
  state.lens[sym++] = 8;
476
477
  }
477
478
 
478
- (0, _inftrees.default)(LENS, state.lens, 0, 288, lenfix, 0, state.work, {
479
+ (0, _inftrees["default"])(LENS, state.lens, 0, 288, lenfix, 0, state.work, {
479
480
  bits: 9
480
481
  });
481
482
  /* distance table */
@@ -486,7 +487,7 @@ function fixedtables(state) {
486
487
  state.lens[sym++] = 5;
487
488
  }
488
489
 
489
- (0, _inftrees.default)(DISTS, state.lens, 0, 32, distfix, 0, state.work, {
490
+ (0, _inftrees["default"])(DISTS, state.lens, 0, 32, distfix, 0, state.work, {
490
491
  bits: 5
491
492
  });
492
493
  /* do this just once */
@@ -674,7 +675,7 @@ function inflate(strm, flush) {
674
675
 
675
676
  hbuf[0] = hold & 0xff;
676
677
  hbuf[1] = hold >>> 8 & 0xff;
677
- state.check = (0, _crc.default)(state.check, hbuf, 2, 0); //===//
678
+ state.check = (0, _crc["default"])(state.check, hbuf, 2, 0); //===//
678
679
  //=== INITBITS();
679
680
 
680
681
  hold = 0;
@@ -693,17 +694,17 @@ function inflate(strm, flush) {
693
694
 
694
695
  if (!(state.wrap & 1) ||
695
696
  /* check if zlib header allowed */
696
- (((hold & 0xff) <<
697
+ (((hold & 0xff
697
698
  /*BITS(8)*/
698
- 8) + (hold >> 8)) % 31) {
699
+ ) << 8) + (hold >> 8)) % 31) {
699
700
  strm.msg = 'incorrect header check';
700
701
  state.mode = BAD;
701
702
  break;
702
703
  }
703
704
 
704
- if ((hold & 0x0f) !==
705
+ if ((hold & 0x0f
705
706
  /*BITS(4)*/
706
- Z_DEFLATED) {
707
+ ) !== Z_DEFLATED) {
707
708
  strm.msg = 'unknown compression method';
708
709
  state.mode = BAD;
709
710
  break;
@@ -713,9 +714,9 @@ function inflate(strm, flush) {
713
714
  hold >>>= 4;
714
715
  bits -= 4; //---//
715
716
 
716
- len = (hold & 0x0f) +
717
+ len = (hold & 0x0f
717
718
  /*BITS(4)*/
718
- 8;
719
+ ) + 8;
719
720
 
720
721
  if (state.wbits === 0) {
721
722
  state.wbits = len;
@@ -772,7 +773,7 @@ function inflate(strm, flush) {
772
773
  //=== CRC2(state.check, hold);
773
774
  hbuf[0] = hold & 0xff;
774
775
  hbuf[1] = hold >>> 8 & 0xff;
775
- state.check = (0, _crc.default)(state.check, hbuf, 2, 0); //===//
776
+ state.check = (0, _crc["default"])(state.check, hbuf, 2, 0); //===//
776
777
  } //=== INITBITS();
777
778
 
778
779
 
@@ -806,7 +807,7 @@ function inflate(strm, flush) {
806
807
  hbuf[1] = hold >>> 8 & 0xff;
807
808
  hbuf[2] = hold >>> 16 & 0xff;
808
809
  hbuf[3] = hold >>> 24 & 0xff;
809
- state.check = (0, _crc.default)(state.check, hbuf, 4, 0); //===
810
+ state.check = (0, _crc["default"])(state.check, hbuf, 4, 0); //===
810
811
  } //=== INITBITS();
811
812
 
812
813
 
@@ -839,7 +840,7 @@ function inflate(strm, flush) {
839
840
  //=== CRC2(state.check, hold);
840
841
  hbuf[0] = hold & 0xff;
841
842
  hbuf[1] = hold >>> 8 & 0xff;
842
- state.check = (0, _crc.default)(state.check, hbuf, 2, 0); //===//
843
+ state.check = (0, _crc["default"])(state.check, hbuf, 2, 0); //===//
843
844
  } //=== INITBITS();
844
845
 
845
846
 
@@ -874,7 +875,7 @@ function inflate(strm, flush) {
874
875
  //=== CRC2(state.check, hold);
875
876
  hbuf[0] = hold & 0xff;
876
877
  hbuf[1] = hold >>> 8 & 0xff;
877
- state.check = (0, _crc.default)(state.check, hbuf, 2, 0); //===//
878
+ state.check = (0, _crc["default"])(state.check, hbuf, 2, 0); //===//
878
879
  } //=== INITBITS();
879
880
 
880
881
 
@@ -917,7 +918,7 @@ function inflate(strm, flush) {
917
918
  }
918
919
 
919
920
  if (state.flags & 0x0200) {
920
- state.check = (0, _crc.default)(state.check, input, copy, next);
921
+ state.check = (0, _crc["default"])(state.check, input, copy, next);
921
922
  }
922
923
 
923
924
  have -= copy;
@@ -956,7 +957,7 @@ function inflate(strm, flush) {
956
957
  } while (len && copy < have);
957
958
 
958
959
  if (state.flags & 0x0200) {
959
- state.check = (0, _crc.default)(state.check, input, copy, next);
960
+ state.check = (0, _crc["default"])(state.check, input, copy, next);
960
961
  }
961
962
 
962
963
  have -= copy;
@@ -994,7 +995,7 @@ function inflate(strm, flush) {
994
995
  } while (len && copy < have);
995
996
 
996
997
  if (state.flags & 0x0200) {
997
- state.check = (0, _crc.default)(state.check, input, copy, next);
998
+ state.check = (0, _crc["default"])(state.check, input, copy, next);
998
999
  }
999
1000
 
1000
1001
  have -= copy;
@@ -1123,8 +1124,9 @@ function inflate(strm, flush) {
1123
1124
  hold >>>= 1;
1124
1125
  bits -= 1; //---//
1125
1126
 
1126
- switch (hold & 0x03) {
1127
- /*BITS(2)*/
1127
+ switch (hold & 0x03
1128
+ /*BITS(2)*/
1129
+ ) {
1128
1130
  case 0:
1129
1131
  /* stored block */
1130
1132
  //Tracev((stderr, "inflate: stored block%s\n",
@@ -1255,23 +1257,23 @@ function inflate(strm, flush) {
1255
1257
  } //===//
1256
1258
 
1257
1259
 
1258
- state.nlen = (hold & 0x1f) +
1260
+ state.nlen = (hold & 0x1f
1259
1261
  /*BITS(5)*/
1260
- 257; //--- DROPBITS(5) ---//
1262
+ ) + 257; //--- DROPBITS(5) ---//
1261
1263
 
1262
1264
  hold >>>= 5;
1263
1265
  bits -= 5; //---//
1264
1266
 
1265
- state.ndist = (hold & 0x1f) +
1267
+ state.ndist = (hold & 0x1f
1266
1268
  /*BITS(5)*/
1267
- 1; //--- DROPBITS(5) ---//
1269
+ ) + 1; //--- DROPBITS(5) ---//
1268
1270
 
1269
1271
  hold >>>= 5;
1270
1272
  bits -= 5; //---//
1271
1273
 
1272
- state.ncode = (hold & 0x0f) +
1274
+ state.ncode = (hold & 0x0f
1273
1275
  /*BITS(4)*/
1274
- 4; //--- DROPBITS(4) ---//
1276
+ ) + 4; //--- DROPBITS(4) ---//
1275
1277
 
1276
1278
  hold >>>= 4;
1277
1279
  bits -= 4; //---//
@@ -1324,7 +1326,7 @@ function inflate(strm, flush) {
1324
1326
  opts = {
1325
1327
  bits: state.lenbits
1326
1328
  };
1327
- ret = (0, _inftrees.default)(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
1329
+ ret = (0, _inftrees["default"])(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
1328
1330
  state.lenbits = opts.bits;
1329
1331
 
1330
1332
  if (ret) {
@@ -1487,7 +1489,7 @@ function inflate(strm, flush) {
1487
1489
  opts = {
1488
1490
  bits: state.lenbits
1489
1491
  };
1490
- ret = (0, _inftrees.default)(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
1492
+ ret = (0, _inftrees["default"])(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
1491
1493
  // state.next_index = opts.table_index;
1492
1494
 
1493
1495
  state.lenbits = opts.bits; // state.lencode = state.next;
@@ -1505,7 +1507,7 @@ function inflate(strm, flush) {
1505
1507
  opts = {
1506
1508
  bits: state.distbits
1507
1509
  };
1508
- ret = (0, _inftrees.default)(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
1510
+ ret = (0, _inftrees["default"])(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed.
1509
1511
  // state.next_index = opts.table_index;
1510
1512
 
1511
1513
  state.distbits = opts.bits; // state.distcode = state.next;
@@ -1540,7 +1542,7 @@ function inflate(strm, flush) {
1540
1542
  state.hold = hold;
1541
1543
  state.bits = bits; //---
1542
1544
 
1543
- (0, _inffast.default)(strm, _out); //--- LOAD() ---
1545
+ (0, _inffast["default"])(strm, _out); //--- LOAD() ---
1544
1546
 
1545
1547
  put = strm.next_out;
1546
1548
  output = strm.output;
@@ -1588,9 +1590,9 @@ function inflate(strm, flush) {
1588
1590
  last_val = here_val;
1589
1591
 
1590
1592
  for (;;) {
1591
- here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>
1593
+ here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1
1592
1594
  /*BITS(last.bits + last.op)*/
1593
- last_bits)];
1595
+ ) >> last_bits)];
1594
1596
  here_bits = here >>> 24;
1595
1597
  here_op = here >>> 16 & 0xff;
1596
1598
  here_val = here & 0xffff;
@@ -1710,9 +1712,9 @@ function inflate(strm, flush) {
1710
1712
  last_val = here_val;
1711
1713
 
1712
1714
  for (;;) {
1713
- here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >>
1715
+ here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1
1714
1716
  /*BITS(last.bits + last.op)*/
1715
- last_bits)];
1717
+ ) >> last_bits)];
1716
1718
  here_bits = here >>> 24;
1717
1719
  here_op = here >>> 16 & 0xff;
1718
1720
  here_val = here & 0xffff;
@@ -1897,7 +1899,7 @@ function inflate(strm, flush) {
1897
1899
  if (_out) {
1898
1900
  strm.adler = state.check =
1899
1901
  /*UPDATE(state.check, put - _out, _out);*/
1900
- state.flags ? (0, _crc.default)(state.check, output, _out, put - _out) : (0, _adler.default)(state.check, output, _out, put - _out);
1902
+ state.flags ? (0, _crc["default"])(state.check, output, _out, put - _out) : (0, _adler["default"])(state.check, output, _out, put - _out);
1901
1903
  }
1902
1904
 
1903
1905
  _out = left; // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
@@ -1999,7 +2001,7 @@ function inflate(strm, flush) {
1999
2001
  if (state.wrap && _out) {
2000
2002
  strm.adler = state.check =
2001
2003
  /*UPDATE(state.check, strm.next_out - _out, _out);*/
2002
- state.flags ? (0, _crc.default)(state.check, output, _out, strm.next_out - _out) : (0, _adler.default)(state.check, output, _out, strm.next_out - _out);
2004
+ state.flags ? (0, _crc["default"])(state.check, output, _out, strm.next_out - _out) : (0, _adler["default"])(state.check, output, _out, strm.next_out - _out);
2003
2005
  }
2004
2006
 
2005
2007
  strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
@@ -2015,8 +2017,8 @@ function inflateEnd(strm) {
2015
2017
  if (!strm || !strm.state
2016
2018
  /*|| strm->zfree == (free_func)0*/
2017
2019
  ) {
2018
- return Z_STREAM_ERROR;
2019
- }
2020
+ return Z_STREAM_ERROR;
2021
+ }
2020
2022
 
2021
2023
  var state = strm.state;
2022
2024
 
@@ -2061,8 +2063,8 @@ function inflateSetDictionary(strm, dictionary) {
2061
2063
  || !strm.state
2062
2064
  /* == Z_NULL */
2063
2065
  ) {
2064
- return Z_STREAM_ERROR;
2065
- }
2066
+ return Z_STREAM_ERROR;
2067
+ }
2066
2068
 
2067
2069
  state = strm.state;
2068
2070
 
@@ -2078,7 +2080,7 @@ function inflateSetDictionary(strm, dictionary) {
2078
2080
 
2079
2081
  /* dictid = adler32(dictid, dictionary, dictLength); */
2080
2082
 
2081
- dictid = (0, _adler.default)(dictid, dictionary, dictLength, 0);
2083
+ dictid = (0, _adler["default"])(dictid, dictionary, dictLength, 0);
2082
2084
 
2083
2085
  if (dictid !== state.check) {
2084
2086
  return Z_DATA_ERROR;
@@ -5,13 +5,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = inflate_table;
8
+ exports["default"] = inflate_table;
9
9
 
10
10
  var utils = _interopRequireWildcard(require("../utils/common.js"));
11
11
 
12
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
 
14
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
16
  var MAXBITS = 15;
17
17
  var ENOUGH_LENS = 852;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
  var _default = {
8
8
  2: 'need dictionary',
9
9
 
@@ -33,4 +33,4 @@ var _default = {
33
33
  /* Z_VERSION_ERROR (-6) */
34
34
 
35
35
  };
36
- exports.default = _default;
36
+ exports["default"] = _default;
@@ -5,17 +5,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports._tr_align = _tr_align;
9
+ exports._tr_flush_block = _tr_flush_block;
8
10
  exports._tr_init = _tr_init;
9
11
  exports._tr_stored_block = _tr_stored_block;
10
- exports._tr_flush_block = _tr_flush_block;
11
12
  exports._tr_tally = _tr_tally;
12
- exports._tr_align = _tr_align;
13
13
 
14
14
  var utils = _interopRequireWildcard(require("../utils/common.js"));
15
15
 
16
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
 
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
20
  /* Public constants ==========================================================*/
21
21
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = ZStream;
6
+ exports["default"] = ZStream;
7
7
 
8
8
  function ZStream() {
9
9
  /* next input byte */
package/lib/websock.js CHANGED
@@ -5,13 +5,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports["default"] = void 0;
9
9
 
10
10
  var Log = _interopRequireWildcard(require("./util/logging.js"));
11
11
 
12
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
 
14
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17
+
18
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+
22
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
23
+
24
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
25
+
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
27
 
16
28
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
29
 
@@ -22,16 +34,30 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
22
34
  // this has performance issues in some versions Chromium, and
23
35
  // doesn't gain a tremendous amount of performance increase in Firefox
24
36
  // at the moment. It may be valuable to turn it on in the future.
25
- // Also copyWithin() for TypedArrays is not supported in IE 11 or
26
- // Safari 13 (at the moment we want to support Safari 11).
27
- var ENABLE_COPYWITHIN = false;
28
37
  var MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
38
+ // Constants pulled from RTCDataChannelState enum
39
+ // https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#RTCDataChannelState_enum
40
+
41
+ var DataChannel = {
42
+ CONNECTING: "connecting",
43
+ OPEN: "open",
44
+ CLOSING: "closing",
45
+ CLOSED: "closed"
46
+ };
47
+ var ReadyStates = {
48
+ CONNECTING: [WebSocket.CONNECTING, DataChannel.CONNECTING],
49
+ OPEN: [WebSocket.OPEN, DataChannel.OPEN],
50
+ CLOSING: [WebSocket.CLOSING, DataChannel.CLOSING],
51
+ CLOSED: [WebSocket.CLOSED, DataChannel.CLOSED]
52
+ }; // Properties a raw channel must have, WebSocket and RTCDataChannel are two examples
53
+
54
+ var rawChannelProps = ["send", "close", "binaryType", "onerror", "onmessage", "onopen", "protocol", "readyState"];
29
55
 
30
56
  var Websock = /*#__PURE__*/function () {
31
57
  function Websock() {
32
58
  _classCallCheck(this, Websock);
33
59
 
34
- this._websocket = null; // WebSocket object
60
+ this._websocket = null; // WebSocket or RTCDataChannel object
35
61
 
36
62
  this._rQi = 0; // Receive queue index
37
63
 
@@ -58,6 +84,53 @@ var Websock = /*#__PURE__*/function () {
58
84
 
59
85
 
60
86
  _createClass(Websock, [{
87
+ key: "readyState",
88
+ get: function get() {
89
+ var subState;
90
+
91
+ if (this._websocket === null) {
92
+ return "unused";
93
+ }
94
+
95
+ subState = this._websocket.readyState;
96
+
97
+ if (ReadyStates.CONNECTING.includes(subState)) {
98
+ return "connecting";
99
+ } else if (ReadyStates.OPEN.includes(subState)) {
100
+ return "open";
101
+ } else if (ReadyStates.CLOSING.includes(subState)) {
102
+ return "closing";
103
+ } else if (ReadyStates.CLOSED.includes(subState)) {
104
+ return "closed";
105
+ }
106
+
107
+ return "unknown";
108
+ }
109
+ }, {
110
+ key: "sQ",
111
+ get: function get() {
112
+ return this._sQ;
113
+ }
114
+ }, {
115
+ key: "rQ",
116
+ get: function get() {
117
+ return this._rQ;
118
+ }
119
+ }, {
120
+ key: "rQi",
121
+ get: function get() {
122
+ return this._rQi;
123
+ },
124
+ set: function set(val) {
125
+ this._rQi = val;
126
+ } // Receive Queue
127
+
128
+ }, {
129
+ key: "rQlen",
130
+ get: function get() {
131
+ return this._rQlen - this._rQi;
132
+ }
133
+ }, {
61
134
  key: "rQpeek8",
62
135
  value: function rQpeek8() {
63
136
  return this._rQ[this._rQi];
@@ -88,8 +161,8 @@ var Websock = /*#__PURE__*/function () {
88
161
  value: function _rQshift(bytes) {
89
162
  var res = 0;
90
163
 
91
- for (var byte = bytes - 1; byte >= 0; byte--) {
92
- res += this._rQ[this._rQi++] << byte * 8;
164
+ for (var _byte = bytes - 1; _byte >= 0; _byte--) {
165
+ res += this._rQ[this._rQi++] << _byte * 8;
93
166
  }
94
167
 
95
168
  return res;
@@ -161,7 +234,7 @@ var Websock = /*#__PURE__*/function () {
161
234
  }, {
162
235
  key: "flush",
163
236
  value: function flush() {
164
- if (this._sQlen > 0 && this._websocket.readyState === WebSocket.OPEN) {
237
+ if (this._sQlen > 0 && this.readyState === 'open') {
165
238
  this._websocket.send(this._encodeMessage());
166
239
 
167
240
  this._sQlen = 0;
@@ -210,11 +283,27 @@ var Websock = /*#__PURE__*/function () {
210
283
  }, {
211
284
  key: "open",
212
285
  value: function open(uri, protocols) {
286
+ this.attach(new WebSocket(uri, protocols));
287
+ }
288
+ }, {
289
+ key: "attach",
290
+ value: function attach(rawChannel) {
213
291
  var _this = this;
214
292
 
215
- this.init();
216
- this._websocket = new WebSocket(uri, protocols);
217
- this._websocket.binaryType = 'arraybuffer';
293
+ this.init(); // Must get object and class methods to be compatible with the tests.
294
+
295
+ var channelProps = [].concat(_toConsumableArray(Object.keys(rawChannel)), _toConsumableArray(Object.getOwnPropertyNames(Object.getPrototypeOf(rawChannel))));
296
+
297
+ for (var i = 0; i < rawChannelProps.length; i++) {
298
+ var prop = rawChannelProps[i];
299
+
300
+ if (channelProps.indexOf(prop) < 0) {
301
+ throw new Error('Raw channel missing property: ' + prop);
302
+ }
303
+ }
304
+
305
+ this._websocket = rawChannel;
306
+ this._websocket.binaryType = "arraybuffer";
218
307
  this._websocket.onmessage = this._recvMessage.bind(this);
219
308
 
220
309
  this._websocket.onopen = function () {
@@ -249,7 +338,7 @@ var Websock = /*#__PURE__*/function () {
249
338
  key: "close",
250
339
  value: function close() {
251
340
  if (this._websocket) {
252
- if (this._websocket.readyState === WebSocket.OPEN || this._websocket.readyState === WebSocket.CONNECTING) {
341
+ if (this.readyState === 'connecting' || this.readyState === 'open') {
253
342
  Log.Info("Closing WebSocket connection");
254
343
 
255
344
  this._websocket.close();
@@ -300,11 +389,7 @@ var Websock = /*#__PURE__*/function () {
300
389
 
301
390
  this._rQ.set(new Uint8Array(oldRQbuffer, this._rQi, this._rQlen - this._rQi));
302
391
  } else {
303
- if (ENABLE_COPYWITHIN) {
304
- this._rQ.copyWithin(0, this._rQi, this._rQlen);
305
- } else {
306
- this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi, this._rQlen - this._rQi));
307
- }
392
+ this._rQ.copyWithin(0, this._rQi, this._rQlen);
308
393
  }
309
394
 
310
395
  this._rQlen = this._rQlen - this._rQi;
@@ -342,33 +427,9 @@ var Websock = /*#__PURE__*/function () {
342
427
  Log.Debug("Ignoring empty message");
343
428
  }
344
429
  }
345
- }, {
346
- key: "sQ",
347
- get: function get() {
348
- return this._sQ;
349
- }
350
- }, {
351
- key: "rQ",
352
- get: function get() {
353
- return this._rQ;
354
- }
355
- }, {
356
- key: "rQi",
357
- get: function get() {
358
- return this._rQi;
359
- },
360
- set: function set(val) {
361
- this._rQi = val;
362
- } // Receive Queue
363
-
364
- }, {
365
- key: "rQlen",
366
- get: function get() {
367
- return this._rQlen - this._rQi;
368
- }
369
430
  }]);
370
431
 
371
432
  return Websock;
372
433
  }();
373
434
 
374
- exports.default = Websock;
435
+ exports["default"] = Websock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novnc/novnc",
3
- "version": "1.2.0-test",
3
+ "version": "1.3.0-g7ad4e60",
4
4
  "description": "An HTML5 VNC client",
5
5
  "browser": "lib/rfb",
6
6
  "directories": {
@@ -21,7 +21,7 @@
21
21
  "scripts": {
22
22
  "lint": "eslint app core po/po2js po/xgettext-html tests utils",
23
23
  "test": "karma start karma.conf.js",
24
- "prepublish": "node ./utils/use_require.js --as commonjs --clean"
24
+ "prepublish": "node ./utils/use_require.js --clean"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
@@ -29,8 +29,6 @@
29
29
  },
30
30
  "author": "Joel Martin <github@martintribe.org> (https://github.com/kanaka)",
31
31
  "contributors": [
32
- "Solly Ross <sross@redhat.com> (https://github.com/directxman12)",
33
- "Peter Åstrand <astrand@cendio.se> (https://github.com/astrand)",
34
32
  "Samuel Mannehed <samuel@cendio.se> (https://github.com/samhed)",
35
33
  "Pierre Ossman <ossman@cendio.se> (https://github.com/CendioOssman)"
36
34
  ],
@@ -42,10 +40,7 @@
42
40
  "devDependencies": {
43
41
  "@babel/core": "*",
44
42
  "@babel/plugin-syntax-dynamic-import": "*",
45
- "@babel/plugin-transform-modules-amd": "*",
46
43
  "@babel/plugin-transform-modules-commonjs": "*",
47
- "@babel/plugin-transform-modules-systemjs": "*",
48
- "@babel/plugin-transform-modules-umd": "*",
49
44
  "@babel/preset-env": "*",
50
45
  "@babel/cli": "*",
51
46
  "babel-plugin-import-redirect": "*",