diff --git a/core/rfb.js b/core/rfb.js index ea49c0cf..f441dab4 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -442,6 +442,7 @@ if (state === oldstate) { // Already here, ignore Util.Debug("Already in state '" + state + "', ignoring"); + return; } /* diff --git a/tests/test.rfb.js b/tests/test.rfb.js index d5ceede5..e1a11f0b 100644 --- a/tests/test.rfb.js +++ b/tests/test.rfb.js @@ -343,7 +343,10 @@ describe('Remote Frame Buffer Protocol Client', function() { describe('Page States', function () { describe('loaded', function () { var client; - beforeEach(function () { client = make_rfb(); }); + beforeEach(function () { + client = make_rfb(); + client._rfb_state = 'disconnected'; + }); it('should close any open WebSocket connection', function () { sinon.spy(client._sock, 'close');