Commit Graph

24 Commits

Author SHA1 Message Date
Juanjo Diaz 8a189a6291 Add getters/setter to websock 2018-12-08 17:31:20 +02:00
Pierre Ossman 2c5491e131 Enforce space after function name 2018-09-06 17:34:15 +02:00
Pierre Ossman 0ae5c54ab3 Enforce explicit semi-colons 2018-09-06 17:25:02 +02:00
Pierre Ossman 6786fd8719 Enforce comma spacing 2018-09-06 16:43:31 +02:00
Pierre Ossman 7b536961b2 Enforce indentation 2018-09-06 16:37:38 +02:00
Pierre Ossman ae2e1ff7bd Move sinon to karma framework
This frees us from manual imports, and makes things less magical
as those aren't ES modules even if the code suggest that the are.
2018-07-13 15:57:24 +02:00
Juanjo Diaz 651c23ece3 Use fat arrow functions `const foo = () => { ... };` for callbacks
and any other function that is passed around and it's not a top level function
2018-07-12 19:06:57 +02:00
Samuel Mannehed 178b92d380 Add rQshiftStr unit test for large strings 2018-06-15 11:53:51 +02:00
Juanjo Diaz 2b5f94fa6a Prefer const/let over var 2018-05-24 00:27:09 +03:00
Juanjo Diaz 8727f598c2 Add eslint and fix reported issues 2018-05-24 00:25:44 +03:00
Juanjo Diaz 9e1bd410aa Remove jshint comments 2018-01-31 07:38:29 -08:00
Samuel Mannehed 4a818a7ddd Merge pull request #893 from CendioOssman/amt
Basic support for Intel AMT
2017-10-05 16:59:53 +02:00
Samuel Mannehed 13d9108f91 Setup chai extensions centrally
They have global effects so make that clear by doing the setup in a
single place.
2017-09-28 14:10:19 +02:00
Samuel Mannehed 0aaf59c2f9 Upgrade and fix sinon.js
Converted version downloaded from sinonjs.org. Fixed version that
doesn't register itself on the global object. This forces all modules to
do a proper import.
2017-09-28 14:05:20 +02:00
Pierre Ossman 1678bf860f Stop hiding exceptions in WebSock class
Let them application decide how to deal with such things and do not
enforce this particular model, which easily hides bugs.
2017-09-07 17:18:25 +02:00
Samuel Mannehed afb621d577 Add missing semicolon 2017-05-13 01:56:35 +02:00
Solly Ross dfae3209eb Update tests to work with new structure
This updates the tests to work with the new structure, and removes the
old `utils/run_from_console.js` files in favor of just using Karma
directly.  The Karma debug page now displays the normal mocha HTML, so
we can use that instead of the HTML generation functionality of the old
test runner.

Note that PhantomJS does not work at the moment (PhantomJS 1.5 should
make it possible to test on PhantomJS again).
2017-03-21 17:39:07 -04:00
Pierre Ossman ec7ba3eeae Remove binary protocol tests
We require standard adherence now, so remove tests that assume
the old system.
2017-02-03 17:16:02 +01:00
Pierre Ossman c4482d2de5 Remove buffer limit tests
We no longer limit writes to the socket.
2017-02-03 17:15:27 +01:00
Drew DeVault cf0623fffa Fix failing test
It only makes sense to send data on a websocket if the readyState is
equal to 1.
2016-04-30 02:28:45 +02:00
Solly Ross 40037b6a29 On-Demand Dynamic Receive Queue Resizing
This commit causes the receive queue to dynamically
resize to fit incoming messages.

Fixes #557
2015-12-22 16:05:33 -05:00
Solly Ross 9ff86fb718 Use Typed Arrays for the send queue
This commit converts the send queue to use typed arrays, and converts
message creation functions in 'rfb.js' to create messages directly into
the socket's send queue.  This commit also removes the separate mouse array,
which is no longer needed.
2015-08-06 14:47:03 -04:00
Solly Ross 38781d931e Use Typed Arrays for the Websock receive queue
**This commit removes Base64 (and Flash) support**

This commit converts websock.js to used Typed Arrays for the
receive queue (and tweaks rfb.js to ensure that it continues
to function, since only Firefox implements
`%TypedArray%.prototype.slice`).  Base64 support was removed
to simplify code paths, and pave the way for using Typed Arrays
for the send queue as well.

This provides two advantages: first, we allocate a buffer ahead
of time, meaning the browser doesn't have to do any work dynamically
increasing the receive queue size.  Secondly, we are now able to pass
around Typed Array Views (e.g. `Uint8Array`), which are lightweight, and
don't involve copying.

The downside is that we initially allocate more memory -- we currently
start out with 4 MiB, and then automatically double when it looks like
the amount unused is getting to small.

The commit also explicitly adds a check to the compacting logic that
avoids calling the copy functions if `_rQlen === _rQi`.
2015-08-06 14:47:03 -04:00
Solly Ross 2cccf7530c Cleanup: WebSocket Helper
File: websock.js
Tests Added: True
Changes:
- Cleaned up JSHint errors
- Converted to normal JS constructor pattern with "private" fields and
  methods now simply being prepended by underscores
- Added a "bind" polyfill for use in PhantomJS 1.x in util.js
- Added FakeWebSocket to fill in for actual WebSocket objects when
  testing
- Made exception handler actually log exception name and message,
  to console, in addition to stack trace
2014-09-15 16:46:02 -04:00