]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Standardize on camelCase for variables in RFB
authorSamuel Mannehed <samuel@cendio.se>
Wed, 20 May 2020 23:31:55 +0000 (01:31 +0200)
committerSamuel Mannehed <samuel@cendio.se>
Sat, 30 May 2020 22:53:15 +0000 (00:53 +0200)
core/rfb.js
tests/test.rfb.js

index d2c7350b36e9872cfbcc2e8aeb072dbe39554925..9d34f77288402a0a516dd9d0d942676924af7416 100644 (file)
@@ -69,28 +69,28 @@ export default class RFB extends EventTargetMixin {
 
         // Connection details
         options = options || {};
-        this._rfb_credentials = options.credentials || {};
+        this._rfbCredentials = options.credentials || {};
         this._shared = 'shared' in options ? !!options.shared : true;
         this._repeaterID = options.repeaterID || '';
         this._wsProtocols = options.wsProtocols || [];
 
         // Internal state
-        this._rfb_connection_state = '';
-        this._rfb_init_state = '';
-        this._rfb_auth_scheme = -1;
-        this._rfb_clean_disconnect = true;
+        this._rfbConnectionState = '';
+        this._rfbInitState = '';
+        this._rfbAuthScheme = -1;
+        this._rfbCleanDisconnect = true;
 
         // Server capabilities
-        this._rfb_version = 0;
-        this._rfb_max_version = 3.8;
-        this._rfb_tightvnc = false;
-        this._rfb_vencrypt_state = 0;
-        this._rfb_xvp_ver = 0;
+        this._rfbVersion = 0;
+        this._rfbMaxVersion = 3.8;
+        this._rfbTightVNC = false;
+        this._rfbVeNCryptState = 0;
+        this._rfbXvpVer = 0;
 
-        this._fb_width = 0;
-        this._fb_height = 0;
+        this._fbWidth = 0;
+        this._fbHeight = 0;
 
-        this._fb_name = "";
+        this._fbName = "";
 
         this._capabilities = { power: false };
 
@@ -100,8 +100,8 @@ export default class RFB extends EventTargetMixin {
         this._enabledContinuousUpdates = false;
 
         this._supportsSetDesktopSize = false;
-        this._screen_id = 0;
-        this._screen_flags = 0;
+        this._screenID = 0;
+        this._screenFlags = 0;
 
         this._qemuExtKeyEventSupported = false;
 
@@ -133,7 +133,7 @@ export default class RFB extends EventTargetMixin {
         };
 
         // Mouse state
-        this._mouse_buttonMask = 0;
+        this._mouseButtonMask = 0;
         this._viewportDragging = false;
         this._viewportDragPos = {};
         this._viewportHasMoved = false;
@@ -209,13 +209,13 @@ export default class RFB extends EventTargetMixin {
             this._handle_message();
         });
         this._sock.on('open', () => {
-            if ((this._rfb_connection_state === 'connecting') &&
-                (this._rfb_init_state === '')) {
-                this._rfb_init_state = 'ProtocolVersion';
+            if ((this._rfbConnectionState === 'connecting') &&
+                (this._rfbInitState === '')) {
+                this._rfbInitState = 'ProtocolVersion';
                 Log.Debug("Starting VNC handshake");
             } else {
                 this._fail("Unexpected server connection while " +
-                           this._rfb_connection_state);
+                           this._rfbConnectionState);
             }
         });
         this._sock.on('close', (e) => {
@@ -228,7 +228,7 @@ export default class RFB extends EventTargetMixin {
                 }
                 msg += ")";
             }
-            switch (this._rfb_connection_state) {
+            switch (this._rfbConnectionState) {
                 case 'connecting':
                     this._fail("Connection closed " + msg);
                     break;
@@ -286,8 +286,8 @@ export default class RFB extends EventTargetMixin {
     set viewOnly(viewOnly) {
         this._viewOnly = viewOnly;
 
-        if (this._rfb_connection_state === "connecting" ||
-            this._rfb_connection_state === "connected") {
+        if (this._rfbConnectionState === "connecting" ||
+            this._rfbConnectionState === "connected") {
             if (viewOnly) {
                 this._keyboard.ungrab();
                 this._mouse.ungrab();
@@ -355,7 +355,7 @@ export default class RFB extends EventTargetMixin {
 
         this._qualityLevel = qualityLevel;
 
-        if (this._rfb_connection_state === 'connected') {
+        if (this._rfbConnectionState === 'connected') {
             this._sendEncodings();
         }
     }
@@ -375,7 +375,7 @@ export default class RFB extends EventTargetMixin {
 
         this._compressionLevel = compressionLevel;
 
-        if (this._rfb_connection_state === 'connected') {
+        if (this._rfbConnectionState === 'connected') {
             this._sendEncodings();
         }
     }
@@ -390,12 +390,12 @@ export default class RFB extends EventTargetMixin {
     }
 
     sendCredentials(creds) {
-        this._rfb_credentials = creds;
+        this._rfbCredentials = creds;
         setTimeout(this._init_msg.bind(this), 0);
     }
 
     sendCtrlAltDel() {
-        if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
+        if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
         Log.Info("Sending Ctrl-Alt-Del");
 
         this.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
@@ -421,7 +421,7 @@ export default class RFB extends EventTargetMixin {
     // Send a key press. If 'down' is not specified then send a down key
     // followed by an up key.
     sendKey(keysym, code, down) {
-        if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
+        if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
 
         if (down === undefined) {
             this.sendKey(keysym, code, true);
@@ -456,7 +456,7 @@ export default class RFB extends EventTargetMixin {
     }
 
     clipboardPasteFrom(text) {
-        if (this._rfb_connection_state !== 'connected' || this._viewOnly) { return; }
+        if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
 
         if (this._clipboardServerCapabilitiesFormats[extendedClipboardFormatText] &&
             this._clipboardServerCapabilitiesActions[extendedClipboardActionNotify]) {
@@ -546,10 +546,10 @@ export default class RFB extends EventTargetMixin {
     }
 
     _setDesktopName(name) {
-        this._fb_name = name;
+        this._fbName = name;
         this.dispatchEvent(new CustomEvent(
             "desktopname",
-            { detail: { name: this._fb_name } }));
+            { detail: { name: this._fbName } }));
     }
 
     _windowResize(event) {
@@ -574,19 +574,19 @@ export default class RFB extends EventTargetMixin {
     // Update state of clipping in Display object, and make sure the
     // configured viewport matches the current screen size
     _updateClip() {
-        const cur_clip = this._display.clipViewport;
-        let new_clip = this._clipViewport;
+        const curClip = this._display.clipViewport;
+        let newClip = this._clipViewport;
 
         if (this._scaleViewport) {
             // Disable viewport clipping if we are scaling
-            new_clip = false;
+            newClip = false;
         }
 
-        if (cur_clip !== new_clip) {
-            this._display.clipViewport = new_clip;
+        if (curClip !== newClip) {
+            this._display.clipViewport = newClip;
         }
 
-        if (new_clip) {
+        if (newClip) {
             // When clipping is enabled, the screen is limited to
             // the size of the container.
             const size = this._screenSize();
@@ -619,7 +619,7 @@ export default class RFB extends EventTargetMixin {
         const size = this._screenSize();
         RFB.messages.setDesktopSize(this._sock,
                                     Math.floor(size.w), Math.floor(size.h),
-                                    this._screen_id, this._screen_flags);
+                                    this._screenID, this._screenFlags);
 
         Log.Debug('Requested new desktop size: ' +
                    size.w + 'x' + size.h);
@@ -651,7 +651,7 @@ export default class RFB extends EventTargetMixin {
      *   disconnected - permanent state
      */
     _updateConnectionState(state) {
-        const oldstate = this._rfb_connection_state;
+        const oldstate = this._rfbConnectionState;
 
         if (state === oldstate) {
             Log.Debug("Already in state '" + state + "', ignoring");
@@ -705,7 +705,7 @@ export default class RFB extends EventTargetMixin {
 
         // State change actions
 
-        this._rfb_connection_state = state;
+        this._rfbConnectionState = state;
 
         Log.Debug("New state '" + state + "', was '" + oldstate + "'.");
 
@@ -739,7 +739,7 @@ export default class RFB extends EventTargetMixin {
             case 'disconnected':
                 this.dispatchEvent(new CustomEvent(
                     "disconnect", { detail:
-                                    { clean: this._rfb_clean_disconnect } }));
+                                    { clean: this._rfbCleanDisconnect } }));
                 break;
         }
     }
@@ -750,7 +750,7 @@ export default class RFB extends EventTargetMixin {
      * should be logged but not sent to the user interface.
      */
     _fail(details) {
-        switch (this._rfb_connection_state) {
+        switch (this._rfbConnectionState) {
             case 'disconnecting':
                 Log.Error("Failed when disconnecting: " + details);
                 break;
@@ -764,7 +764,7 @@ export default class RFB extends EventTargetMixin {
                 Log.Error("RFB failure: " + details);
                 break;
         }
-        this._rfb_clean_disconnect = false; //This is sent to the UI
+        this._rfbCleanDisconnect = false; //This is sent to the UI
 
         // Transition to disconnected without waiting for socket to close
         this._updateConnectionState('disconnecting');
@@ -785,7 +785,7 @@ export default class RFB extends EventTargetMixin {
             return;
         }
 
-        switch (this._rfb_connection_state) {
+        switch (this._rfbConnectionState) {
             case 'disconnected':
                 Log.Error("Got data while disconnected");
                 break;
@@ -814,9 +814,9 @@ export default class RFB extends EventTargetMixin {
 
     _handleMouseButton(x, y, down, bmask) {
         if (down) {
-            this._mouse_buttonMask |= bmask;
+            this._mouseButtonMask |= bmask;
         } else {
-            this._mouse_buttonMask &= ~bmask;
+            this._mouseButtonMask &= ~bmask;
         }
 
         if (this.dragViewport) {
@@ -848,8 +848,8 @@ export default class RFB extends EventTargetMixin {
 
         if (this._viewOnly) { return; } // View only, skip mouse events
 
-        if (this._rfb_connection_state !== 'connected') { return; }
-        RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouse_buttonMask);
+        if (this._rfbConnectionState !== 'connected') { return; }
+        RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouseButtonMask);
     }
 
     _handleMouseMove(x, y) {
@@ -871,8 +871,8 @@ export default class RFB extends EventTargetMixin {
 
         if (this._viewOnly) { return; } // View only, skip mouse events
 
-        if (this._rfb_connection_state !== 'connected') { return; }
-        RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouse_buttonMask);
+        if (this._rfbConnectionState !== 'connected') { return; }
+        RFB.messages.pointerEvent(this._sock, this._display.absX(x), this._display.absY(y), this._mouseButtonMask);
     }
 
     // Message Handlers
@@ -884,30 +884,30 @@ export default class RFB extends EventTargetMixin {
 
         const sversion = this._sock.rQshiftStr(12).substr(4, 7);
         Log.Info("Server ProtocolVersion: " + sversion);
-        let is_repeater = 0;
+        let isRepeater = 0;
         switch (sversion) {
             case "000.000":  // UltraVNC repeater
-                is_repeater = 1;
+                isRepeater = 1;
                 break;
             case "003.003":
             case "003.006":  // UltraVNC
             case "003.889":  // Apple Remote Desktop
-                this._rfb_version = 3.3;
+                this._rfbVersion = 3.3;
                 break;
             case "003.007":
-                this._rfb_version = 3.7;
+                this._rfbVersion = 3.7;
                 break;
             case "003.008":
             case "004.000":  // Intel AMT KVM
             case "004.001":  // RealVNC 4.6
             case "005.000":  // RealVNC 5.3
-                this._rfb_version = 3.8;
+                this._rfbVersion = 3.8;
                 break;
             default:
                 return this._fail("Invalid server version " + sversion);
         }
 
-        if (is_repeater) {
+        if (isRepeater) {
             let repeaterID = "ID:" + this._repeaterID;
             while (repeaterID.length < 250) {
                 repeaterID += "\0";
@@ -916,16 +916,16 @@ export default class RFB extends EventTargetMixin {
             return true;
         }
 
-        if (this._rfb_version > this._rfb_max_version) {
-            this._rfb_version = this._rfb_max_version;
+        if (this._rfbVersion > this._rfbMaxVersion) {
+            this._rfbVersion = this._rfbMaxVersion;
         }
 
-        const cversion = "00" + parseInt(this._rfb_version, 10) +
-                       ".00" + ((this._rfb_version * 10) % 10);
+        const cversion = "00" + parseInt(this._rfbVersion, 10) +
+                       ".00" + ((this._rfbVersion * 10) % 10);
         this._sock.send_string("RFB " + cversion + "\n");
         Log.Debug('Sent ProtocolVersion: ' + cversion);
 
-        this._rfb_init_state = 'Security';
+        this._rfbInitState = 'Security';
     }
 
     _negotiate_security() {
@@ -940,52 +940,52 @@ export default class RFB extends EventTargetMixin {
             return false;
         }
 
-        if (this._rfb_version >= 3.7) {
+        if (this._rfbVersion >= 3.7) {
             // Server sends supported list, client decides
-            const num_types = this._sock.rQshift8();
-            if (this._sock.rQwait("security type", num_types, 1)) { return false; }
+            const numTypes = this._sock.rQshift8();
+            if (this._sock.rQwait("security type", numTypes, 1)) { return false; }
 
-            if (num_types === 0) {
-                this._rfb_init_state = "SecurityReason";
-                this._security_context = "no security types";
-                this._security_status = 1;
+            if (numTypes === 0) {
+                this._rfbInitState = "SecurityReason";
+                this._securityContext = "no security types";
+                this._securityStatus = 1;
                 return this._init_msg();
             }
 
-            const types = this._sock.rQshiftBytes(num_types);
+            const types = this._sock.rQshiftBytes(numTypes);
             Log.Debug("Server security types: " + types);
 
             // Look for each auth in preferred order
             if (includes(1, types)) {
-                this._rfb_auth_scheme = 1; // None
+                this._rfbAuthScheme = 1; // None
             } else if (includes(22, types)) {
-                this._rfb_auth_scheme = 22; // XVP
+                this._rfbAuthScheme = 22; // XVP
             } else if (includes(16, types)) {
-                this._rfb_auth_scheme = 16; // Tight
+                this._rfbAuthScheme = 16; // Tight
             } else if (includes(2, types)) {
-                this._rfb_auth_scheme = 2; // VNC Auth
+                this._rfbAuthScheme = 2; // VNC Auth
             } else if (includes(19, types)) {
-                this._rfb_auth_scheme = 19; // VeNCrypt Auth
+                this._rfbAuthScheme = 19; // VeNCrypt Auth
             } else {
                 return this._fail("Unsupported security types (types: " + types + ")");
             }
 
-            this._sock.send([this._rfb_auth_scheme]);
+            this._sock.send([this._rfbAuthScheme]);
         } else {
             // Server decides
             if (this._sock.rQwait("security scheme", 4)) { return false; }
-            this._rfb_auth_scheme = this._sock.rQshift32();
+            this._rfbAuthScheme = this._sock.rQshift32();
 
-            if (this._rfb_auth_scheme == 0) {
-                this._rfb_init_state = "SecurityReason";
-                this._security_context = "authentication scheme";
-                this._security_status = 1;
+            if (this._rfbAuthScheme == 0) {
+                this._rfbInitState = "SecurityReason";
+                this._securityContext = "authentication scheme";
+                this._securityStatus = 1;
                 return this._init_msg();
             }
         }
 
-        this._rfb_init_state = 'Authentication';
-        Log.Debug('Authenticating using scheme: ' + this._rfb_auth_scheme);
+        this._rfbInitState = 'Authentication';
+        Log.Debug('Authenticating using scheme: ' + this._rfbAuthScheme);
 
         return this._init_msg(); // jump to authentication
     }
@@ -1005,39 +1005,39 @@ export default class RFB extends EventTargetMixin {
         if (reason !== "") {
             this.dispatchEvent(new CustomEvent(
                 "securityfailure",
-                { detail: { status: this._security_status,
+                { detail: { status: this._securityStatus,
                             reason: reason } }));
 
             return this._fail("Security negotiation failed on " +
-                              this._security_context +
+                              this._securityContext +
                               " (reason: " + reason + ")");
         } else {
             this.dispatchEvent(new CustomEvent(
                 "securityfailure",
-                { detail: { status: this._security_status } }));
+                { detail: { status: this._securityStatus } }));
 
             return this._fail("Security negotiation failed on " +
-                              this._security_context);
+                              this._securityContext);
         }
     }
 
     // authentication
     _negotiate_xvp_auth() {
-        if (this._rfb_credentials.username === undefined ||
-            this._rfb_credentials.password === undefined ||
-            this._rfb_credentials.target === undefined) {
+        if (this._rfbCredentials.username === undefined ||
+            this._rfbCredentials.password === undefined ||
+            this._rfbCredentials.target === undefined) {
             this.dispatchEvent(new CustomEvent(
                 "credentialsrequired",
                 { detail: { types: ["username", "password", "target"] } }));
             return false;
         }
 
-        const xvp_auth_str = String.fromCharCode(this._rfb_credentials.username.length) +
-                           String.fromCharCode(this._rfb_credentials.target.length) +
-                           this._rfb_credentials.username +
-                           this._rfb_credentials.target;
-        this._sock.send_string(xvp_auth_str);
-        this._rfb_auth_scheme = 2;
+        const xvpAuthStr = String.fromCharCode(this._rfbCredentials.username.length) +
+                           String.fromCharCode(this._rfbCredentials.target.length) +
+                           this._rfbCredentials.username +
+                           this._rfbCredentials.target;
+        this._sock.send_string(xvpAuthStr);
+        this._rfbAuthScheme = 2;
         return this._negotiate_authentication();
     }
 
@@ -1045,7 +1045,7 @@ export default class RFB extends EventTargetMixin {
     _negotiate_vencrypt_auth() {
 
         // waiting for VeNCrypt version
-        if (this._rfb_vencrypt_state == 0) {
+        if (this._rfbVeNCryptState == 0) {
             if (this._sock.rQwait("vencrypt version", 2)) { return false; }
 
             const major = this._sock.rQshift8();
@@ -1056,11 +1056,11 @@ export default class RFB extends EventTargetMixin {
             }
 
             this._sock.send([0, 2]);
-            this._rfb_vencrypt_state = 1;
+            this._rfbVeNCryptState = 1;
         }
 
         // waiting for ACK
-        if (this._rfb_vencrypt_state == 1) {
+        if (this._rfbVeNCryptState == 1) {
             if (this._sock.rQwait("vencrypt ack", 1)) { return false; }
 
             const res = this._sock.rQshift8();
@@ -1069,29 +1069,29 @@ export default class RFB extends EventTargetMixin {
                 return this._fail("VeNCrypt failure " + res);
             }
 
-            this._rfb_vencrypt_state = 2;
+            this._rfbVeNCryptState = 2;
         }
         // must fall through here (i.e. no "else if"), beacause we may have already received
         // the subtypes length and won't be called again
 
-        if (this._rfb_vencrypt_state == 2) { // waiting for subtypes length
+        if (this._rfbVeNCryptState == 2) { // waiting for subtypes length
             if (this._sock.rQwait("vencrypt subtypes length", 1)) { return false; }
 
-            const subtypes_length = this._sock.rQshift8();
-            if (subtypes_length < 1) {
+            const subtypesLength = this._sock.rQshift8();
+            if (subtypesLength < 1) {
                 return this._fail("VeNCrypt subtypes empty");
             }
 
-            this._rfb_vencrypt_subtypes_length = subtypes_length;
-            this._rfb_vencrypt_state = 3;
+            this._rfbVeNCryptSubtypesLength = subtypesLength;
+            this._rfbVeNCryptState = 3;
         }
 
         // waiting for subtypes list
-        if (this._rfb_vencrypt_state == 3) {
-            if (this._sock.rQwait("vencrypt subtypes", 4 * this._rfb_vencrypt_subtypes_length)) { return false; }
+        if (this._rfbVeNCryptState == 3) {
+            if (this._sock.rQwait("vencrypt subtypes", 4 * this._rfbVeNCryptSubtypesLength)) { return false; }
 
             const subtypes = [];
-            for (let i = 0; i < this._rfb_vencrypt_subtypes_length; i++) {
+            for (let i = 0; i < this._rfbVeNCryptSubtypesLength; i++) {
                 subtypes.push(this._sock.rQshift32());
             }
 
@@ -1099,24 +1099,24 @@ export default class RFB extends EventTargetMixin {
             if (subtypes.indexOf(256) != -1) {
                 // 0x100 = 256
                 this._sock.send([0, 0, 1, 0]);
-                this._rfb_vencrypt_state = 4;
+                this._rfbVeNCryptState = 4;
             } else {
                 return this._fail("VeNCrypt Plain subtype not offered by server");
             }
         }
 
         // negotiated Plain subtype, server waits for password
-        if (this._rfb_vencrypt_state == 4) {
-            if (!this._rfb_credentials.username ||
-                !this._rfb_credentials.password) {
+        if (this._rfbVeNCryptState == 4) {
+            if (!this._rfbCredentials.username ||
+                !this._rfbCredentials.password) {
                 this.dispatchEvent(new CustomEvent(
                     "credentialsrequired",
                     { detail: { types: ["username", "password"] } }));
                 return false;
             }
 
-            const user = encodeUTF8(this._rfb_credentials.username);
-            const pass = encodeUTF8(this._rfb_credentials.password);
+            const user = encodeUTF8(this._rfbCredentials.username);
+            const pass = encodeUTF8(this._rfbCredentials.password);
 
             // XXX we assume lengths are <= 255 (should not be an issue in the real world)
             this._sock.send([0, 0, 0, user.length]);
@@ -1124,7 +1124,7 @@ export default class RFB extends EventTargetMixin {
             this._sock.send_string(user);
             this._sock.send_string(pass);
 
-            this._rfb_init_state = "SecurityResult";
+            this._rfbInitState = "SecurityResult";
             return true;
         }
     }
@@ -1132,7 +1132,7 @@ export default class RFB extends EventTargetMixin {
     _negotiate_std_vnc_auth() {
         if (this._sock.rQwait("auth challenge", 16)) { return false; }
 
-        if (this._rfb_credentials.password === undefined) {
+        if (this._rfbCredentials.password === undefined) {
             this.dispatchEvent(new CustomEvent(
                 "credentialsrequired",
                 { detail: { types: ["password"] } }));
@@ -1141,26 +1141,26 @@ export default class RFB extends EventTargetMixin {
 
         // TODO(directxman12): make genDES not require an Array
         const challenge = Array.prototype.slice.call(this._sock.rQshiftBytes(16));
-        const response = RFB.genDES(this._rfb_credentials.password, challenge);
+        const response = RFB.genDES(this._rfbCredentials.password, challenge);
         this._sock.send(response);
-        this._rfb_init_state = "SecurityResult";
+        this._rfbInitState = "SecurityResult";
         return true;
     }
 
     _negotiate_tight_unix_auth() {
-        if (this._rfb_credentials.username === undefined ||
-            this._rfb_credentials.password === undefined) {
+        if (this._rfbCredentials.username === undefined ||
+            this._rfbCredentials.password === undefined) {
             this.dispatchEvent(new CustomEvent(
                 "credentialsrequired",
                 { detail: { types: ["username", "password"] } }));
             return false;
         }
 
-        this._sock.send([0, 0, 0, this._rfb_credentials.username.length]);
-        this._sock.send([0, 0, 0, this._rfb_credentials.password.length]);
-        this._sock.send_string(this._rfb_credentials.username);
-        this._sock.send_string(this._rfb_credentials.password);
-        this._rfb_init_state = "SecurityResult";
+        this._sock.send([0, 0, 0, this._rfbCredentials.username.length]);
+        this._sock.send([0, 0, 0, this._rfbCredentials.password.length]);
+        this._sock.send_string(this._rfbCredentials.username);
+        this._sock.send_string(this._rfbCredentials.password);
+        this._rfbInitState = "SecurityResult";
         return true;
     }
 
@@ -1171,10 +1171,10 @@ export default class RFB extends EventTargetMixin {
         const serverSupportedTunnelTypes = {};
         // receive tunnel capabilities
         for (let i = 0; i < numTunnels; i++) {
-            const cap_code = this._sock.rQshift32();
-            const cap_vendor = this._sock.rQshiftStr(4);
-            const cap_signature = this._sock.rQshiftStr(8);
-            serverSupportedTunnelTypes[cap_code] = { vendor: cap_vendor, signature: cap_signature };
+            const capCode = this._sock.rQshift32();
+            const capVendor = this._sock.rQshiftStr(4);
+            const capSignature = this._sock.rQshiftStr(8);
+            serverSupportedTunnelTypes[capCode] = { vendor: capVendor, signature: capSignature };
         }
 
         Log.Debug("Server Tight tunnel types: " + serverSupportedTunnelTypes);
@@ -1206,12 +1206,12 @@ export default class RFB extends EventTargetMixin {
     }
 
     _negotiate_tight_auth() {
-        if (!this._rfb_tightvnc) {  // first pass, do the tunnel negotiation
+        if (!this._rfbTightVNC) {  // first pass, do the tunnel negotiation
             if (this._sock.rQwait("num tunnels", 4)) { return false; }
             const numTunnels = this._sock.rQshift32();
             if (numTunnels > 0 && this._sock.rQwait("tunnel capabilities", 16 * numTunnels, 4)) { return false; }
 
-            this._rfb_tightvnc = true;
+            this._rfbTightVNC = true;
 
             if (numTunnels > 0) {
                 this._negotiate_tight_tunnels(numTunnels);
@@ -1223,7 +1223,7 @@ export default class RFB extends EventTargetMixin {
         if (this._sock.rQwait("sub auth count", 4)) { return false; }
         const subAuthCount = this._sock.rQshift32();
         if (subAuthCount === 0) {  // empty sub-auth list received means 'no auth' subtype selected
-            this._rfb_init_state = 'SecurityResult';
+            this._rfbInitState = 'SecurityResult';
             return true;
         }
 
@@ -1252,13 +1252,13 @@ export default class RFB extends EventTargetMixin {
 
                 switch (authType) {
                     case 'STDVNOAUTH__':  // no auth
-                        this._rfb_init_state = 'SecurityResult';
+                        this._rfbInitState = 'SecurityResult';
                         return true;
                     case 'STDVVNCAUTH_': // VNC auth
-                        this._rfb_auth_scheme = 2;
+                        this._rfbAuthScheme = 2;
                         return this._init_msg();
                     case 'TGHTULGNAUTH': // UNIX auth
-                        this._rfb_auth_scheme = 129;
+                        this._rfbAuthScheme = 129;
                         return this._init_msg();
                     default:
                         return this._fail("Unsupported tiny auth scheme " +
@@ -1271,13 +1271,13 @@ export default class RFB extends EventTargetMixin {
     }
 
     _negotiate_authentication() {
-        switch (this._rfb_auth_scheme) {
+        switch (this._rfbAuthScheme) {
             case 1:  // no auth
-                if (this._rfb_version >= 3.8) {
-                    this._rfb_init_state = 'SecurityResult';
+                if (this._rfbVersion >= 3.8) {
+                    this._rfbInitState = 'SecurityResult';
                     return true;
                 }
-                this._rfb_init_state = 'ClientInitialisation';
+                this._rfbInitState = 'ClientInitialisation';
                 return this._init_msg();
 
             case 22:  // XVP auth
@@ -1297,7 +1297,7 @@ export default class RFB extends EventTargetMixin {
 
             default:
                 return this._fail("Unsupported auth scheme (scheme: " +
-                                  this._rfb_auth_scheme + ")");
+                                  this._rfbAuthScheme + ")");
         }
     }
 
@@ -1307,14 +1307,14 @@ export default class RFB extends EventTargetMixin {
         const status = this._sock.rQshift32();
 
         if (status === 0) { // OK
-            this._rfb_init_state = 'ClientInitialisation';
+            this._rfbInitState = 'ClientInitialisation';
             Log.Debug('Authentication OK');
             return this._init_msg();
         } else {
-            if (this._rfb_version >= 3.8) {
-                this._rfb_init_state = "SecurityReason";
-                this._security_context = "security result";
-                this._security_status = status;
+            if (this._rfbVersion >= 3.8) {
+                this._rfbInitState = "SecurityReason";
+                this._securityContext = "security result";
+                this._securityStatus = status;
                 return this._init_msg();
             } else {
                 this.dispatchEvent(new CustomEvent(
@@ -1336,28 +1336,28 @@ export default class RFB extends EventTargetMixin {
         /* PIXEL_FORMAT */
         const bpp         = this._sock.rQshift8();
         const depth       = this._sock.rQshift8();
-        const big_endian  = this._sock.rQshift8();
-        const true_color  = this._sock.rQshift8();
-
-        const red_max     = this._sock.rQshift16();
-        const green_max   = this._sock.rQshift16();
-        const blue_max    = this._sock.rQshift16();
-        const red_shift   = this._sock.rQshift8();
-        const green_shift = this._sock.rQshift8();
-        const blue_shift  = this._sock.rQshift8();
+        const bigEndian  = this._sock.rQshift8();
+        const trueColor  = this._sock.rQshift8();
+
+        const redMax     = this._sock.rQshift16();
+        const greenMax   = this._sock.rQshift16();
+        const blueMax    = this._sock.rQshift16();
+        const redShift   = this._sock.rQshift8();
+        const greenShift = this._sock.rQshift8();
+        const blueShift  = this._sock.rQshift8();
         this._sock.rQskipBytes(3);  // padding
 
         // NB(directxman12): we don't want to call any callbacks or print messages until
         //                   *after* we're past the point where we could backtrack
 
         /* Connection name/title */
-        const name_length = this._sock.rQshift32();
-        if (this._sock.rQwait('server init name', name_length, 24)) { return false; }
-        let name = this._sock.rQshiftStr(name_length);
+        const nameLength = this._sock.rQshift32();
+        if (this._sock.rQwait('server init name', nameLength, 24)) { return false; }
+        let name = this._sock.rQshiftStr(nameLength);
         name = decodeUTF8(name, true);
 
-        if (this._rfb_tightvnc) {
-            if (this._sock.rQwait('TightVNC extended server init header', 8, 24 + name_length)) { return false; }
+        if (this._rfbTightVNC) {
+            if (this._sock.rQwait('TightVNC extended server init header', 8, 24 + nameLength)) { return false; }
             // In TightVNC mode, ServerInit message is extended
             const numServerMessages = this._sock.rQshift16();
             const numClientMessages = this._sock.rQshift16();
@@ -1365,7 +1365,7 @@ export default class RFB extends EventTargetMixin {
             this._sock.rQskipBytes(2);  // padding
 
             const totalMessagesLength = (numServerMessages + numClientMessages + numEncodings) * 16;
-            if (this._sock.rQwait('TightVNC extended server init header', totalMessagesLength, 32 + name_length)) { return false; }
+            if (this._sock.rQwait('TightVNC extended server init header', totalMessagesLength, 32 + nameLength)) { return false; }
 
             // we don't actually do anything with the capability information that TIGHT sends,
             // so we just skip the all of this.
@@ -1384,14 +1384,14 @@ export default class RFB extends EventTargetMixin {
         //                   if we backtrack
         Log.Info("Screen: " + width + "x" + height +
                   ", bpp: " + bpp + ", depth: " + depth +
-                  ", big_endian: " + big_endian +
-                  ", true_color: " + true_color +
-                  ", red_max: " + red_max +
-                  ", green_max: " + green_max +
-                  ", blue_max: " + blue_max +
-                  ", red_shift: " + red_shift +
-                  ", green_shift: " + green_shift +
-                  ", blue_shift: " + blue_shift);
+                  ", bigEndian: " + bigEndian +
+                  ", trueColor: " + trueColor +
+                  ", redMax: " + redMax +
+                  ", greenMax: " + greenMax +
+                  ", blueMax: " + blueMax +
+                  ", redShift: " + redShift +
+                  ", greenShift: " + greenShift +
+                  ", blueShift: " + blueShift);
 
         // we're past the point where we could backtrack, so it's safe to call this
         this._setDesktopName(name);
@@ -1400,16 +1400,16 @@ export default class RFB extends EventTargetMixin {
         if (!this._viewOnly) { this._keyboard.grab(); }
         if (!this._viewOnly) { this._mouse.grab(); }
 
-        this._fb_depth = 24;
+        this._fbDepth = 24;
 
-        if (this._fb_name === "Intel(r) AMT KVM") {
+        if (this._fbName === "Intel(r) AMT KVM") {
             Log.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode.");
-            this._fb_depth = 8;
+            this._fbDepth = 8;
         }
 
-        RFB.messages.pixelFormat(this._sock, this._fb_depth, true);
+        RFB.messages.pixelFormat(this._sock, this._fbDepth, true);
         this._sendEncodings();
-        RFB.messages.fbUpdateRequest(this._sock, false, 0, 0, this._fb_width, this._fb_height);
+        RFB.messages.fbUpdateRequest(this._sock, false, 0, 0, this._fbWidth, this._fbHeight);
 
         this._updateConnectionState('connected');
         return true;
@@ -1421,7 +1421,7 @@ export default class RFB extends EventTargetMixin {
         // In preference order
         encs.push(encodings.encodingCopyRect);
         // Only supported with full depth support
-        if (this._fb_depth == 24) {
+        if (this._fbDepth == 24) {
             encs.push(encodings.encodingTight);
             encs.push(encodings.encodingTightPNG);
             encs.push(encodings.encodingHextile);
@@ -1443,7 +1443,7 @@ export default class RFB extends EventTargetMixin {
         encs.push(encodings.pseudoEncodingDesktopName);
         encs.push(encodings.pseudoEncodingExtendedClipboard);
 
-        if (this._fb_depth == 24) {
+        if (this._fbDepth == 24) {
             encs.push(encodings.pseudoEncodingVMwareCursor);
             encs.push(encodings.pseudoEncodingCursor);
         }
@@ -1460,7 +1460,7 @@ export default class RFB extends EventTargetMixin {
      *   ServerInitialization
      */
     _init_msg() {
-        switch (this._rfb_init_state) {
+        switch (this._rfbInitState) {
             case 'ProtocolVersion':
                 return this._negotiate_protocol_version();
 
@@ -1478,7 +1478,7 @@ export default class RFB extends EventTargetMixin {
 
             case 'ClientInitialisation':
                 this._sock.send([this._shared ? 1 : 0]); // ClientInitialisation
-                this._rfb_init_state = 'ServerInitialisation';
+                this._rfbInitState = 'ServerInitialisation';
                 return true;
 
             case 'ServerInitialisation':
@@ -1486,7 +1486,7 @@ export default class RFB extends EventTargetMixin {
 
             default:
                 return this._fail("Unknown init state (state: " +
-                                  this._rfb_init_state + ")");
+                                  this._rfbInitState + ")");
         }
     }
 
@@ -1709,20 +1709,20 @@ export default class RFB extends EventTargetMixin {
     _handle_xvp_msg() {
         if (this._sock.rQwait("XVP version and message", 3, 1)) { return false; }
         this._sock.rQskipBytes(1);  // Padding
-        const xvp_ver = this._sock.rQshift8();
-        const xvp_msg = this._sock.rQshift8();
+        const xvpVer = this._sock.rQshift8();
+        const xvpMsg = this._sock.rQshift8();
 
-        switch (xvp_msg) {
+        switch (xvpMsg) {
             case 0:  // XVP_FAIL
                 Log.Error("XVP Operation Failed");
                 break;
             case 1:  // XVP_INIT
-                this._rfb_xvp_ver = xvp_ver;
-                Log.Info("XVP extensions enabled (version " + this._rfb_xvp_ver + ")");
+                this._rfbXvpVer = xvpVer;
+                Log.Info("XVP extensions enabled (version " + this._rfbXvpVer + ")");
                 this._setCapability("power", true);
                 break;
             default:
-                this._fail("Illegal server XVP message (msg: " + xvp_msg + ")");
+                this._fail("Illegal server XVP message (msg: " + xvpMsg + ")");
                 break;
         }
 
@@ -1730,20 +1730,20 @@ export default class RFB extends EventTargetMixin {
     }
 
     _normal_msg() {
-        let msg_type;
+        let msgType;
         if (this._FBU.rects > 0) {
-            msg_type = 0;
+            msgType = 0;
         } else {
-            msg_type = this._sock.rQshift8();
+            msgType = this._sock.rQshift8();
         }
 
         let first, ret;
-        switch (msg_type) {
+        switch (msgType) {
             case 0:  // FramebufferUpdate
                 ret = this._framebufferUpdate();
                 if (ret && !this._enabledContinuousUpdates) {
                     RFB.messages.fbUpdateRequest(this._sock, true, 0, 0,
-                                                 this._fb_width, this._fb_height);
+                                                 this._fbWidth, this._fbHeight);
                 }
                 return ret;
 
@@ -1781,7 +1781,7 @@ export default class RFB extends EventTargetMixin {
                 return this._handle_xvp_msg();
 
             default:
-                this._fail("Unexpected server message (type " + msg_type + ")");
+                this._fail("Unexpected server message (type " + msgType + ")");
                 Log.Debug("sock.rQslice(0, 30): " + this._sock.rQslice(0, 30));
                 return true;
         }
@@ -1885,7 +1885,7 @@ export default class RFB extends EventTargetMixin {
             return false;
         }
 
-        const cursor_type = this._sock.rQshift8();
+        const cursorType = this._sock.rQshift8();
 
         this._sock.rQshift8(); //Padding
 
@@ -1893,7 +1893,7 @@ export default class RFB extends EventTargetMixin {
         const bytesPerPixel = 4;
 
         //Classic cursor
-        if (cursor_type == 0) {
+        if (cursorType == 0) {
             //Used to filter away unimportant bits.
             //OR is used for correct conversion in js.
             const PIXEL_MASK = 0xffffff00 | 0;
@@ -1904,20 +1904,20 @@ export default class RFB extends EventTargetMixin {
                 return false;
             }
 
-            let and_mask = new Array(w * h);
+            let andMask = new Array(w * h);
             for (let pixel = 0; pixel < (w * h); pixel++) {
-                and_mask[pixel] = this._sock.rQshift32();
+                andMask[pixel] = this._sock.rQshift32();
             }
 
-            let xor_mask = new Array(w * h);
+            let xorMask = new Array(w * h);
             for (let pixel = 0; pixel < (w * h); pixel++) {
-                xor_mask[pixel] = this._sock.rQshift32();
+                xorMask[pixel] = this._sock.rQshift32();
             }
 
             for (let pixel = 0; pixel < (w * h); pixel++) {
-                if (and_mask[pixel] == 0) {
+                if (andMask[pixel] == 0) {
                     //Fully opaque pixel
-                    let bgr = xor_mask[pixel];
+                    let bgr = xorMask[pixel];
                     let r   = bgr >> 8  & 0xff;
                     let g   = bgr >> 16 & 0xff;
                     let b   = bgr >> 24 & 0xff;
@@ -1927,17 +1927,17 @@ export default class RFB extends EventTargetMixin {
                     rgba[(pixel * bytesPerPixel) + 2 ] = b;    //b
                     rgba[(pixel * bytesPerPixel) + 3 ] = 0xff; //a
 
-                } else if ((and_mask[pixel] & PIXEL_MASK) ==
+                } else if ((andMask[pixel] & PIXEL_MASK) ==
                            PIXEL_MASK) {
                     //Only screen value matters, no mouse colouring
-                    if (xor_mask[pixel] == 0) {
+                    if (xorMask[pixel] == 0) {
                         //Transparent pixel
                         rgba[(pixel * bytesPerPixel)     ] = 0x00;
                         rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
                         rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
                         rgba[(pixel * bytesPerPixel) + 3 ] = 0x00;
 
-                    } else if ((xor_mask[pixel] & PIXEL_MASK) ==
+                    } else if ((xorMask[pixel] & PIXEL_MASK) ==
                                PIXEL_MASK) {
                         //Inverted pixel, not supported in browsers.
                         //Fully opaque instead.
@@ -1947,7 +1947,7 @@ export default class RFB extends EventTargetMixin {
                         rgba[(pixel * bytesPerPixel) + 3 ] = 0xff;
 
                     } else {
-                        //Unhandled xor_mask
+                        //Unhandled xorMask
                         rgba[(pixel * bytesPerPixel)     ] = 0x00;
                         rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
                         rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
@@ -1955,7 +1955,7 @@ export default class RFB extends EventTargetMixin {
                     }
 
                 } else {
-                    //Unhandled and_mask
+                    //Unhandled andMask
                     rgba[(pixel * bytesPerPixel)     ] = 0x00;
                     rgba[(pixel * bytesPerPixel) + 1 ] = 0x00;
                     rgba[(pixel * bytesPerPixel) + 2 ] = 0x00;
@@ -1964,7 +1964,7 @@ export default class RFB extends EventTargetMixin {
             }
 
         //Alpha cursor.
-        } else if (cursor_type == 1) {
+        } else if (cursorType == 1) {
             if (this._sock.rQwait("VMware cursor alpha encoding",
                                   (w * h * 4), 2)) {
                 return false;
@@ -1983,7 +1983,7 @@ export default class RFB extends EventTargetMixin {
 
         } else {
             Log.Warn("The given cursor type is not supported: "
-                      + cursor_type + " given.");
+                      + cursorType + " given.");
             return false;
         }
 
@@ -2011,16 +2011,16 @@ export default class RFB extends EventTargetMixin {
         const mask = this._sock.rQshiftBytes(masklength);
         let rgba = new Uint8Array(w * h * 4);
 
-        let pix_idx = 0;
+        let pixIdx = 0;
         for (let y = 0; y < h; y++) {
             for (let x = 0; x < w; x++) {
-                let mask_idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
-                let alpha = (mask[mask_idx] << (x % 8)) & 0x80 ? 255 : 0;
-                rgba[pix_idx    ] = pixels[pix_idx + 2];
-                rgba[pix_idx + 1] = pixels[pix_idx + 1];
-                rgba[pix_idx + 2] = pixels[pix_idx];
-                rgba[pix_idx + 3] = alpha;
-                pix_idx += 4;
+                let maskIdx = y * Math.ceil(w / 8) + Math.floor(x / 8);
+                let alpha = (mask[maskIdx] << (x % 8)) & 0x80 ? 255 : 0;
+                rgba[pixIdx    ] = pixels[pixIdx + 2];
+                rgba[pixIdx + 1] = pixels[pixIdx + 1];
+                rgba[pixIdx + 2] = pixels[pixIdx];
+                rgba[pixIdx + 3] = alpha;
+                pixIdx += 4;
             }
         }
 
@@ -2053,9 +2053,9 @@ export default class RFB extends EventTargetMixin {
             return false;
         }
 
-        const number_of_screens = this._sock.rQpeek8();
+        const numberOfScreens = this._sock.rQpeek8();
 
-        let bytes = 4 + (number_of_screens * 16);
+        let bytes = 4 + (numberOfScreens * 16);
         if (this._sock.rQwait("ExtendedDesktopSize", bytes)) {
             return false;
         }
@@ -2074,15 +2074,15 @@ export default class RFB extends EventTargetMixin {
         this._sock.rQskipBytes(1);  // number-of-screens
         this._sock.rQskipBytes(3);  // padding
 
-        for (let i = 0; i < number_of_screens; i += 1) {
+        for (let i = 0; i < numberOfScreens; i += 1) {
             // Save the id and flags of the first screen
             if (i === 0) {
-                this._screen_id = this._sock.rQshiftBytes(4);    // id
+                this._screenID = this._sock.rQshiftBytes(4);    // id
                 this._sock.rQskipBytes(2);                       // x-position
                 this._sock.rQskipBytes(2);                       // y-position
                 this._sock.rQskipBytes(2);                       // width
                 this._sock.rQskipBytes(2);                       // height
-                this._screen_flags = this._sock.rQshiftBytes(4); // flags
+                this._screenFlags = this._sock.rQshiftBytes(4); // flags
             } else {
                 this._sock.rQskipBytes(16);
             }
@@ -2135,7 +2135,7 @@ export default class RFB extends EventTargetMixin {
             return decoder.decodeRect(this._FBU.x, this._FBU.y,
                                       this._FBU.width, this._FBU.height,
                                       this._sock, this._display,
-                                      this._fb_depth);
+                                      this._fbDepth);
         } catch (err) {
             this._fail("Error decoding rect: " + err);
             return false;
@@ -2146,14 +2146,14 @@ export default class RFB extends EventTargetMixin {
         if (!this._enabledContinuousUpdates) { return; }
 
         RFB.messages.enableContinuousUpdates(this._sock, true, 0, 0,
-                                             this._fb_width, this._fb_height);
+                                             this._fbWidth, this._fbHeight);
     }
 
     _resize(width, height) {
-        this._fb_width = width;
-        this._fb_height = height;
+        this._fbWidth = width;
+        this._fbHeight = height;
 
-        this._display.resize(this._fb_width, this._fb_height);
+        this._display.resize(this._fbWidth, this._fbHeight);
 
         // Adjust the visible viewport based on the new dimensions
         this._updateClip();
@@ -2163,7 +2163,7 @@ export default class RFB extends EventTargetMixin {
     }
 
     _xvpOp(ver, op) {
-        if (this._rfb_xvp_ver < ver) { return; }
+        if (this._rfbXvpVer < ver) { return; }
         Log.Info("Sending XVP operation " + op + " (version " + ver + ")");
         RFB.messages.xvpOp(this._sock, ver, op);
     }
@@ -2199,8 +2199,8 @@ export default class RFB extends EventTargetMixin {
     }
 
     _refreshCursor() {
-        if (this._rfb_connection_state !== "connecting" &&
-            this._rfb_connection_state !== "connected") {
+        if (this._rfbConnectionState !== "connecting" &&
+            this._rfbConnectionState !== "connected") {
             return;
         }
         const image = this._shouldShowDotCursor() ? RFB.cursors.dot : this._cursorImage;
@@ -2238,13 +2238,13 @@ RFB.messages = {
     },
 
     QEMUExtendedKeyEvent(sock, keysym, down, keycode) {
-        function getRFBkeycode(xt_scancode) {
+        function getRFBkeycode(xtScanCode) {
             const upperByte = (keycode >> 8);
             const lowerByte = (keycode & 0x00ff);
             if (upperByte === 0xe0 && lowerByte < 0x7f) {
                 return lowerByte | 0x80;
             }
-            return xt_scancode;
+            return xtScanCode;
         }
 
         const buff = sock._sQ;
@@ -2513,7 +2513,7 @@ RFB.messages = {
         sock.flush();
     },
 
-    pixelFormat(sock, depth, true_color) {
+    pixelFormat(sock, depth, trueColor) {
         const buff = sock._sQ;
         const offset = sock._sQlen;
 
@@ -2538,7 +2538,7 @@ RFB.messages = {
         buff[offset + 4] = bpp;                 // bits-per-pixel
         buff[offset + 5] = depth;               // depth
         buff[offset + 6] = 0;                   // little-endian
-        buff[offset + 7] = true_color ? 1 : 0;  // true-color
+        buff[offset + 7] = trueColor ? 1 : 0;  // true-color
 
         buff[offset + 8] = 0;    // red-max
         buff[offset + 9] = (1 << bits) - 1;  // red-max
index a8975c2e775356dc56e889670232b3f4b1cd7d1b..ffe8c5fe2af1471d0b2b1573199ffc56def23042 100644 (file)
@@ -144,7 +144,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
         const rfb = new RFB(container, url, options);
         clock.tick();
         rfb._sock._websocket._open();
-        rfb._rfb_connection_state = 'connected';
+        rfb._rfbConnectionState = 'connected';
         sinon.spy(rfb, "_disconnect");
         rfbs.push(rfb);
         return rfb;
@@ -154,9 +154,9 @@ describe('Remote Frame Buffer Protocol Client', function () {
         describe('#RFB', function () {
             it('should set the current state to "connecting"', function () {
                 const client = new RFB(document.createElement('div'), 'wss://host:8675');
-                client._rfb_connection_state = '';
+                client._rfbConnectionState = '';
                 this.clock.tick();
-                expect(client._rfb_connection_state).to.equal('connecting');
+                expect(client._rfbConnectionState).to.equal('connecting');
             });
 
             it('should actually connect to the websocket', function () {
@@ -182,7 +182,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     .to.equal('disconnecting');
                 expect(client._updateConnectionState.getCall(1).args[0])
                     .to.equal('disconnected');
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
             });
 
             it('should unregister error event handler', function () {
@@ -208,12 +208,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
             let client;
             beforeEach(function () {
                 client = make_rfb();
-                client._rfb_connection_state = 'connecting';
+                client._rfbConnectionState = 'connecting';
             });
 
             it('should set the rfb credentials properly"', function () {
                 client.sendCredentials({ password: 'pass' });
-                expect(client._rfb_credentials).to.deep.equal({ password: 'pass' });
+                expect(client._rfbCredentials).to.deep.equal({ password: 'pass' });
             });
 
             it('should call init_msg "soon"', function () {
@@ -247,7 +247,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should not send the keys if we are not in a normal state', function () {
                 sinon.spy(client._sock, 'flush');
-                client._rfb_connection_state = "connecting";
+                client._rfbConnectionState = "connecting";
                 client.sendCtrlAltDel();
                 expect(client._sock.flush).to.not.have.been.called;
             });
@@ -278,7 +278,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should not send the key if we are not in a normal state', function () {
                 sinon.spy(client._sock, 'flush');
-                client._rfb_connection_state = "connecting";
+                client._rfbConnectionState = "connecting";
                 client.sendKey(123, 'Key123');
                 expect(client._sock.flush).to.not.have.been.called;
             });
@@ -361,17 +361,17 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should flush multiple times for large clipboards', function () {
                 sinon.spy(client._sock, 'flush');
-                let long_text = "";
+                let longText = "";
                 for (let i = 0; i < client._sock._sQbufferSize + 100; i++) {
-                    long_text += 'a';
+                    longText += 'a';
                 }
-                client.clipboardPasteFrom(long_text);
+                client.clipboardPasteFrom(longText);
                 expect(client._sock.flush).to.have.been.calledTwice;
             });
 
             it('should not send the text if we are not in a normal state', function () {
                 sinon.spy(client._sock, 'flush');
-                client._rfb_connection_state = "connecting";
+                client._rfbConnectionState = "connecting";
                 client.clipboardPasteFrom('abc');
                 expect(client._sock.flush).to.not.have.been.called;
             });
@@ -379,7 +379,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
         describe("XVP operations", function () {
             beforeEach(function () {
-                client._rfb_xvp_ver = 1;
+                client._rfbXvpVer = 1;
             });
 
             it('should send the shutdown signal on #machineShutdown', function () {
@@ -803,31 +803,31 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should clear the disconnect timer if the state is not "disconnecting"', function () {
                 const spy = sinon.spy();
                 client._disconnTimer = setTimeout(spy, 50);
-                client._rfb_connection_state = 'connecting';
+                client._rfbConnectionState = 'connecting';
                 client._updateConnectionState('connected');
                 this.clock.tick(51);
                 expect(spy).to.not.have.been.called;
                 expect(client._disconnTimer).to.be.null;
             });
 
-            it('should set the rfb_connection_state', function () {
-                client._rfb_connection_state = 'connecting';
+            it('should set the rfbConnectionState', function () {
+                client._rfbConnectionState = 'connecting';
                 client._updateConnectionState('connected');
-                expect(client._rfb_connection_state).to.equal('connected');
+                expect(client._rfbConnectionState).to.equal('connected');
             });
 
             it('should not change the state when we are disconnected', function () {
                 client.disconnect();
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
                 client._updateConnectionState('connecting');
-                expect(client._rfb_connection_state).to.not.equal('connecting');
+                expect(client._rfbConnectionState).to.not.equal('connecting');
             });
 
             it('should ignore state changes to the same state', function () {
                 const connectSpy = sinon.spy();
                 client.addEventListener("connect", connectSpy);
 
-                expect(client._rfb_connection_state).to.equal('connected');
+                expect(client._rfbConnectionState).to.equal('connected');
                 client._updateConnectionState('connected');
                 expect(connectSpy).to.not.have.been.called;
 
@@ -836,7 +836,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 const disconnectSpy = sinon.spy();
                 client.addEventListener("disconnect", disconnectSpy);
 
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
                 client._updateConnectionState('disconnected');
                 expect(disconnectSpy).to.not.have.been.called;
             });
@@ -845,7 +845,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 const spy = sinon.spy();
                 client.addEventListener("disconnect", spy);
                 client._updateConnectionState('disconnected');
-                expect(client._rfb_connection_state).to.not.equal('disconnected');
+                expect(client._rfbConnectionState).to.not.equal('disconnected');
                 expect(spy).to.not.have.been.called;
             });
         });
@@ -867,18 +867,18 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 client._fail();
                 this.clock.tick(2000);
                 expect(client._updateConnectionState).to.have.been.called;
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
             });
 
             it('should set clean_disconnect variable', function () {
-                client._rfb_clean_disconnect = true;
-                client._rfb_connection_state = 'connected';
+                client._rfbCleanDisconnect = true;
+                client._rfbConnectionState = 'connected';
                 client._fail();
-                expect(client._rfb_clean_disconnect).to.be.false;
+                expect(client._rfbCleanDisconnect).to.be.false;
             });
 
             it('should result in disconnect event with clean set to false', function () {
-                client._rfb_connection_state = 'connected';
+                client._rfbConnectionState = 'connected';
                 const spy = sinon.spy();
                 client.addEventListener("disconnect", spy);
                 client._fail();
@@ -910,7 +910,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should result in a connect event if state becomes connected', function () {
                 const spy = sinon.spy();
                 client.addEventListener("connect", spy);
-                client._rfb_connection_state = 'connecting';
+                client._rfbConnectionState = 'connecting';
                 client._updateConnectionState('connected');
                 expect(spy).to.have.been.calledOnce;
             });
@@ -936,8 +936,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 client._updateConnectionState('disconnecting');
                 this.clock.tick(3 * 1000);
                 expect(client._updateConnectionState).to.have.been.calledTwice;
-                expect(client._rfb_disconnect_reason).to.not.equal("");
-                expect(client._rfb_connection_state).to.equal("disconnected");
+                expect(client._rfbDisconnectReason).to.not.equal("");
+                expect(client._rfbConnectionState).to.equal("disconnected");
             });
 
             it('should not fail if Websock.onclose gets called within the disconnection timeout', function () {
@@ -945,7 +945,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 this.clock.tick(3 * 1000 / 2);
                 client._sock._websocket.close();
                 this.clock.tick(3 * 1000 / 2 + 1);
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
             });
 
             it('should close the WebSocket connection', function () {
@@ -972,7 +972,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should result in a disconnect event if state becomes "disconnected"', function () {
                 const spy = sinon.spy();
                 client.addEventListener("disconnect", spy);
-                client._rfb_connection_state = 'disconnecting';
+                client._rfbConnectionState = 'disconnecting';
                 client._updateConnectionState('disconnected');
                 expect(spy).to.have.been.calledOnce;
                 expect(spy.args[0][0].detail.clean).to.be.true;
@@ -981,8 +981,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should result in a disconnect event without msg when no reason given', function () {
                 const spy = sinon.spy();
                 client.addEventListener("disconnect", spy);
-                client._rfb_connection_state = 'disconnecting';
-                client._rfb_disconnect_reason = "";
+                client._rfbConnectionState = 'disconnecting';
+                client._rfbDisconnectReason = "";
                 client._updateConnectionState('disconnected');
                 expect(spy).to.have.been.calledOnce;
                 expect(spy.args[0].length).to.equal(1);
@@ -994,7 +994,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
         let client;
         beforeEach(function () {
             client = make_rfb();
-            client._rfb_connection_state = 'connecting';
+            client._rfbConnectionState = 'connecting';
         });
 
         describe('ProtocolVersion', function () {
@@ -1011,42 +1011,42 @@ describe('Remote Frame Buffer Protocol Client', function () {
             describe('version parsing', function () {
                 it('should interpret version 003.003 as version 3.3', function () {
                     send_ver('003.003', client);
-                    expect(client._rfb_version).to.equal(3.3);
+                    expect(client._rfbVersion).to.equal(3.3);
                 });
 
                 it('should interpret version 003.006 as version 3.3', function () {
                     send_ver('003.006', client);
-                    expect(client._rfb_version).to.equal(3.3);
+                    expect(client._rfbVersion).to.equal(3.3);
                 });
 
                 it('should interpret version 003.889 as version 3.3', function () {
                     send_ver('003.889', client);
-                    expect(client._rfb_version).to.equal(3.3);
+                    expect(client._rfbVersion).to.equal(3.3);
                 });
 
                 it('should interpret version 003.007 as version 3.7', function () {
                     send_ver('003.007', client);
-                    expect(client._rfb_version).to.equal(3.7);
+                    expect(client._rfbVersion).to.equal(3.7);
                 });
 
                 it('should interpret version 003.008 as version 3.8', function () {
                     send_ver('003.008', client);
-                    expect(client._rfb_version).to.equal(3.8);
+                    expect(client._rfbVersion).to.equal(3.8);
                 });
 
                 it('should interpret version 004.000 as version 3.8', function () {
                     send_ver('004.000', client);
-                    expect(client._rfb_version).to.equal(3.8);
+                    expect(client._rfbVersion).to.equal(3.8);
                 });
 
                 it('should interpret version 004.001 as version 3.8', function () {
                     send_ver('004.001', client);
-                    expect(client._rfb_version).to.equal(3.8);
+                    expect(client._rfbVersion).to.equal(3.8);
                 });
 
                 it('should interpret version 005.000 as version 3.8', function () {
                     send_ver('005.000', client);
-                    expect(client._rfb_version).to.equal(3.8);
+                    expect(client._rfbVersion).to.equal(3.8);
                 });
 
                 it('should fail on an invalid version', function () {
@@ -1059,10 +1059,10 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should send back the interpreted version', function () {
                 send_ver('004.000', client);
 
-                const expected_str = 'RFB 003.008\n';
+                const expectedStr = 'RFB 003.008\n';
                 const expected = [];
-                for (let i = 0; i < expected_str.length; i++) {
-                    expected[i] = expected_str.charCodeAt(i);
+                for (let i = 0; i < expectedStr.length; i++) {
+                    expected[i] = expectedStr.charCodeAt(i);
                 }
 
                 expect(client._sock).to.have.sent(new Uint8Array(expected));
@@ -1070,75 +1070,75 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should transition to the Security state on successful negotiation', function () {
                 send_ver('003.008', client);
-                expect(client._rfb_init_state).to.equal('Security');
+                expect(client._rfbInitState).to.equal('Security');
             });
 
             describe('Repeater', function () {
                 beforeEach(function () {
                     client = make_rfb('wss://host:8675', { repeaterID: "12345" });
-                    client._rfb_connection_state = 'connecting';
+                    client._rfbConnectionState = 'connecting';
                 });
 
                 it('should interpret version 000.000 as a repeater', function () {
                     send_ver('000.000', client);
-                    expect(client._rfb_version).to.equal(0);
+                    expect(client._rfbVersion).to.equal(0);
 
-                    const sent_data = client._sock._websocket._get_sent_data();
-                    expect(new Uint8Array(sent_data.buffer, 0, 9)).to.array.equal(new Uint8Array([73, 68, 58, 49, 50, 51, 52, 53, 0]));
-                    expect(sent_data).to.have.length(250);
+                    const sentData = client._sock._websocket._get_sent_data();
+                    expect(new Uint8Array(sentData.buffer, 0, 9)).to.array.equal(new Uint8Array([73, 68, 58, 49, 50, 51, 52, 53, 0]));
+                    expect(sentData).to.have.length(250);
                 });
 
                 it('should handle two step repeater negotiation', function () {
                     send_ver('000.000', client);
                     send_ver('003.008', client);
-                    expect(client._rfb_version).to.equal(3.8);
+                    expect(client._rfbVersion).to.equal(3.8);
                 });
             });
         });
 
         describe('Security', function () {
             beforeEach(function () {
-                client._rfb_init_state = 'Security';
+                client._rfbInitState = 'Security';
             });
 
             it('should simply receive the auth scheme when for versions < 3.7', function () {
-                client._rfb_version = 3.6;
-                const auth_scheme_raw = [1, 2, 3, 4];
-                const auth_scheme = (auth_scheme_raw[0] << 24) + (auth_scheme_raw[1] << 16) +
-                                  (auth_scheme_raw[2] << 8) + auth_scheme_raw[3];
-                client._sock._websocket._receive_data(new Uint8Array(auth_scheme_raw));
-                expect(client._rfb_auth_scheme).to.equal(auth_scheme);
+                client._rfbVersion = 3.6;
+                const authSchemeRaw = [1, 2, 3, 4];
+                const authScheme = (authSchemeRaw[0] << 24) + (authSchemeRaw[1] << 16) +
+                                  (authSchemeRaw[2] << 8) + authSchemeRaw[3];
+                client._sock._websocket._receive_data(new Uint8Array(authSchemeRaw));
+                expect(client._rfbAuthScheme).to.equal(authScheme);
             });
 
             it('should prefer no authentication is possible', function () {
-                client._rfb_version = 3.7;
-                const auth_schemes = [2, 1, 3];
-                client._sock._websocket._receive_data(new Uint8Array(auth_schemes));
-                expect(client._rfb_auth_scheme).to.equal(1);
+                client._rfbVersion = 3.7;
+                const authSchemes = [2, 1, 3];
+                client._sock._websocket._receive_data(new Uint8Array(authSchemes));
+                expect(client._rfbAuthScheme).to.equal(1);
                 expect(client._sock).to.have.sent(new Uint8Array([1, 1]));
             });
 
             it('should choose for the most prefered scheme possible for versions >= 3.7', function () {
-                client._rfb_version = 3.7;
-                const auth_schemes = [2, 22, 16];
-                client._sock._websocket._receive_data(new Uint8Array(auth_schemes));
-                expect(client._rfb_auth_scheme).to.equal(22);
+                client._rfbVersion = 3.7;
+                const authSchemes = [2, 22, 16];
+                client._sock._websocket._receive_data(new Uint8Array(authSchemes));
+                expect(client._rfbAuthScheme).to.equal(22);
                 expect(client._sock).to.have.sent(new Uint8Array([22]));
             });
 
             it('should fail if there are no supported schemes for versions >= 3.7', function () {
                 sinon.spy(client, "_fail");
-                client._rfb_version = 3.7;
-                const auth_schemes = [1, 32];
-                client._sock._websocket._receive_data(new Uint8Array(auth_schemes));
+                client._rfbVersion = 3.7;
+                const authSchemes = [1, 32];
+                client._sock._websocket._receive_data(new Uint8Array(authSchemes));
                 expect(client._fail).to.have.been.calledOnce;
             });
 
             it('should fail with the appropriate message if no types are sent for versions >= 3.7', function () {
-                client._rfb_version = 3.7;
-                const failure_data = [0, 0, 0, 0, 6, 119, 104, 111, 111, 112, 115];
+                client._rfbVersion = 3.7;
+                const failureData = [0, 0, 0, 0, 6, 119, 104, 111, 111, 112, 115];
                 sinon.spy(client, '_fail');
-                client._sock._websocket._receive_data(new Uint8Array(failure_data));
+                client._sock._websocket._receive_data(new Uint8Array(failureData));
 
                 expect(client._fail).to.have.been.calledOnce;
                 expect(client._fail).to.have.been.calledWith(
@@ -1146,18 +1146,18 @@ describe('Remote Frame Buffer Protocol Client', function () {
             });
 
             it('should transition to the Authentication state and continue on successful negotiation', function () {
-                client._rfb_version = 3.7;
-                const auth_schemes = [1, 1];
+                client._rfbVersion = 3.7;
+                const authSchemes = [1, 1];
                 client._negotiate_authentication = sinon.spy();
-                client._sock._websocket._receive_data(new Uint8Array(auth_schemes));
-                expect(client._rfb_init_state).to.equal('Authentication');
+                client._sock._websocket._receive_data(new Uint8Array(authSchemes));
+                expect(client._rfbInitState).to.equal('Authentication');
                 expect(client._negotiate_authentication).to.have.been.calledOnce;
             });
         });
 
         describe('Authentication', function () {
             beforeEach(function () {
-                client._rfb_init_state = 'Security';
+                client._rfbInitState = 'Security';
             });
 
             function send_security(type, cl) {
@@ -1165,13 +1165,13 @@ describe('Remote Frame Buffer Protocol Client', function () {
             }
 
             it('should fail on auth scheme 0 (pre 3.7) with the given message', function () {
-                client._rfb_version = 3.6;
-                const err_msg = "Whoopsies";
+                client._rfbVersion = 3.6;
+                const errMsg = "Whoopsies";
                 const data = [0, 0, 0, 0];
-                const err_len = err_msg.length;
-                push32(data, err_len);
-                for (let i = 0; i < err_len; i++) {
-                    data.push(err_msg.charCodeAt(i));
+                const errLen = errMsg.length;
+                push32(data, errLen);
+                for (let i = 0; i < errLen; i++) {
+                    data.push(errMsg.charCodeAt(i));
                 }
 
                 sinon.spy(client, '_fail');
@@ -1181,28 +1181,28 @@ describe('Remote Frame Buffer Protocol Client', function () {
             });
 
             it('should transition straight to SecurityResult on "no auth" (1) for versions >= 3.8', function () {
-                client._rfb_version = 3.8;
+                client._rfbVersion = 3.8;
                 send_security(1, client);
-                expect(client._rfb_init_state).to.equal('SecurityResult');
+                expect(client._rfbInitState).to.equal('SecurityResult');
             });
 
             it('should transition straight to ServerInitialisation on "no auth" for versions < 3.8', function () {
-                client._rfb_version = 3.7;
+                client._rfbVersion = 3.7;
                 send_security(1, client);
-                expect(client._rfb_init_state).to.equal('ServerInitialisation');
+                expect(client._rfbInitState).to.equal('ServerInitialisation');
             });
 
             it('should fail on an unknown auth scheme', function () {
                 sinon.spy(client, "_fail");
-                client._rfb_version = 3.8;
+                client._rfbVersion = 3.8;
                 send_security(57, client);
                 expect(client._fail).to.have.been.calledOnce;
             });
 
             describe('VNC Authentication (type 2) Handler', function () {
                 beforeEach(function () {
-                    client._rfb_init_state = 'Security';
-                    client._rfb_version = 3.8;
+                    client._rfbInitState = 'Security';
+                    client._rfbVersion = 3.8;
                 });
 
                 it('should fire the credentialsrequired event if missing a password', function () {
@@ -1214,13 +1214,13 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     for (let i = 0; i < 16; i++) { challenge[i] = i; }
                     client._sock._websocket._receive_data(new Uint8Array(challenge));
 
-                    expect(client._rfb_credentials).to.be.empty;
+                    expect(client._rfbCredentials).to.be.empty;
                     expect(spy).to.have.been.calledOnce;
                     expect(spy.args[0][0].detail.types).to.have.members(["password"]);
                 });
 
                 it('should encrypt the password with DES and then send it back', function () {
-                    client._rfb_credentials = { password: 'passwd' };
+                    client._rfbCredentials = { password: 'passwd' };
                     send_security(2, client);
                     client._sock._websocket._get_sent_data(); // skip the choice of auth reply
 
@@ -1228,32 +1228,32 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     for (let i = 0; i < 16; i++) { challenge[i] = i; }
                     client._sock._websocket._receive_data(new Uint8Array(challenge));
 
-                    const des_pass = RFB.genDES('passwd', challenge);
-                    expect(client._sock).to.have.sent(new Uint8Array(des_pass));
+                    const desPass = RFB.genDES('passwd', challenge);
+                    expect(client._sock).to.have.sent(new Uint8Array(desPass));
                 });
 
                 it('should transition to SecurityResult immediately after sending the password', function () {
-                    client._rfb_credentials = { password: 'passwd' };
+                    client._rfbCredentials = { password: 'passwd' };
                     send_security(2, client);
 
                     const challenge = [];
                     for (let i = 0; i < 16; i++) { challenge[i] = i; }
                     client._sock._websocket._receive_data(new Uint8Array(challenge));
 
-                    expect(client._rfb_init_state).to.equal('SecurityResult');
+                    expect(client._rfbInitState).to.equal('SecurityResult');
                 });
             });
 
             describe('XVP Authentication (type 22) Handler', function () {
                 beforeEach(function () {
-                    client._rfb_init_state = 'Security';
-                    client._rfb_version = 3.8;
+                    client._rfbInitState = 'Security';
+                    client._rfbVersion = 3.8;
                 });
 
                 it('should fall through to standard VNC authentication upon completion', function () {
-                    client._rfb_credentials = { username: 'user',
-                                                target: 'target',
-                                                password: 'password' };
+                    client._rfbCredentials = { username: 'user',
+                                               target: 'target',
+                                               password: 'password' };
                     client._negotiate_std_vnc_auth = sinon.spy();
                     send_security(22, client);
                     expect(client._negotiate_std_vnc_auth).to.have.been.calledOnce;
@@ -1262,10 +1262,10 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 it('should fire the credentialsrequired event if all credentials are missing', function () {
                     const spy = sinon.spy();
                     client.addEventListener("credentialsrequired", spy);
-                    client._rfb_credentials = {};
+                    client._rfbCredentials = {};
                     send_security(22, client);
 
-                    expect(client._rfb_credentials).to.be.empty;
+                    expect(client._rfbCredentials).to.be.empty;
                     expect(spy).to.have.been.calledOnce;
                     expect(spy.args[0][0].detail.types).to.have.members(["username", "password", "target"]);
                 });
@@ -1273,8 +1273,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 it('should fire the credentialsrequired event if some credentials are missing', function () {
                     const spy = sinon.spy();
                     client.addEventListener("credentialsrequired", spy);
-                    client._rfb_credentials = { username: 'user',
-                                                target: 'target' };
+                    client._rfbCredentials = { username: 'user',
+                                               target: 'target' };
                     send_security(22, client);
 
                     expect(spy).to.have.been.calledOnce;
@@ -1282,9 +1282,9 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 });
 
                 it('should send user and target separately', function () {
-                    client._rfb_credentials = { username: 'user',
-                                                target: 'target',
-                                                password: 'password' };
+                    client._rfbCredentials = { username: 'user',
+                                               target: 'target',
+                                               password: 'password' };
                     client._negotiate_std_vnc_auth = sinon.spy();
 
                     send_security(22, client);
@@ -1298,8 +1298,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             describe('TightVNC Authentication (type 16) Handler', function () {
                 beforeEach(function () {
-                    client._rfb_init_state = 'Security';
-                    client._rfb_version = 3.8;
+                    client._rfbInitState = 'Security';
+                    client._rfbVersion = 3.8;
                     send_security(16, client);
                     client._sock._websocket._get_sent_data();  // skip the security reply
                 });
@@ -1323,7 +1323,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
                 it('should skip tunnel negotiation if no tunnels are requested', function () {
                     client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0]));
-                    expect(client._rfb_tightvnc).to.be.true;
+                    expect(client._rfbTightVNC).to.be.true;
                 });
 
                 it('should fail if no supported tunnels are listed', function () {
@@ -1347,37 +1347,37 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     client._sock._websocket._get_sent_data();  // skip the tunnel choice here
                     send_num_str_pairs([[1, 'STDV', 'NOAUTH__']], client);
                     expect(client._sock).to.have.sent(new Uint8Array([0, 0, 0, 1]));
-                    expect(client._rfb_init_state).to.equal('SecurityResult');
+                    expect(client._rfbInitState).to.equal('SecurityResult');
                 });
 
                 /*it('should attempt to use VNC auth over no auth when possible', function () {
-                    client._rfb_tightvnc = true;
+                    client._rfbTightVNC = true;
                     client._negotiate_std_vnc_auth = sinon.spy();
                     send_num_str_pairs([[1, 'STDV', 'NOAUTH__'], [2, 'STDV', 'VNCAUTH_']], client);
                     expect(client._sock).to.have.sent([0, 0, 0, 1]);
                     expect(client._negotiate_std_vnc_auth).to.have.been.calledOnce;
-                    expect(client._rfb_auth_scheme).to.equal(2);
+                    expect(client._rfbAuthScheme).to.equal(2);
                 });*/ // while this would make sense, the original code doesn't actually do this
 
                 it('should accept the "no auth" auth type and transition to SecurityResult', function () {
-                    client._rfb_tightvnc = true;
+                    client._rfbTightVNC = true;
                     send_num_str_pairs([[1, 'STDV', 'NOAUTH__']], client);
                     expect(client._sock).to.have.sent(new Uint8Array([0, 0, 0, 1]));
-                    expect(client._rfb_init_state).to.equal('SecurityResult');
+                    expect(client._rfbInitState).to.equal('SecurityResult');
                 });
 
                 it('should accept VNC authentication and transition to that', function () {
-                    client._rfb_tightvnc = true;
+                    client._rfbTightVNC = true;
                     client._negotiate_std_vnc_auth = sinon.spy();
                     send_num_str_pairs([[2, 'STDV', 'VNCAUTH__']], client);
                     expect(client._sock).to.have.sent(new Uint8Array([0, 0, 0, 2]));
                     expect(client._negotiate_std_vnc_auth).to.have.been.calledOnce;
-                    expect(client._rfb_auth_scheme).to.equal(2);
+                    expect(client._rfbAuthScheme).to.equal(2);
                 });
 
                 it('should fail if there are no supported auth types', function () {
                     sinon.spy(client, "_fail");
-                    client._rfb_tightvnc = true;
+                    client._rfbTightVNC = true;
                     send_num_str_pairs([[23, 'stdv', 'badval__']], client);
                     expect(client._fail).to.have.been.calledOnce;
                 });
@@ -1386,26 +1386,26 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
         describe('SecurityResult', function () {
             beforeEach(function () {
-                client._rfb_init_state = 'SecurityResult';
+                client._rfbInitState = 'SecurityResult';
             });
 
             it('should fall through to ServerInitialisation on a response code of 0', function () {
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0]));
-                expect(client._rfb_init_state).to.equal('ServerInitialisation');
+                expect(client._rfbInitState).to.equal('ServerInitialisation');
             });
 
             it('should fail on an error code of 1 with the given message for versions >= 3.8', function () {
-                client._rfb_version = 3.8;
+                client._rfbVersion = 3.8;
                 sinon.spy(client, '_fail');
-                const failure_data = [0, 0, 0, 1, 0, 0, 0, 6, 119, 104, 111, 111, 112, 115];
-                client._sock._websocket._receive_data(new Uint8Array(failure_data));
+                const failureData = [0, 0, 0, 1, 0, 0, 0, 6, 119, 104, 111, 111, 112, 115];
+                client._sock._websocket._receive_data(new Uint8Array(failureData));
                 expect(client._fail).to.have.been.calledWith(
                     'Security negotiation failed on security result (reason: whoops)');
             });
 
             it('should fail on an error code of 1 with a standard message for version < 3.8', function () {
                 sinon.spy(client, '_fail');
-                client._rfb_version = 3.7;
+                client._rfbVersion = 3.7;
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 1]));
                 expect(client._fail).to.have.been.calledWith(
                     'Security handshake failed');
@@ -1420,28 +1420,28 @@ describe('Remote Frame Buffer Protocol Client', function () {
             });
 
             it('should include reason when provided in securityfailure event', function () {
-                client._rfb_version = 3.8;
+                client._rfbVersion = 3.8;
                 const spy = sinon.spy();
                 client.addEventListener("securityfailure", spy);
-                const failure_data = [0, 0, 0, 1, 0, 0, 0, 12, 115, 117, 99, 104,
-                                      32, 102, 97, 105, 108, 117, 114, 101];
-                client._sock._websocket._receive_data(new Uint8Array(failure_data));
+                const failureData = [0, 0, 0, 1, 0, 0, 0, 12, 115, 117, 99, 104,
+                                     32, 102, 97, 105, 108, 117, 114, 101];
+                client._sock._websocket._receive_data(new Uint8Array(failureData));
                 expect(spy.args[0][0].detail.status).to.equal(1);
                 expect(spy.args[0][0].detail.reason).to.equal('such failure');
             });
 
             it('should not include reason when length is zero in securityfailure event', function () {
-                client._rfb_version = 3.9;
+                client._rfbVersion = 3.9;
                 const spy = sinon.spy();
                 client.addEventListener("securityfailure", spy);
-                const failure_data = [0, 0, 0, 1, 0, 0, 0, 0];
-                client._sock._websocket._receive_data(new Uint8Array(failure_data));
+                const failureData = [0, 0, 0, 1, 0, 0, 0, 0];
+                client._sock._websocket._receive_data(new Uint8Array(failureData));
                 expect(spy.args[0][0].detail.status).to.equal(1);
                 expect('reason' in spy.args[0][0].detail).to.be.false;
             });
 
             it('should not include reason in securityfailure event for version < 3.8', function () {
-                client._rfb_version = 3.6;
+                client._rfbVersion = 3.6;
                 const spy = sinon.spy();
                 client.addEventListener("securityfailure", spy);
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 2]));
@@ -1453,24 +1453,24 @@ describe('Remote Frame Buffer Protocol Client', function () {
         describe('ClientInitialisation', function () {
             it('should transition to the ServerInitialisation state', function () {
                 const client = make_rfb();
-                client._rfb_connection_state = 'connecting';
-                client._rfb_init_state = 'SecurityResult';
+                client._rfbConnectionState = 'connecting';
+                client._rfbInitState = 'SecurityResult';
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0]));
-                expect(client._rfb_init_state).to.equal('ServerInitialisation');
+                expect(client._rfbInitState).to.equal('ServerInitialisation');
             });
 
             it('should send 1 if we are in shared mode', function () {
                 const client = make_rfb('wss://host:8675', { shared: true });
-                client._rfb_connection_state = 'connecting';
-                client._rfb_init_state = 'SecurityResult';
+                client._rfbConnectionState = 'connecting';
+                client._rfbInitState = 'SecurityResult';
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0]));
                 expect(client._sock).to.have.sent(new Uint8Array([1]));
             });
 
             it('should send 0 if we are not in shared mode', function () {
                 const client = make_rfb('wss://host:8675', { shared: false });
-                client._rfb_connection_state = 'connecting';
-                client._rfb_init_state = 'SecurityResult';
+                client._rfbConnectionState = 'connecting';
+                client._rfbInitState = 'SecurityResult';
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 0]));
                 expect(client._sock).to.have.sent(new Uint8Array([0]));
             });
@@ -1478,32 +1478,32 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
         describe('ServerInitialisation', function () {
             beforeEach(function () {
-                client._rfb_init_state = 'ServerInitialisation';
+                client._rfbInitState = 'ServerInitialisation';
             });
 
             function send_server_init(opts, client) {
-                const full_opts = { width: 10, height: 12, bpp: 24, depth: 24, big_endian: 0,
-                                    true_color: 1, red_max: 255, green_max: 255, blue_max: 255,
-                                    red_shift: 16, green_shift: 8, blue_shift: 0, name: 'a name' };
+                const fullOpts = { width: 10, height: 12, bpp: 24, depth: 24, big_endian: 0,
+                                   true_color: 1, redMax: 255, greenMax: 255, blueMax: 255,
+                                   redShift: 16, greenShift: 8, blueShift: 0, name: 'a name' };
                 for (let opt in opts) {
-                    full_opts[opt] = opts[opt];
+                    fullOpts[opt] = opts[opt];
                 }
                 const data = [];
 
-                push16(data, full_opts.width);
-                push16(data, full_opts.height);
+                push16(data, fullOpts.width);
+                push16(data, fullOpts.height);
 
-                data.push(full_opts.bpp);
-                data.push(full_opts.depth);
-                data.push(full_opts.big_endian);
-                data.push(full_opts.true_color);
+                data.push(fullOpts.bpp);
+                data.push(fullOpts.depth);
+                data.push(fullOpts.big_endian);
+                data.push(fullOpts.true_color);
 
-                push16(data, full_opts.red_max);
-                push16(data, full_opts.green_max);
-                push16(data, full_opts.blue_max);
-                push8(data, full_opts.red_shift);
-                push8(data, full_opts.green_shift);
-                push8(data, full_opts.blue_shift);
+                push16(data, fullOpts.redMax);
+                push16(data, fullOpts.greenMax);
+                push16(data, fullOpts.blueMax);
+                push8(data, fullOpts.redShift);
+                push8(data, fullOpts.greenShift);
+                push8(data, fullOpts.blueShift);
 
                 // padding
                 push8(data, 0);
@@ -1512,19 +1512,19 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
                 client._sock._websocket._receive_data(new Uint8Array(data));
 
-                const name_data = [];
-                let name_len = [];
-                pushString(name_data, full_opts.name);
-                push32(name_len, name_data.length);
+                const nameData = [];
+                let nameLen = [];
+                pushString(nameData, fullOpts.name);
+                push32(nameLen, nameData.length);
 
-                client._sock._websocket._receive_data(new Uint8Array(name_len));
-                client._sock._websocket._receive_data(new Uint8Array(name_data));
+                client._sock._websocket._receive_data(new Uint8Array(nameLen));
+                client._sock._websocket._receive_data(new Uint8Array(nameData));
             }
 
             it('should set the framebuffer width and height', function () {
                 send_server_init({ width: 32, height: 84 }, client);
-                expect(client._fb_width).to.equal(32);
-                expect(client._fb_height).to.equal(84);
+                expect(client._fbWidth).to.equal(32);
+                expect(client._fbHeight).to.equal(84);
             });
 
             // NB(sross): we just warn, not fail, for endian-ness and shifts, so we don't test them
@@ -1534,7 +1534,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 client.addEventListener("desktopname", spy);
                 send_server_init({ name: 'som€ nam€' }, client);
 
-                expect(client._fb_name).to.equal('som€ nam€');
+                expect(client._fbName).to.equal('som€ nam€');
                 expect(spy).to.have.been.calledOnce;
                 expect(spy.args[0][0].detail.name).to.equal('som€ nam€');
             });
@@ -1542,20 +1542,20 @@ describe('Remote Frame Buffer Protocol Client', function () {
             it('should handle the extended init message of the tight encoding', function () {
                 // NB(sross): we don't actually do anything with it, so just test that we can
                 //            read it w/o throwing an error
-                client._rfb_tightvnc = true;
+                client._rfbTightVNC = true;
                 send_server_init({}, client);
 
-                const tight_data = [];
-                push16(tight_data, 1);
-                push16(tight_data, 2);
-                push16(tight_data, 3);
-                push16(tight_data, 0);
+                const tightData = [];
+                push16(tightData, 1);
+                push16(tightData, 2);
+                push16(tightData, 3);
+                push16(tightData, 0);
                 for (let i = 0; i < 16 + 32 + 48; i++) {
-                    tight_data.push(i);
+                    tightData.push(i);
                 }
-                client._sock._websocket._receive_data(new Uint8Array(tight_data));
+                client._sock._websocket._receive_data(new Uint8Array(tightData));
 
-                expect(client._rfb_connection_state).to.equal('connected');
+                expect(client._rfbConnectionState).to.equal('connected');
             });
 
             it('should resize the display', function () {
@@ -1618,7 +1618,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should transition to the "connected" state', function () {
                 send_server_init({}, client);
-                expect(client._rfb_connection_state).to.equal('connected');
+                expect(client._rfbConnectionState).to.equal('connected');
             });
         });
     });
@@ -1628,66 +1628,66 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
         beforeEach(function () {
             client = make_rfb();
-            client._fb_name = 'some device';
-            client._fb_width = 640;
-            client._fb_height = 20;
+            client._fbName = 'some device';
+            client._fbWidth = 640;
+            client._fbHeight = 20;
         });
 
         describe('Framebuffer Update Handling', function () {
-            const target_data_arr = [
+            const targetDataArr = [
                 0xff, 0x00, 0x00, 255, 0x00, 0xff, 0x00, 255, 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255,
                 0x00, 0xff, 0x00, 255, 0xff, 0x00, 0x00, 255, 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255,
                 0xee, 0x00, 0xff, 255, 0x00, 0xee, 0xff, 255, 0xaa, 0xee, 0xff, 255, 0xab, 0xee, 0xff, 255,
                 0xee, 0x00, 0xff, 255, 0x00, 0xee, 0xff, 255, 0xaa, 0xee, 0xff, 255, 0xab, 0xee, 0xff, 255
             ];
-            let target_data;
+            let targetData;
 
-            const target_data_check_arr = [
+            const targetDataCheckArr = [
                 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
                 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
                 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255, 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255,
                 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255, 0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255
             ];
-            let target_data_check;
+            let targetDataCheck;
 
             before(function () {
                 // NB(directxman12): PhantomJS 1.x doesn't implement Uint8ClampedArray
-                target_data = new Uint8Array(target_data_arr);
-                target_data_check = new Uint8Array(target_data_check_arr);
+                targetData = new Uint8Array(targetDataArr);
+                targetDataCheck = new Uint8Array(targetDataCheckArr);
             });
 
-            function send_fbu_msg(rect_info, rect_data, client, rect_cnt) {
+            function send_fbu_msg(rectInfo, rectData, client, rectCnt) {
                 let data = [];
 
-                if (!rect_cnt || rect_cnt > -1) {
+                if (!rectCnt || rectCnt > -1) {
                     // header
                     data.push(0);  // msg type
                     data.push(0);  // padding
-                    push16(data, rect_cnt || rect_data.length);
+                    push16(data, rectCnt || rectData.length);
                 }
 
-                for (let i = 0; i < rect_data.length; i++) {
-                    if (rect_info[i]) {
-                        push16(data, rect_info[i].x);
-                        push16(data, rect_info[i].y);
-                        push16(data, rect_info[i].width);
-                        push16(data, rect_info[i].height);
-                        push32(data, rect_info[i].encoding);
+                for (let i = 0; i < rectData.length; i++) {
+                    if (rectInfo[i]) {
+                        push16(data, rectInfo[i].x);
+                        push16(data, rectInfo[i].y);
+                        push16(data, rectInfo[i].width);
+                        push16(data, rectInfo[i].height);
+                        push32(data, rectInfo[i].encoding);
                     }
-                    data = data.concat(rect_data[i]);
+                    data = data.concat(rectData[i]);
                 }
 
                 client._sock._websocket._receive_data(new Uint8Array(data));
             }
 
             it('should send an update request if there is sufficient data', function () {
-                const expected_msg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
-                RFB.messages.fbUpdateRequest(expected_msg, true, 0, 0, 640, 20);
+                const expectedMsg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
+                RFB.messages.fbUpdateRequest(expectedMsg, true, 0, 0, 640, 20);
 
                 client._framebufferUpdate = () => true;
                 client._sock._websocket._receive_data(new Uint8Array([0]));
 
-                expect(client._sock).to.have.sent(expected_msg._sQ);
+                expect(client._sock).to.have.sent(expectedMsg._sQ);
             });
 
             it('should not send an update request if we need more data', function () {
@@ -1696,8 +1696,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
             });
 
             it('should resume receiving an update if we previously did not have enough data', function () {
-                const expected_msg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
-                RFB.messages.fbUpdateRequest(expected_msg, true, 0, 0, 640, 20);
+                const expectedMsg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
+                RFB.messages.fbUpdateRequest(expectedMsg, true, 0, 0, 640, 20);
 
                 // just enough to set FBU.rects
                 client._sock._websocket._receive_data(new Uint8Array([0, 0, 0, 3]));
@@ -1706,7 +1706,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 client._framebufferUpdate = function () { this._sock.rQskipBytes(1); return true; };  // we magically have enough data
                 // 247 should *not* be used as the message type here
                 client._sock._websocket._receive_data(new Uint8Array([247]));
-                expect(client._sock).to.have.sent(expected_msg._sQ);
+                expect(client._sock).to.have.sent(expectedMsg._sQ);
             });
 
             it('should not send a request in continuous updates mode', function () {
@@ -1719,17 +1719,17 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             it('should fail on an unsupported encoding', function () {
                 sinon.spy(client, "_fail");
-                const rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: 234 };
-                send_fbu_msg([rect_info], [[]], client);
+                const rectInfo = { x: 8, y: 11, width: 27, height: 32, encoding: 234 };
+                send_fbu_msg([rectInfo], [[]], client);
                 expect(client._fail).to.have.been.calledOnce;
             });
 
             it('should be able to pause and resume receiving rects if not enought data', function () {
                 // seed some initial data to copy
-                client._fb_width = 4;
-                client._fb_height = 4;
+                client._fbWidth = 4;
+                client._fbHeight = 4;
                 client._display.resize(4, 4);
-                client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(target_data_check_arr.slice(0, 32)), 0);
+                client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(targetDataCheckArr.slice(0, 32)), 0);
 
                 const info = [{ x: 0, y: 2, width: 2, height: 2, encoding: 0x01},
                               { x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
@@ -1737,15 +1737,15 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 const rects = [[0, 2, 0, 0], [0, 0, 0, 0]];
                 send_fbu_msg([info[0]], [rects[0]], client, 2);
                 send_fbu_msg([info[1]], [rects[1]], client, -1);
-                expect(client._display).to.have.displayed(target_data_check);
+                expect(client._display).to.have.displayed(targetDataCheck);
             });
 
             describe('Message Encoding Handlers', function () {
                 beforeEach(function () {
                     // a really small frame
-                    client._fb_width = 4;
-                    client._fb_height = 4;
-                    client._fb_depth = 24;
+                    client._fbWidth = 4;
+                    client._fbHeight = 4;
+                    client._fbDepth = 24;
                     client._display.resize(4, 4);
                 });
 
@@ -1761,7 +1761,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         [0xff, 0x00, 0xee, 0, 0xff, 0xee, 0x00, 0, 0xff, 0xee, 0xaa, 0, 0xff, 0xee, 0xab, 0],
                         [0xff, 0x00, 0xee, 0, 0xff, 0xee, 0x00, 0, 0xff, 0xee, 0xaa, 0, 0xff, 0xee, 0xab, 0]];
                     send_fbu_msg(info, rects, client);
-                    expect(client._display).to.have.displayed(target_data);
+                    expect(client._display).to.have.displayed(targetData);
                 });
 
                 it('should handle the RAW encoding in low colour mode', function () {
@@ -1774,21 +1774,21 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         [0x0c, 0x0c, 0x0c, 0x0c],
                         [0x0c, 0x0c, 0x03, 0x03],
                         [0x0c, 0x0c, 0x03, 0x03]];
-                    client._fb_depth = 8;
+                    client._fbDepth = 8;
                     send_fbu_msg(info, rects, client);
-                    expect(client._display).to.have.displayed(target_data_check);
+                    expect(client._display).to.have.displayed(targetDataCheck);
                 });
 
                 it('should handle the COPYRECT encoding', function () {
                     // seed some initial data to copy
-                    client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(target_data_check_arr.slice(0, 32)), 0);
+                    client._display.blitRgbxImage(0, 0, 4, 2, new Uint8Array(targetDataCheckArr.slice(0, 32)), 0);
 
                     const info = [{ x: 0, y: 2, width: 2, height: 2, encoding: 0x01},
                                   { x: 2, y: 2, width: 2, height: 2, encoding: 0x01}];
                     // data says [{ old_x: 0, old_y: 0 }, { old_x: 0, old_y: 0 }]
                     const rects = [[0, 2, 0, 0], [0, 0, 0, 0]];
                     send_fbu_msg(info, rects, client);
-                    expect(client._display).to.have.displayed(target_data_check);
+                    expect(client._display).to.have.displayed(targetDataCheck);
                 });
 
                 // TODO(directxman12): for encodings with subrects, test resuming on partial send?
@@ -1815,9 +1815,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     push16(rect, 2); // y: 2
                     push16(rect, 2); // width: 2
                     push16(rect, 2); // height: 2
-
                     send_fbu_msg(info, [rect], client);
-                    expect(client._display).to.have.displayed(target_data_check);
+                    expect(client._display).to.have.displayed(targetDataCheck);
                 });
 
                 describe('the HEXTILE encoding handler', function () {
@@ -1836,21 +1835,21 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         rect.push(2 | (2 << 4)); // x: 2, y: 2
                         rect.push(1 | (1 << 4)); // width: 2, height: 2
                         send_fbu_msg(info, [rect], client);
-                        expect(client._display).to.have.displayed(target_data_check);
+                        expect(client._display).to.have.displayed(targetDataCheck);
                     });
 
                     it('should handle a raw tile', function () {
                         const info = [{ x: 0, y: 0, width: 4, height: 4, encoding: 0x05 }];
                         const rect = [];
                         rect.push(0x01); // raw
-                        for (let i = 0; i < target_data.length; i += 4) {
-                            rect.push(target_data[i + 2]);
-                            rect.push(target_data[i + 1]);
-                            rect.push(target_data[i]);
-                            rect.push(target_data[i + 3]);
+                        for (let i = 0; i < targetData.length; i += 4) {
+                            rect.push(targetData[i + 2]);
+                            rect.push(targetData[i + 1]);
+                            rect.push(targetData[i]);
+                            rect.push(targetData[i + 3]);
                         }
                         send_fbu_msg(info, [rect], client);
-                        expect(client._display).to.have.displayed(target_data);
+                        expect(client._display).to.have.displayed(targetData);
                     });
 
                     it('should handle a tile with only bg specified (solid bg)', function () {
@@ -1867,7 +1866,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
                     it('should handle a tile with only bg specified and an empty frame afterwards', function () {
                         // set the width so we can have two tiles
-                        client._fb_width = 8;
+                        client._fbWidth = 8;
                         client._display.resize(8, 4);
 
                         const info = [{ x: 0, y: 0, width: 32, height: 4, encoding: 0x05 }];
@@ -1908,12 +1907,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         rect.push(2 | (2 << 4)); // x: 2, y: 2
                         rect.push(1 | (1 << 4)); // width: 2, height: 2
                         send_fbu_msg(info, [rect], client);
-                        expect(client._display).to.have.displayed(target_data_check);
+                        expect(client._display).to.have.displayed(targetDataCheck);
                     });
 
                     it('should carry over fg and bg colors from the previous tile if not specified', function () {
-                        client._fb_width = 4;
-                        client._fb_height = 17;
+                        client._fbWidth = 4;
+                        client._fbHeight = 17;
                         client._display.resize(4, 17);
 
                         const info = [{ x: 0, y: 0, width: 4, height: 17, encoding: 0x05}];
@@ -1938,8 +1937,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         send_fbu_msg(info, [rect], client);
 
                         let expected = [];
-                        for (let i = 0; i < 4; i++) { expected = expected.concat(target_data_check_arr); }
-                        expected = expected.concat(target_data_check_arr.slice(0, 16));
+                        for (let i = 0; i < 4; i++) { expected = expected.concat(targetDataCheckArr); }
+                        expected = expected.concat(targetDataCheckArr.slice(0, 16));
                         expect(client._display).to.have.displayed(new Uint8Array(expected));
                     });
 
@@ -1964,8 +1963,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     sinon.spy(client._display, 'resize');
                     send_fbu_msg([{ x: 0, y: 0, width: 20, height: 50, encoding: -223 }], [[]], client);
 
-                    expect(client._fb_width).to.equal(20);
-                    expect(client._fb_height).to.equal(50);
+                    expect(client._fbWidth).to.equal(20);
+                    expect(client._fbHeight).to.equal(50);
 
                     expect(client._display.resize).to.have.been.calledOnce;
                     expect(client._display.resize).to.have.been.calledWith(20, 50);
@@ -1974,18 +1973,18 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 describe('the ExtendedDesktopSize pseudo-encoding handler', function () {
                     beforeEach(function () {
                         // a really small frame
-                        client._fb_width = 4;
-                        client._fb_height = 4;
+                        client._fbWidth = 4;
+                        client._fbHeight = 4;
                         client._display.resize(4, 4);
                         sinon.spy(client._display, 'resize');
                     });
 
-                    function make_screen_data(nr_of_screens) {
+                    function make_screen_data(nrOfScreens) {
                         const data = [];
-                        push8(data, nr_of_screens);   // number-of-screens
+                        push8(data, nrOfScreens);   // number-of-screens
                         push8(data, 0);               // padding
                         push16(data, 0);              // padding
-                        for (let i=0; i<nr_of_screens; i += 1) {
+                        for (let i=0; i<nrOfScreens; i += 1) {
                             push32(data, 0);  // id
                             push16(data, 0);  // x-position
                             push16(data, 0);  // y-position
@@ -1997,60 +1996,60 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     }
 
                     it('should handle a resize requested by this client', function () {
-                        const reason_for_change = 1; // requested by this client
-                        const status_code       = 0; // No error
+                        const reasonForChange = 1; // requested by this client
+                        const statusCode      = 0; // No error
 
-                        send_fbu_msg([{ x: reason_for_change, y: status_code,
+                        send_fbu_msg([{ x: reasonForChange, y: statusCode,
                                         width: 20, height: 50, encoding: -308 }],
                                      make_screen_data(1), client);
 
-                        expect(client._fb_width).to.equal(20);
-                        expect(client._fb_height).to.equal(50);
+                        expect(client._fbWidth).to.equal(20);
+                        expect(client._fbHeight).to.equal(50);
 
                         expect(client._display.resize).to.have.been.calledOnce;
                         expect(client._display.resize).to.have.been.calledWith(20, 50);
                     });
 
                     it('should handle a resize requested by another client', function () {
-                        const reason_for_change = 2; // requested by another client
-                        const status_code       = 0; // No error
+                        const reasonForChange = 2; // requested by another client
+                        const statusCode      = 0; // No error
 
-                        send_fbu_msg([{ x: reason_for_change, y: status_code,
+                        send_fbu_msg([{ x: reasonForChange, y: statusCode,
                                         width: 20, height: 50, encoding: -308 }],
                                      make_screen_data(1), client);
 
-                        expect(client._fb_width).to.equal(20);
-                        expect(client._fb_height).to.equal(50);
+                        expect(client._fbWidth).to.equal(20);
+                        expect(client._fbHeight).to.equal(50);
 
                         expect(client._display.resize).to.have.been.calledOnce;
                         expect(client._display.resize).to.have.been.calledWith(20, 50);
                     });
 
                     it('should be able to recieve requests which contain data for multiple screens', function () {
-                        const reason_for_change = 2; // requested by another client
-                        const status_code       = 0; // No error
+                        const reasonForChange = 2; // requested by another client
+                        const statusCode      = 0; // No error
 
-                        send_fbu_msg([{ x: reason_for_change, y: status_code,
+                        send_fbu_msg([{ x: reasonForChange, y: statusCode,
                                         width: 60, height: 50, encoding: -308 }],
                                      make_screen_data(3), client);
 
-                        expect(client._fb_width).to.equal(60);
-                        expect(client._fb_height).to.equal(50);
+                        expect(client._fbWidth).to.equal(60);
+                        expect(client._fbHeight).to.equal(50);
 
                         expect(client._display.resize).to.have.been.calledOnce;
                         expect(client._display.resize).to.have.been.calledWith(60, 50);
                     });
 
                     it('should not handle a failed request', function () {
-                        const reason_for_change = 1; // requested by this client
-                        const status_code       = 1; // Resize is administratively prohibited
+                        const reasonForChange = 1; // requested by this client
+                        const statusCode      = 1; // Resize is administratively prohibited
 
-                        send_fbu_msg([{ x: reason_for_change, y: status_code,
+                        send_fbu_msg([{ x: reasonForChange, y: statusCode,
                                         width: 20, height: 50, encoding: -308 }],
                                      make_screen_data(1), client);
 
-                        expect(client._fb_width).to.equal(4);
-                        expect(client._fb_height).to.equal(4);
+                        expect(client._fbWidth).to.equal(4);
+                        expect(client._fbHeight).to.equal(4);
 
                         expect(client._display.resize).to.not.have.been.called;
                     });
@@ -2255,13 +2254,13 @@ describe('Remote Frame Buffer Protocol Client', function () {
                     });
 
                     it('should update the cursor when type is classic', function () {
-                        let and_mask =
+                        let andMask =
                             [0xff, 0xff, 0xff, 0xff,  //Transparent
                              0xff, 0xff, 0xff, 0xff,  //Transparent
                              0x00, 0x00, 0x00, 0x00,  //Opaque
                              0xff, 0xff, 0xff, 0xff]; //Inverted
 
-                        let xor_mask =
+                        let xorMask =
                             [0x00, 0x00, 0x00, 0x00,  //Transparent
                              0x00, 0x00, 0x00, 0x00,  //Transparent
                              0x11, 0x22, 0x33, 0x44,  //Opaque
@@ -2276,18 +2275,18 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         let h = 2;
 
                         //AND-mask
-                        for (let i = 0; i < and_mask.length; i++) {
-                            push8(rect, and_mask[i]);
+                        for (let i = 0; i < andMask.length; i++) {
+                            push8(rect, andMask[i]);
                         }
                         //XOR-mask
-                        for (let i = 0; i < xor_mask.length; i++) {
-                            push8(rect, xor_mask[i]);
+                        for (let i = 0; i < xorMask.length; i++) {
+                            push8(rect, xorMask[i]);
                         }
 
-                        let expected_rgba = [0x00, 0x00, 0x00, 0x00,
-                                             0x00, 0x00, 0x00, 0x00,
-                                             0x33, 0x22, 0x11, 0xff,
-                                             0x00, 0x00, 0x00, 0xff];
+                        let expectedRgba = [0x00, 0x00, 0x00, 0x00,
+                                            0x00, 0x00, 0x00, 0x00,
+                                            0x33, 0x22, 0x11, 0xff,
+                                            0x00, 0x00, 0x00, 0xff];
 
                         send_fbu_msg([{ x: hotx, y: hoty,
                                         width: w, height: h,
@@ -2297,7 +2296,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         expect(client._cursor.change)
                             .to.have.been.calledOnce;
                         expect(client._cursor.change)
-                            .to.have.been.calledWith(expected_rgba,
+                            .to.have.been.calledWith(expectedRgba,
                                                      hotx, hoty,
                                                      w, h);
                     });
@@ -2321,12 +2320,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
                             push8(rect, data[i]);
                         }
 
-                        let expected_rgba = [0xee, 0x55, 0xff, 0x00,
-                                             0x00, 0xff, 0x00, 0xff,
-                                             0x00, 0xff, 0x00, 0x22,
-                                             0x00, 0xff, 0x00, 0x22,
-                                             0x00, 0xff, 0x00, 0x22,
-                                             0x00, 0x00, 0xff, 0xee];
+                        let expectedRgba = [0xee, 0x55, 0xff, 0x00,
+                                            0x00, 0xff, 0x00, 0xff,
+                                            0x00, 0xff, 0x00, 0x22,
+                                            0x00, 0xff, 0x00, 0x22,
+                                            0x00, 0xff, 0x00, 0x22,
+                                            0x00, 0x00, 0xff, 0xee];
 
                         send_fbu_msg([{ x: hotx, y: hoty,
                                         width: w, height: h,
@@ -2336,7 +2335,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                         expect(client._cursor.change)
                             .to.have.been.calledOnce;
                         expect(client._cursor.change)
-                            .to.have.been.calledWith(expected_rgba,
+                            .to.have.been.calledWith(expectedRgba,
                                                      hotx, hoty,
                                                      w, h);
                     });
@@ -2371,7 +2370,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
                     send_fbu_msg([{ x: 0, y: 0, width: 0, height: 0, encoding: -307 }], [data], client);
 
-                    expect(client._fb_name).to.equal('som€ nam€');
+                    expect(client._fbName).to.equal('som€ nam€');
                     expect(spy).to.have.been.calledOnce;
                     expect(spy.args[0][0].detail.name).to.equal('som€ nam€');
                 });
@@ -2383,7 +2382,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 const spy = sinon.spy();
                 client.addEventListener("capabilities", spy);
                 client._sock._websocket._receive_data(new Uint8Array([250, 0, 10, 1]));
-                expect(client._rfb_xvp_ver).to.equal(10);
+                expect(client._rfbXvpVer).to.equal(10);
                 expect(spy).to.have.been.calledOnce;
                 expect(spy.args[0][0].detail.capabilities.power).to.be.true;
                 expect(client.capabilities.power).to.be.true;
@@ -2398,16 +2397,16 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
         describe('Normal Clipboard Handling Receive', function () {
             it('should fire the clipboard callback with the retrieved text on ServerCutText', function () {
-                const expected_str = 'cheese!';
+                const expectedStr = 'cheese!';
                 const data = [3, 0, 0, 0];
-                push32(data, expected_str.length);
-                for (let i = 0; i < expected_str.length; i++) { data.push(expected_str.charCodeAt(i)); }
+                push32(data, expectedStr.length);
+                for (let i = 0; i < expectedStr.length; i++) { data.push(expectedStr.charCodeAt(i)); }
                 const spy = sinon.spy();
                 client.addEventListener("clipboard", spy);
 
                 client._sock._websocket._receive_data(new Uint8Array(data));
                 expect(spy).to.have.been.calledOnce;
-                expect(spy.args[0][0].detail.text).to.equal(expected_str);
+                expect(spy.args[0][0].detail.text).to.equal(expectedStr);
             });
         });
 
@@ -2649,41 +2648,41 @@ describe('Remote Frame Buffer Protocol Client', function () {
         });
 
         it('should respond correctly to ServerFence', function () {
-            const expected_msg = {_sQ: new Uint8Array(16), _sQlen: 0, flush: () => {}};
-            const incoming_msg = {_sQ: new Uint8Array(16), _sQlen: 0, flush: () => {}};
+            const expectedMsg = {_sQ: new Uint8Array(16), _sQlen: 0, flush: () => {}};
+            const incomingMsg = {_sQ: new Uint8Array(16), _sQlen: 0, flush: () => {}};
 
             const payload = "foo\x00ab9";
 
             // ClientFence and ServerFence are identical in structure
-            RFB.messages.clientFence(expected_msg, (1<<0) | (1<<1), payload);
-            RFB.messages.clientFence(incoming_msg, 0xffffffff, payload);
+            RFB.messages.clientFence(expectedMsg, (1<<0) | (1<<1), payload);
+            RFB.messages.clientFence(incomingMsg, 0xffffffff, payload);
 
-            client._sock._websocket._receive_data(incoming_msg._sQ);
+            client._sock._websocket._receive_data(incomingMsg._sQ);
 
-            expect(client._sock).to.have.sent(expected_msg._sQ);
+            expect(client._sock).to.have.sent(expectedMsg._sQ);
 
-            expected_msg._sQlen = 0;
-            incoming_msg._sQlen = 0;
+            expectedMsg._sQlen = 0;
+            incomingMsg._sQlen = 0;
 
-            RFB.messages.clientFence(expected_msg, (1<<0), payload);
-            RFB.messages.clientFence(incoming_msg, (1<<0) | (1<<31), payload);
+            RFB.messages.clientFence(expectedMsg, (1<<0), payload);
+            RFB.messages.clientFence(incomingMsg, (1<<0) | (1<<31), payload);
 
-            client._sock._websocket._receive_data(incoming_msg._sQ);
+            client._sock._websocket._receive_data(incomingMsg._sQ);
 
-            expect(client._sock).to.have.sent(expected_msg._sQ);
+            expect(client._sock).to.have.sent(expectedMsg._sQ);
         });
 
         it('should enable continuous updates on first EndOfContinousUpdates', function () {
-            const expected_msg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
+            const expectedMsg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
 
-            RFB.messages.enableContinuousUpdates(expected_msg, true, 0, 0, 640, 20);
+            RFB.messages.enableContinuousUpdates(expectedMsg, true, 0, 0, 640, 20);
 
             expect(client._enabledContinuousUpdates).to.be.false;
 
             client._sock._websocket._receive_data(new Uint8Array([150]));
 
             expect(client._enabledContinuousUpdates).to.be.true;
-            expect(client._sock).to.have.sent(expected_msg._sQ);
+            expect(client._sock).to.have.sent(expectedMsg._sQ);
         });
 
         it('should disable continuous updates on subsequent EndOfContinousUpdates', function () {
@@ -2696,8 +2695,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
         });
 
         it('should update continuous updates on resize', function () {
-            const expected_msg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
-            RFB.messages.enableContinuousUpdates(expected_msg, true, 0, 0, 90, 700);
+            const expectedMsg = {_sQ: new Uint8Array(10), _sQlen: 0, flush: () => {}};
+            RFB.messages.enableContinuousUpdates(expectedMsg, true, 0, 0, 90, 700);
 
             client._resize(450, 160);
 
@@ -2707,7 +2706,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
 
             client._resize(90, 700);
 
-            expect(client._sock).to.have.sent(expected_msg._sQ);
+            expect(client._sock).to.have.sent(expectedMsg._sQ);
         });
 
         it('should fail on an unknown message type', function () {
@@ -2780,9 +2779,9 @@ describe('Remote Frame Buffer Protocol Client', function () {
         describe('Keyboard Event Handlers', function () {
             it('should send a key message on a key press', function () {
                 client._handleKeyEvent(0x41, 'KeyA', true);
-                const key_msg = {_sQ: new Uint8Array(8), _sQlen: 0, flush: () => {}};
-                RFB.messages.keyEvent(key_msg, 0x41, 1);
-                expect(client._sock).to.have.sent(key_msg._sQ);
+                const keyMsg = {_sQ: new Uint8Array(8), _sQlen: 0, flush: () => {}};
+                RFB.messages.keyEvent(keyMsg, 0x41, 1);
+                expect(client._sock).to.have.sent(keyMsg._sQ);
             });
 
             it('should not send messages in view-only mode', function () {
@@ -2808,8 +2807,8 @@ describe('Remote Frame Buffer Protocol Client', function () {
             });
 
             it('should handle a message in any non-disconnected/failed state like an init message', function () {
-                client._rfb_connection_state = 'connecting';
-                client._rfb_init_state = 'ProtocolVersion';
+                client._rfbConnectionState = 'connecting';
+                client._rfbInitState = 'ProtocolVersion';
                 client._init_msg = sinon.spy();
                 client._sock._websocket._receive_data(new Uint8Array([1, 2, 3]));
                 expect(client._init_msg).to.have.been.called;
@@ -2827,12 +2826,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 client = new RFB(document.createElement('div'), 'wss://host:8675');
                 this.clock.tick();
                 client._sock._websocket._open();
-                expect(client._rfb_init_state).to.equal('ProtocolVersion');
+                expect(client._rfbInitState).to.equal('ProtocolVersion');
             });
 
             it('should fail if we are not currently ready to connect and we get an "open" event', function () {
                 sinon.spy(client, "_fail");
-                client._rfb_connection_state = 'connected';
+                client._rfbConnectionState = 'connected';
                 client._sock._websocket._open();
                 expect(client._fail).to.have.been.calledOnce;
             });
@@ -2842,15 +2841,15 @@ describe('Remote Frame Buffer Protocol Client', function () {
                 const real = client._sock._websocket.close;
                 client._sock._websocket.close = () => {};
                 client.disconnect();
-                expect(client._rfb_connection_state).to.equal('disconnecting');
+                expect(client._rfbConnectionState).to.equal('disconnecting');
                 client._sock._websocket.close = real;
                 client._sock._websocket.close();
-                expect(client._rfb_connection_state).to.equal('disconnected');
+                expect(client._rfbConnectionState).to.equal('disconnected');
             });
 
             it('should fail if we get a close event while connecting', function () {
                 sinon.spy(client, "_fail");
-                client._rfb_connection_state = 'connecting';
+                client._rfbConnectionState = 'connecting';
                 client._sock._websocket.close();
                 expect(client._fail).to.have.been.calledOnce;
             });
@@ -2946,21 +2945,21 @@ describe('Remote Frame Buffer Protocol Client', function () {
         it('should not send clientEncodings if not in connected state', function () {
             let newQuality;
 
-            client._rfb_connection_state = '';
+            client._rfbConnectionState = '';
             newQuality = 2;
             client.qualityLevel = newQuality;
             expect(RFB.messages.clientEncodings).to.not.have.been.called;
 
             RFB.messages.clientEncodings.resetHistory();
 
-            client._rfb_connection_state = 'connnecting';
+            client._rfbConnectionState = 'connnecting';
             newQuality = 6;
             client.qualityLevel = newQuality;
             expect(RFB.messages.clientEncodings).to.not.have.been.called;
 
             RFB.messages.clientEncodings.resetHistory();
 
-            client._rfb_connection_state = 'connected';
+            client._rfbConnectionState = 'connected';
             newQuality = 5;
             client.qualityLevel = newQuality;
             expect(RFB.messages.clientEncodings).to.have.been.calledOnce;
@@ -3048,21 +3047,21 @@ describe('Remote Frame Buffer Protocol Client', function () {
         it('should not send clientEncodings if not in connected state', function () {
             let newCompression;
 
-            client._rfb_connection_state = '';
+            client._rfbConnectionState = '';
             newCompression = 7;
             client.compressionLevel = newCompression;
             expect(RFB.messages.clientEncodings).to.not.have.been.called;
 
             RFB.messages.clientEncodings.resetHistory();
 
-            client._rfb_connection_state = 'connnecting';
+            client._rfbConnectionState = 'connnecting';
             newCompression = 6;
             client.compressionLevel = newCompression;
             expect(RFB.messages.clientEncodings).to.not.have.been.called;
 
             RFB.messages.clientEncodings.resetHistory();
 
-            client._rfb_connection_state = 'connected';
+            client._rfbConnectionState = 'connected';
             newCompression = 5;
             client.compressionLevel = newCompression;
             expect(RFB.messages.clientEncodings).to.have.been.calledOnce;