Commit Graph

65 Commits

Author SHA1 Message Date
Samuel Mannehed 12ae8b3d50 Respect the threshold in the viewdrag test (#600) 2016-04-30 04:08:34 +02: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 6940936ffc WIP: Switch to Pako for zlib
This commit introduces an alternate implementation of the zlib
decompressor based on Pako (https://github.com/nodeca/pako).
2015-08-06 14:47:03 -04:00
samhed 798340b98d * Change name of ext_desktop_size to the proper ExtendedDesktopSize
* Added better error handling in ExtendedDesktopSize
* Added helper function to share code with DesktopSize
* Update test.rfb.js to only check for error handling if we were the
  ones requesting the resize
2015-03-05 14:56:47 +01:00
samhed 4dec490aae Support automatic resize [Part 4/4]: unit tests
* Added new tests for the setDesktopSize encoding
* Added new tests for the ExtendedDesktopSize encoding
2015-02-10 17:06:55 +01:00
samhed 636be753b2 Support automatic resize [Part 1/4]: display.js
* Split viewportChange into two functions, one for changing size and the other for changing position.
* Modified viewport code to be capable of changing to a bigger size in the context of a
  client-initiated resize.
* Made clearer distinctions between when viewport-clipping or not.
* Added public function for telling when viewport-clipping.
* Updated tests that were using viewportChange.
2015-02-06 16:54:14 +01:00
Jacob Swanner 155d78b399 Unregister event listeners from websock.
Prevents possible memory and event notification leaks when tearing down
connection and reestablishing a new one.
2015-01-08 15:25:55 -05:00
Solly Ross 4865278dee Fixed Erroneous HEXTILE test
The HEXTILE test which tested for a background tile followed
by an empty tile was only wide enough to actually test for one
tile, thus not actually testing the functionality.  It now actually
uses two tiles, thus actually testing the functionality.
2014-11-24 15:19:04 -05:00
Ramon de Klein 40ac6f0ab6 Don't draw "blank" HEXTILE tiles with random data
Previously, if a HEXTILE tiles was received with a subencoding
of 0x00, it would draw a rectangle using data from the render
queue, which would result in random colored blocks when using
the HEXTILE encoding.  This is the result of a miscopy during
the refactoring.  It now has the correct functionality according
to the RFB protocol specification, which is to draw a rectangle
with the last set background color.

Closes #411
2014-11-17 20:01:28 -05:00
Solly Ross fda40d8927 Fix broken tests from changing default screen size
Commit 795fca23dc changed the default
size from 640 to 240.  This broke a couple tests which depended on
the default size being 640.  Those tests have now been fixed.
2014-11-17 14:19:19 -05:00
Solly Ross 3b4fd003c2 Fixed broken mouse test in test.rfb.js
Because we use the XOR (`^`) operator, the button mask must be
set before a MouseUp event happens, otherwise we'll send a pointer
event like it was a MouseDown event.  The button mask was not set
in one of the tests, so the test was failing.
2014-09-19 15:14:34 -04:00
Solly Ross d02a99f0c8 Fixed Typo Causing MouseUp to not Register
There was a typo in one of the instances of the _buttonMask field
(it was written as _buttonMaks), causing MouseUp to never be sent.
This has been rectified, and the unit tests for the mouse handler
have been changed to check for explicitly sending mouseup and
mousedown.

Fixes #393
2014-09-19 14:18:45 -04:00
Solly Ross 2c9623b5a7 Fixed assertion collision issues
When run via karma, all the tests are loaded into the same page.
This was causing a collision in the 'displayed' assertion dealing
with using viewportLoc.

The assertions are now in their own file, pulled in by tests that
need them.  Additionally, several tests which only set fb_width
and fb_height were correct to set viewportLoc as well.

Closes #392

Also-Authored-By: Martin André (github: mandre)
2014-09-19 12:16:06 -04:00
Solly Ross b1dee94788 Cleanup: RFB Client
File: rfb.js (also websock.js)
Tests Added: True

Changes:
- De-Crockford-ified rfb.js
- Added methods to websock.js to skip bytes in the receive queue
2014-09-15 16:46:02 -04:00