Commit Graph

1035 Commits

Author SHA1 Message Date
Martin André 7caa9c20c2 Prevent noVNC loading error when invalid property is set on object
Util.set_defaults should accommodate with missing properties to prevent
'Uncaught TypeError: Cannot read property 'call' of undefined' error.
2014-09-17 16:50:05 +09:00
Solly 0ca7cf4867 Merge pull request #368 from DirectXMan12/refactor/cleanup
Cleanup and test all the things (plus ditching Crockford)!
2014-09-15 16:50:20 -04:00
Solly Ross e6af0f60b0 Add support for Travis CI and SauceLabs Testing
This adds support for Travis CI and SauceLabs
testing.  Testing on SauceLabs in done via
the Karma test runner.  Note that encrypted
Sauce username and access key values need
to be inserted into .travis.yml as global
environment variables.  Additionally, the
local test runner (which is still useful
for debugging tests and code) was updated
to reflect that the 'node_modules' folder
now gets placed in the root directory.
2014-09-15 16:46:02 -04:00
Solly Ross bbbf42bb5a Cleanup: UI code
File: ui.js
Tests Added: False

Changes:
- Fix JSHint errors
- add some curly braces to improve clarity
- move variable declarations to relevant locations instead of at the top
  of methods
2014-09-15 16:46:02 -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
Solly Ross 1e13775bd5 Cleanup: Display Helper
File: display.js
Tests Added: True (preliminary)

Changes:
- De-crockford-ified the file

NOTE: the tests included for display.js cover basic functionality, but
are by no means nearly as comprehensive as the ones presented for
rfb.js.
2014-09-15 16:46:02 -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
Solly Ross ee7d4c61c6 Cleanup: Webutil code
File: webutil.js
Tests Added: False
Changes:
- Fixed JSHint Errors (global "use strict", spaces)
- added some newline characters when appropriate for readability
- moved variable declarations to the places they were actually used
  for readability
2014-09-15 16:46:02 -04:00
Solly Ross 31f169e86f Cleanup: Keyboard code
File: keyboard.js
Tests Added: False (already present)
Changes:
- Fixed JSHint Errors
- Moved functions outside loops
- Added proper include directives to tests
2014-09-15 16:46:02 -04:00
Solly Ross d6e281baf6 Cleanup: Input code
File: input.js
Tests Added: False (already present partially -- see below)
Changes:
- Fixed JSHint Errors
- Converted to normal non-Crockford constructors

NOTE: while there are tests for the actual key-detecting functionality,
      the tests do not cover the actual Keyboard and Mouse objects
      themselves.
2014-09-15 16:46:02 -04:00
Solly Ross d21cd6c164 Cleanup: Util code
File: util.js
Tests Added: True (partial -- for logging and array push methods)
Changes:
- Fixed JSHint Errors (indentation, semicolons, global "use strict")
- Made browser detection methods more readable
- added some newline characters when appropriate for readability
- throw Errors not strings!
- Removed conf_defaults, and added make_properties and set_defaults
  instead (see below)

The removal of conf_defaults and switch to make_properties and
set_defaults is to facilitate the switch over to normal Javascript
constructors instead of Crockford-style constructors.  Now, methods
are added to the objects prototype (and thus make properties is called
outside the constructor).
2014-09-15 16:46:02 -04:00
Solly Ross fb64ed2135 Cleanup: DES code
File: des.js
Tests Added: False
Changes:
- Fixed JSHint Errors
- Improved whitespace around operators
2014-09-15 16:46:02 -04:00
Solly Ross f8e9b9f1bf Cleanup and Test: base64.js
This is the first commit in a series of commits
which improve the readability of some of the code
and add tests.

File: base64.js
Tests Added: True
Changes:
- Improved indentation
- Fixed JSHint errors
- Moved loop variables to be declared in the loop for better readability
  (N.B. Javascript does not have block scoping, so the variables are
  still technically available outside the loop -- it just makes the code
  clearer to place them inside the loop, since they are only used there)
2014-09-15 16:46:02 -04:00
Solly Ross 95eb681bbb Support the "NOTUNNEL" tunnel type for TightVNC
Previously, tight auth was supported without any support for tunnels,
even the no-op tunnel.  No, the no-op tunnel type is supported.
2014-09-15 16:46:02 -04:00
Solly Ross 91127741be Support running all tests from the root directory
Previously, if you did not specify a tests file,
you had to be in the 'tests' directory for the
"run all tests" functionality to work.  Now it
will work in any directory.
2014-09-15 16:44:36 -04:00
samhed 960752ea53 fixes an error that was made in the merge with the last sync with websockify. 2014-08-19 13:49:55 +02:00
Solly Ross 9b731d3a58 Fix race condition in test runner
Previously, there would be a case where if your tests took
too long to run, the casper test runner would only report
on certain tests.  This has been fixed.
2014-06-03 17:42:28 -04:00
Solly Ross 93af721a27 Output error events from provider in test runner
Now, 'error' events from the test runner are output to stderr.
Additionally, when debug is enabled, debug output is logged to
stderr instead of stdout (as was the case previously).
2014-06-03 16:58:37 -04:00
Solly Ross 7187bc121f Fixed typo in run_from_console.js 2014-06-03 13:15:02 -04:00
Solly Ross d906dfc953 Add support for injecting test helper files
Now, the phrase `requires test modules: ` may be place in a comment
in a file to require modules local to the test directory, similarly
to the way the `require local modules: ` line may be used to inject
files in the 'include' directory.  This is useful for when common
fakes need to be injected into a test.
2014-06-03 11:17:33 -04:00
Solly Ross 4a4643c05d Support automatically opening test HTML in browser
When using the '-g' option with run_from_console.js, you can
now pass the '-o' option to automatically open the generated
HTML file in your default browser.  This relies on the 'open'
NPM module.
2014-06-03 11:17:29 -04:00
Samuel dd3a8a1b6d Merge pull request #363 from kosmasgiannis/query_parse
Better parsing of query string variables
2014-05-06 09:13:18 +02:00
Giannis Kosmas d8c0953567 Better parsing of query string variables 2014-05-05 23:23:48 +03:00
Solly Ross c77938efc9 Fix for scroll offset in Util.getPosition()
Previously, Util.getPosition didn't deal with scrolling
particularly well.  This fixes that by calculating the
scroll offset when dealing with getting mouse positions.

Credit to @erikgull and @emmar for the initial version of
the fix.  Credit to Brian Huismanfor the initial code.

Closes #295
Relevant to #258
2014-05-05 14:51:32 -04:00
samhed 082027dc87 Sync with websockify
Pull 90b519edf0c1857d
2014-04-14 14:45:15 +02:00
samhed 60a415ae1c Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352)
* Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
2014-04-14 13:26:52 +02:00
samhed 8f4a291b16 Updated the comment in vnc.html to reflect the changes made in last commit. 2014-04-07 16:58:59 +02:00
samhed eeda79d3c3 Changing the type of the keyboardinput element to textarea, fixes issue 356.
* The on-screen keyboard not closing when pressing Enter is more important than not having textsuggestions etc.
2014-04-07 16:41:25 +02:00
samhed 0bb6a8c50e Fixes issue 344 - problem with backspace on Android. 2014-04-04 17:45:04 +02:00
samhed de8edde4a0 Attempt to change the behavior of the enter/go-key on touch devices, we want it to be Enter.
* This code works in Firefox on Android and on Chrome and Safari on iOS.
* It does not work in Chrome on Android, the enter key is labled "Go" and closes the on screen keyboard when pressed.
2014-04-04 17:42:12 +02:00
samhed 74d3d75a4a Change type of keyboardinput to password to make sure that you can write parenthesis on iOS devices. 2014-04-04 17:36:17 +02:00
samhed b98fed2f69 Aim to disable text suggestions and the like 2014-04-04 17:28:44 +02:00
samhed df0ee70e36 Make sure that the default value of the hidden input field is a space. 2014-03-28 08:54:49 +01:00
Solly 7cad15425e Merge pull request #347 from dol/fix/better-ws-binarytype-detection
Improved websocket binary support detection
2014-03-26 10:58:11 -04:00
samhed 23817e1516 Added alt-values to the control-bar buttons.
* On slow servers where the button-images can be slowly loaded it can be useful to see some relevant text instead of "Submit query" on every button.
2014-03-26 15:24:50 +01:00
samhed 0fe30338a0 Add a prototype from MDN for indexOf to be used in browsers where it is not supported. 2014-03-26 15:22:45 +01:00
samhed 2fa1c0988a Removed unused code. 2014-03-26 11:18:48 +01:00
samhed 2db62a9528 Fixed typo in README. 2014-03-17 14:24:42 +01:00
samhed b7996b048b Added a wrapper for the UTF-8 decoding. 2014-03-14 15:18:05 +01:00
samhed 6227a91c01 Decode from UTF-8 to allow unicode characters in the connection name 2014-03-14 13:44:10 +01:00
Samuel f1e6daf3c8 Merge pull request #348 from Medical-Insight/fix-altgr-firefox
Fix altgr firefox
2014-03-12 16:51:20 +01:00
Jesper Dam 230784066c Better browser OS detection.
Apparently Firefox on Linux changed the value of navigator.appVersion,
causing our OS detection (used to determine how to interpret different
modifier keys) to fail.

Use navigator.platform instead, which should be more stable.

http://stackoverflow.com/a/19883965/33213
2014-03-12 11:19:57 +01:00
Jesper Dam c3f6052435 Better key identifiers
Previously we identified keys in keyboard events by the 'key' property
if it was set, and 'keyCode' otherwise.

This turns out to be problematic as Firefox no longer leaves 'key'
undefined (so we fall back to using 'keyCode'), but instead sets 'key'
to 'MozPrintableKey' for all printable keys.

This meant that when (printable) keys are released, we can't match it
against the corresponding keydown event, and instead just send a keyup
event for the last keydown received.

Now, if both 'key' and 'keyCode' are set, use the concatenation of both.
Otherwise prefer 'keyCode', as that is at least unique for every key.

This should let us release the right keys on keyup events.
2014-03-12 11:19:56 +01:00
Dominic Luechinger 97362c3980 Improved websocket binary support detection
A facke connection to 'wss://localhost:17523' (randomly chosen) to detect
the WebSocket binary support is not the best solution.
First of all, check of prototype has the property 'binaryType'. If not,
perform a dummy connection to 'wss://.' instead of 'wss://localhost:17523'.

This patch was inspired by the discussion and implementation of Modernizr:
https://github.com/Modernizr/Modernizr/issues/370
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
2014-03-11 14:29:58 +01:00
Solly c70000bac4 Merge pull request #338 from vatesfr/configurable-ws-protocols
WebSocket protocols are now configurable
2014-02-19 18:10:44 -05:00
Julien Fontanet c7fc3c082f WebSocket protocols are now configurable. 2014-02-19 19:29:06 +01:00
Solly e791b87572 Merge pull request #242 from Medical-Insight/use-wss-for-binary-detect
Use wss when creating localhost connection to detect binary support (closes #242)
2014-02-17 18:09:16 -05:00
Malcolm Scott fb35d50f6a Implement XVP UI in HTML 2014-02-17 17:55:28 -05:00
Malcolm Scott a856a051da Implement XVP extension (shutdown/reboot/reset) 2014-02-17 17:55:28 -05:00
Malcolm Scott 03ab251587 Implement XVP auth 2014-02-17 17:55:28 -05:00