Create RFB object on connect
In e543525faa, we switched to creating
a new RFB object on disconnect. This caused issues, however, since
any errors were only displayed briefly before the new "loaded" text
was displayed instead.
Now, we create the RFB object on connect. This essentially removes
the usefulness of the "loaded" state, but prevents the aforementioned
problem.
To facilitate this, the code which does detection of cursor URI support
was moved from this Display constructor (which now calls the new
function) into its own function, `Util.browserSupportsCursorURIs()`.
Fixes #467
This commit is contained in:
+5
-11
@@ -28,35 +28,29 @@ describe('Display/Canvas Helper', function () {
|
||||
|
||||
describe('checking for cursor uri support', function () {
|
||||
beforeEach(function () {
|
||||
this._old_change_cursor = Display.changeCursor;
|
||||
this._old_browser_supports_cursor_uris = Util.browserSupportsCursorURIs;
|
||||
});
|
||||
|
||||
it('should disable cursor URIs if there is no support', function () {
|
||||
Display.changeCursor = function(target) {
|
||||
target.style.cursor = undefined;
|
||||
};
|
||||
Util.browserSupportsCursorURIs = function () { return false; };
|
||||
var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false });
|
||||
expect(display._cursor_uri).to.be.false;
|
||||
});
|
||||
|
||||
it('should enable cursor URIs if there is support', function () {
|
||||
Display.changeCursor = function(target) {
|
||||
target.style.cursor = 'pointer';
|
||||
};
|
||||
Util.browserSupportsCursorURIs = function () { return true; };
|
||||
var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false });
|
||||
expect(display._cursor_uri).to.be.true;
|
||||
});
|
||||
|
||||
it('respect the cursor_uri option if there is support', function () {
|
||||
Display.changeCursor = function(target) {
|
||||
target.style.cursor = 'pointer';
|
||||
};
|
||||
Util.browserSupportsCursorURIs = function () { return false; };
|
||||
var display = new Display({ target: document.createElement('canvas'), prefer_js: true, viewport: false, cursor_uri: false });
|
||||
expect(display._cursor_uri).to.be.false;
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
Display.changeCursor = this._old_change_cursor;
|
||||
Util.browserSupportsCursorURIs = this._old_browser_supports_cursor_uris;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user