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`.
Solly Ross [Thu, 6 Aug 2015 18:37:01 +0000 (14:37 -0400)]
CI: Switch to Container-Based Travis
This commit switches the Travis tests over to Travis's new
container-based infrastructure. It also tells Travis to
cache the node_modules directory for faster setup.
samhed [Thu, 25 Jun 2015 20:28:04 +0000 (22:28 +0200)]
* Hide the fullscreen toggle button on Safari since alphanumerical
keyboard input doesn't work in fullscreen.
* Force clipping mode in Internet Explorer while in fullscreen since
scrollbars doesn't work in fullscreen.
samhed [Thu, 25 Jun 2015 15:04:55 +0000 (17:04 +0200)]
Renamed popupStatusPanel to popupStatus and removed the global variable
which kept track on if it was open or not (it automatically closes after
1.5 seconds anyway).
samhed [Tue, 16 Jun 2015 20:39:17 +0000 (22:39 +0200)]
Always show the viewport drag button on touch devices to keep the GUI from
"jumping around". Enable/disable the button instead of show/hide on these
devices.
samhed [Tue, 19 May 2015 11:34:50 +0000 (13:34 +0200)]
Reverting most of commit cb3e4de. The issue was not related to using keyboardinputReset.. the issue was infact a typo which was introduced in 3b8ec46. I must be too tired..
Solly Ross [Tue, 24 Mar 2015 20:02:53 +0000 (16:02 -0400)]
Throw exceptions from RFB constructor
Previously, if an error was thrown from the Display constructor
in the RFB constructor, we would attempt to use `RFB#updateState`
to handle this. However, `RFB#updateState` attempts to close
the WebSocket connection, which doesn't exist at this point.
In the constructor, it's probably just better to raise an exception
instead (making sure to clean up anything relevant).
Solly Ross [Tue, 24 Mar 2015 19:05:38 +0000 (15:05 -0400)]
Create RFB object on connect
In e543525faa9cf0d683f41e183e89cd909f3dd229, we switched to creating
a new RFB object on disconnect. This caused issues, however, since
any errors were only displayed briefly before the new "loaded" text
was displayed instead.
Now, we create the RFB object on connect. This essentially removes
the usefulness of the "loaded" state, but prevents the aforementioned
problem.
To facilitate this, the code which does detection of cursor URI support
was moved from this Display constructor (which now calls the new
function) into its own function, `Util.browserSupportsCursorURIs()`.
Solly Ross [Thu, 26 Mar 2015 20:57:17 +0000 (16:57 -0400)]
Follow symbolic links in launch.sh
Previously, in launch.sh, `$HERE` was the directory of `$0`.
However, if `$0` was actually a symlink, `$HERE` would be
wherever the symlink was, which could cause issues (for
example, the script wouldn't be able to local `$WEB` or
`$WEBSOCKIFY` properly).
Now, `$HERE` looks at whatever `$0` points at instead.
samhed [Mon, 9 Mar 2015 13:30:56 +0000 (14:30 +0100)]
* Don't check specific html elements from the display code (Fixes #446)
* Renamed and reworked fbuClip to clippingDisplay
* Added tests for clippingDisplay
* Use the a noVNC_container which covers the entire page to get the full size
(Fixes #463)
* Added maxWidth and maxHeight to the canvas which can limit the viewport size
* Only show either the canvas or the logo, hide one when the other is shown
* Always center the canvas (previously it was only centered when not clipping)
* Removed iOS specific "position-fixed" fixes and start calling setBarPosition
on every resize
* Removed the noVNC_screen_pad
samhed [Thu, 5 Mar 2015 13:56:47 +0000 (14:56 +0100)]
* 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
Solly Ross [Wed, 18 Feb 2015 03:41:34 +0000 (22:41 -0500)]
Support local scaling
This commit adds two new addition scaling options. Both options do
local scaling. The first "Local Scaling", does both upscaling and
downscaling. The second option, "Local Downscaling", only downscales.
This is based on work by @mightypenguin (with an additional bug
reported by @glazik12).
Solly Ross [Tue, 17 Feb 2015 23:53:38 +0000 (18:53 -0500)]
Update UI to allow for different scaling modes
This commit updates the UI to allow for different
scaling modes. The "resize" option was changed to
be a dropdown with the following options: "None" (nothing),
"Remote Resizing" (SetDesktopSize).
Solly Ross [Wed, 25 Feb 2015 22:02:16 +0000 (17:02 -0500)]
Make Util.getPosition be relative to page
Commit 5108c4635c847de9be0edadf572f7426f351b66a caused a regression
in the case where scrolling is used -- getPosition return position
relative to the viewport, while getEventPosition expected a position
relative to the page.
As per
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect,
the fix for this is simply to add the `pageXOffset` and `pageYOffset` to
the output of `getBoundingClientRect()`.
Solly Ross [Fri, 20 Feb 2015 22:27:27 +0000 (17:27 -0500)]
Fix disconnect/reconnect issues
Commit 155d78b39933a396d2555376f4e70f976c30b86d prevented reconnections
from working properly. This fixes that by creating a new RFB object
after disconnecting or failing.
Furthermore, this ensures that a new connection cannot be opened util
we've actually disconnected (either by timer or by receiving a `close`
event).
Solly Ross [Fri, 20 Feb 2015 22:31:37 +0000 (17:31 -0500)]
Remove 'debian' directory
This commit removes the old debian packaging information, which is
out of date. People who wish to create Debain packages for noVNC
are better off using the package information from the actual Debian
or Ubuntu packages.
Solly Ross [Tue, 17 Feb 2015 22:54:21 +0000 (17:54 -0500)]
Make sure websockify is cloned to the correct dir
When `utils/launch.sh` clones websockify, it can be cloned
into the incorrect directory, depending on how `utils/launch.sh`
is run. This commit ensures that websockify is always cloned into
`utils/websockify`.
Solly Ross [Mon, 16 Feb 2015 22:03:17 +0000 (17:03 -0500)]
Remove local copies of websockify
This commit removes local copies of websockify.
Instead `utils/launch.sh` performs the following logic:
If `utils/websockify` exists, use `utils/websockify/run` (if the latter
does not exist, or is not executable, fail, since this is probably a
mistake).
Otherwise, check to see if websockify is installed somewhere (try
`which websockify`). If it is, use that. Otherwise, clone
websockify from github, and tell git to ignore that directory.
Packaged versions of noVNC should simply list websockify as a
requirement. The debian packaging has been updated to reflect
this.
samhed [Tue, 10 Feb 2015 16:05:58 +0000 (17:05 +0100)]
Support automatic resize [Part 3/4]: ui.js
* Added a resize request (setDesktopSize) triggered when connecting and by
changes to the browser window's size.
* Hid the view-drag-hand when the display area is the same or smaller than the
remote session size.
* Added a setting for the automatic resize feature.
* Updated vnc.html and vnc_auto.html to reflect the changes to the UI.
samhed [Fri, 6 Feb 2015 15:43:45 +0000 (16:43 +0100)]
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.
slip in PATH for 'npm test' as not everyone has karma
So people can follow the 'unit tests' instructions, we need
to make sure PATH includes the karma bin directory otherwise
we see the following:
----
aclouter@stevemcqueen:/usr/src/aten-ikvm/noVNC$ npm test
> noVNC@0.5.0 test /usr/src/aten-ikvm/noVNC
> karma start karma.conf.js
sh: 1: karma: not found
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
----
Solly Ross [Mon, 24 Nov 2014 20:16:12 +0000 (15:16 -0500)]
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.
Ramon de Klein [Thu, 6 Nov 2014 12:11:46 +0000 (13:11 +0100)]
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.
Solly Ross [Mon, 17 Nov 2014 22:52:33 +0000 (17:52 -0500)]
Fix Karma sinon-chai version issues
Previously, we were using the karma-sinon-chai package to
provide sinon-chai to karma. This used an older version of
sinon-chai, and looks to be no longer maintained (it's been
a month since sinon-chai was updated). A new package,
karma-sinon-chai-latest, is now used. This package uses the
latest version of sinon-chai and sinon, just like karma-chai
uses the latest version of chai.
Solly Ross [Mon, 17 Nov 2014 19:19:19 +0000 (14:19 -0500)]
Fix broken tests from changing default screen size
Commit 795fca23dc6cf124b2e6969ee42bd8e7c836d605 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.
Solly Ross [Sun, 2 Nov 2014 18:27:06 +0000 (13:27 -0500)]
Added in guidelines for contributing to noVNC
In CONTRIBUTING.md, you can now find a set of guidelines for
contributing to the noVNC project. They detail coding style
information, requirements for pull requests, and how to run
the unit tests.
Solly Ross [Tue, 30 Sep 2014 16:17:33 +0000 (12:17 -0400)]
Force Travis to use Node 0.11.13
The latest version of Node.js has a bug that
affects the Karma test runner. A patch has been
merged to Karma, but has not landed in a version
yet. Until a new version of Karma is released,
we should keep node at 0.11.13.
Solly Ross [Tue, 23 Sep 2014 02:30:19 +0000 (22:30 -0400)]
Make Utils.js use Object.define to modify Array
Previously, we were modifying Array's prototype using
simple assignment. This can mess with enumeration/iteration.
Thus, we now use Object.defineProperty with enumerable set to
false.
Solly Ross [Tue, 23 Sep 2014 01:42:32 +0000 (21:42 -0400)]
Add support for Relative Paths in the Test Runner
This patch adds support for using relative paths
with the '-r' or '--relative' methods. This can
be useful if you want to output HTML (with the
'--output-html' option) and use it in a webpage.
Additionally, the '-o' was removed from the documentation
of '--output-html', since it hasn't worked for that in a
while ('-o' means open in browser instead).
Solly Ross [Tue, 23 Sep 2014 01:37:04 +0000 (21:37 -0400)]
Fix Race Condition in Display#clear on IE10
There was a race condition in Display#clear on IE10
because we resize and then clear that causes the canvas
to not actually end up cleared. Clearing the current
viewport first solves the issue. It doesn't appear to
affect other platforms, so it's inside a engine check
(`Util.Engine.trident === 6`). Once we stop supporting
IE10, we should just remove this, because it's not the best
to have Engine-specific code.
Solly Ross [Fri, 19 Sep 2014 19:14:34 +0000 (15:14 -0400)]
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.
Solly Ross [Fri, 19 Sep 2014 18:51:15 +0000 (14:51 -0400)]
Fixed Cursor URI Support Detection
There was a bug in cursor URI support detection due to the way
set_defaults now works -- the code was checking for `null`, whereas
when not set, options default to `undefined` unless otherwise
specified. The code now checks for either `null` or `undefined`.
Tests have been added to ensure that this works properly.
Solly Ross [Fri, 19 Sep 2014 18:48:00 +0000 (14:48 -0400)]
Fixed presence detection bug in utils.set_defaults
Previously, Utils.set_defaults was using `if(conf[keys[i]])`
to check for the presence of a configuration key. This would
fail if `conf[keys[i]]` happened to be false. Instead, we now
use `if(keys[i] in conf)`, which simply checks for the presence
of the key in the conf object.
Solly Ross [Fri, 19 Sep 2014 18:17:15 +0000 (14:17 -0400)]
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.
Solly Ross [Fri, 19 Sep 2014 16:16:06 +0000 (12:16 -0400)]
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.