Remove onFBU* callbacks

They are internal mechanisms that callers should be isolated from.
This commit is contained in:
Pierre Ossman 2017-10-13 14:45:44 +02:00
parent 832be2625b
commit 30691b668e
3 changed files with 0 additions and 62 deletions

View File

@ -138,8 +138,6 @@ export default function RFB(defaults) {
'onCredentialsRequired': function () { }, // onCredentialsRequired(rfb, types): VNC credentials are required 'onCredentialsRequired': function () { }, // onCredentialsRequired(rfb, types): VNC credentials are required
'onClipboard': function () { }, // onClipboard(rfb, text): RFB clipboard contents received 'onClipboard': function () { }, // onClipboard(rfb, text): RFB clipboard contents received
'onBell': function () { }, // onBell(rfb): RFB Bell message received 'onBell': function () { }, // onBell(rfb): RFB Bell message received
'onFBUReceive': function () { }, // onFBUReceive(rfb, rect): RFB FBU rect received but not yet processed
'onFBUComplete': function () { }, // onFBUComplete(rfb): RFB FBU received and processed
'onFBResize': function () { }, // onFBResize(rfb, width, height): frame buffer resized 'onFBResize': function () { }, // onFBResize(rfb, width, height): frame buffer resized
'onDesktopName': function () { }, // onDesktopName(rfb, name): desktop name received 'onDesktopName': function () { }, // onDesktopName(rfb, name): desktop name received
'onCapabilities': function () { } // onCapabilities(rfb, caps): the supported capabilities has changed 'onCapabilities': function () { } // onCapabilities(rfb, caps): the supported capabilities has changed
@ -1397,12 +1395,6 @@ RFB.prototype = {
this._FBU.encoding = parseInt((hdr[8] << 24) + (hdr[9] << 16) + this._FBU.encoding = parseInt((hdr[8] << 24) + (hdr[9] << 16) +
(hdr[10] << 8) + hdr[11], 10); (hdr[10] << 8) + hdr[11], 10);
this._onFBUReceive(this,
{'x': this._FBU.x, 'y': this._FBU.y,
'width': this._FBU.width, 'height': this._FBU.height,
'encoding': this._FBU.encoding,
'encodingName': encodingName(this._FBU.encoding)});
if (!this._encHandlers[this._FBU.encoding]) { if (!this._encHandlers[this._FBU.encoding]) {
this._fail("Unexpected server message", this._fail("Unexpected server message",
"Unsupported encoding " + "Unsupported encoding " +
@ -1457,8 +1449,6 @@ RFB.prototype = {
this._display.flip(); this._display.flip();
this._onFBUComplete(this);
return true; // We finished this FBU return true; // We finished this FBU
}, },
@ -1511,8 +1501,6 @@ make_properties(RFB, [
['onCredentialsRequired', 'rw', 'func'], // onCredentialsRequired(rfb, types): VNC credentials are required ['onCredentialsRequired', 'rw', 'func'], // onCredentialsRequired(rfb, types): VNC credentials are required
['onClipboard', 'rw', 'func'], // onClipboard(rfb, text): RFB clipboard contents received ['onClipboard', 'rw', 'func'], // onClipboard(rfb, text): RFB clipboard contents received
['onBell', 'rw', 'func'], // onBell(rfb): RFB Bell message received ['onBell', 'rw', 'func'], // onBell(rfb): RFB Bell message received
['onFBUReceive', 'rw', 'func'], // onFBUReceive(rfb, fbu): RFB FBU received but not yet processed
['onFBUComplete', 'rw', 'func'], // onFBUComplete(rfb, fbu): RFB FBU received and processed
['onFBResize', 'rw', 'func'], // onFBResize(rfb, width, height): frame buffer resized ['onFBResize', 'rw', 'func'], // onFBResize(rfb, width, height): frame buffer resized
['onDesktopName', 'rw', 'func'], // onDesktopName(rfb, name): desktop name received ['onDesktopName', 'rw', 'func'], // onDesktopName(rfb, name): desktop name received
['onCapabilities', 'rw', 'func'] // onCapabilities(rfb, caps): the supported capabilities has changed ['onCapabilities', 'rw', 'func'] // onCapabilities(rfb, caps): the supported capabilities has changed

View File

@ -80,8 +80,6 @@ functions.
| onCredentialsRequired | (rfb, types) | VNC credentials are required (use sendCredentials) | onCredentialsRequired | (rfb, types) | VNC credentials are required (use sendCredentials)
| onClipboard | (rfb, text) | RFB clipboard contents received | onClipboard | (rfb, text) | RFB clipboard contents received
| onBell | (rfb) | RFB Bell message received | onBell | (rfb) | RFB Bell message received
| onFBUReceive | (rfb, fbu) | RFB FBU received but not yet processed (see details below)
| onFBUComplete | (rfb, fbu) | RFB FBU received and processed (see details below)
| onFBResize | (rfb, width, height) | Frame buffer (remote desktop) size changed | onFBResize | (rfb, width, height) | Frame buffer (remote desktop) size changed
| onDesktopName | (rfb, name) | VNC desktop name recieved | onDesktopName | (rfb, name) | VNC desktop name recieved
| onCapabilities | (rfb, capabilities) | The supported capabilities has changed | onCapabilities | (rfb, capabilities) | The supported capabilities has changed
@ -114,23 +112,3 @@ defined:
| username | User that authenticates | username | User that authenticates
| password | Password for user | password | Password for user
| target | String specifying target machine or session | target | String specifying target machine or session
__RFB onFBUReceive and on FBUComplete callback details__
The onFBUReceive callback is invoked when a frame buffer update
message has been received from the server but before the RFB class has
done any additional handling. The onFBUComplete callback is invoked
with the same information but after the RFB class has handled the
message.
The 'fbu' parameter is an object with the following structure:
{
x: FBU_x_position,
y: FBU_y_position,
width: FBU_width,
height: FBU_height,
encoding: FBU_encoding_number,
encodingName: FBU_encoding_string
}

View File

@ -1343,32 +1343,6 @@ describe('Remote Frame Buffer Protocol Client', function() {
expect(client._sock._websocket._get_sent_data()).to.have.length(0); expect(client._sock._websocket._get_sent_data()).to.have.length(0);
}); });
it('should parse out information from a header before any actual data comes in', function () {
client.set_onFBUReceive(sinon.spy());
var rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: 0x02, encodingName: 'RRE' };
send_fbu_msg([rect_info], [[]], client);
var spy = client.get_onFBUReceive();
expect(spy).to.have.been.calledOnce;
expect(spy).to.have.been.calledWith(sinon.match.any, rect_info);
});
it('should fire onFBUComplete when the update is complete', function () {
client.set_onFBUComplete(sinon.spy());
var rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: -224, encodingName: 'last_rect' };
send_fbu_msg([rect_info], [[]], client); // last_rect
var spy = client.get_onFBUComplete();
expect(spy).to.have.been.calledOnce;
});
it('should not fire onFBUComplete if we have not finished processing the update', function () {
client.set_onFBUComplete(sinon.spy());
var rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: 0x00, encodingName: 'RAW' };
send_fbu_msg([rect_info], [[]], client);
expect(client.get_onFBUComplete()).to.not.have.been.called;
});
it('should fail on an unsupported encoding', function () { it('should fail on an unsupported encoding', function () {
sinon.spy(client, "_fail"); sinon.spy(client, "_fail");
var rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: 234 }; var rect_info = { x: 8, y: 11, width: 27, height: 32, encoding: 234 };
@ -1783,10 +1757,8 @@ describe('Remote Frame Buffer Protocol Client', function() {
}); });
it('should handle the last_rect pseudo-encoding', function () { it('should handle the last_rect pseudo-encoding', function () {
client.set_onFBUReceive(sinon.spy());
send_fbu_msg([{ x: 0, y: 0, width: 0, height: 0, encoding: -224}], [[]], client, 100); send_fbu_msg([{ x: 0, y: 0, width: 0, height: 0, encoding: -224}], [[]], client, 100);
expect(client._FBU.rects).to.equal(0); expect(client._FBU.rects).to.equal(0);
expect(client.get_onFBUReceive()).to.have.been.calledOnce;
}); });
}); });
}); });