]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Drop support for legacy Edge
authorPierre Ossman <ossman@cendio.se>
Thu, 15 Oct 2020 15:16:00 +0000 (17:16 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 15 Oct 2020 16:53:51 +0000 (18:53 +0200)
README.md
core/input/keyboard.js
core/input/util.js
core/util/browser.js
tests/test.helper.js
tests/test.keyboard.js

index 9e8810ef8e23f7c9ce04c05598e7d53e16cdba71..42b5d22d2d6344b46a3edf93c2b1029c6b684d6a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -91,7 +91,7 @@ noVNC uses many modern web technologies so a formal requirement list is
 not available. However these are the minimum versions we are currently
 aware of:
 
-* Chrome 49, Firefox 44, Safari 11, Opera 36, Edge 12
+* Chrome 49, Firefox 44, Safari 11, Opera 36, Edge 79
 
 
 ### Server Requirements
index bef9081b018449411ff1375fa8ceef98b5c9316a..ad8fc90bf77732a50991e582d73c9e8a6b53ebb3 100644 (file)
@@ -170,9 +170,7 @@ export default class Keyboard {
 
         // If this is a legacy browser then we'll need to wait for
         // a keypress event as well
-        // (Edge has a broken KeyboardEvent.key, so we can't
-        // just check for the presence of that field)
-        if (!keysym && (!e.key || browser.isEdge())) {
+        if (!keysym && !e.key) {
             this._pendingKey = code;
             // However we might not get a keypress event if the key
             // is non-printable, which needs some special fallback
index 90fe4293c7082a0d178e4a9895308377ceed0c86..dc00d3c3e4359dec294d985e530f96bc16b5d4c5 100644 (file)
@@ -110,18 +110,7 @@ export function getKey(evt) {
             return 'Delete';
         }
 
-        // Edge need special handling, but for everyone else we
-        // can trust the value provided
-        if (!browser.isEdge()) {
-            return evt.key;
-        }
-
-        // Edge has broken handling of AltGraph so we can only
-        // trust it for non-printable characters (and unfortunately
-        // is also specifies 'Unidentified' for some problem keys)
-        if ((evt.key.length !== 1) && (evt.key !== 'Unidentified')) {
-            return evt.key;
-        }
+        return evt.key;
     }
 
     // Try to deduce it based on the physical key
index d157b53cba0008c38104456017e2833f64db4954..c8873c45bf426369959fa76d0cfdbfe7acc5d7e0 100644 (file)
@@ -106,10 +106,6 @@ export function isSafari() {
                          navigator.userAgent.indexOf('Chrome') === -1);
 }
 
-export function isEdge() {
-    return navigator && !!(/edge/i).exec(navigator.userAgent);
-}
-
 export function isFirefox() {
     return navigator && !!(/firefox/i).exec(navigator.userAgent);
 }
index 035b72db273df935a12a7a38b39d6f74911a7a61..79deefee3c5d615de3152b0f517e6046fd9ec604 100644 (file)
@@ -2,7 +2,6 @@
 
 import keysyms from '../core/input/keysymdef.js';
 import * as KeyboardUtil from "../core/input/util.js";
-import * as browser from '../core/util/browser.js';
 
 describe('Helpers', function () {
     "use strict";
@@ -97,7 +96,6 @@ describe('Helpers', function () {
 
     describe('getKey', function () {
         it('should prefer key', function () {
-            if (browser.isEdge()) this.skip();
             expect(KeyboardUtil.getKey({key: 'a', charCode: 'Š'.charCodeAt(), keyCode: 0x42, which: 0x43})).to.be.equal('a');
         });
         it('should map legacy values', function () {
@@ -125,42 +123,6 @@ describe('Helpers', function () {
         it('should return Unidentified when it cannot map the key', function () {
             expect(KeyboardUtil.getKey({keycode: 0x42})).to.be.equal('Unidentified');
         });
-
-        describe('Broken key AltGraph on Edge', function () {
-            let origNavigator;
-            beforeEach(function () {
-                // window.navigator is a protected read-only property in many
-                // environments, so we need to redefine it whilst running these
-                // tests.
-                origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
-
-                Object.defineProperty(window, "navigator", {value: {}});
-                if (window.navigator.platform !== undefined) {
-                    // Object.defineProperty() doesn't work properly in old
-                    // versions of Chrome
-                    this.skip();
-                }
-            });
-            afterEach(function () {
-                if (origNavigator !== undefined) {
-                    Object.defineProperty(window, "navigator", origNavigator);
-                }
-            });
-
-            it('should ignore printable character key on Edge', function () {
-                window.navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
-                expect(KeyboardUtil.getKey({key: 'a'})).to.be.equal('Unidentified');
-            });
-            it('should allow non-printable character key on Edge', function () {
-                window.navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
-                expect(KeyboardUtil.getKey({key: 'Shift'})).to.be.equal('Shift');
-            });
-            it('should allow printable character key with charCode on Edge', function () {
-                window.navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393";
-                expect(KeyboardUtil.getKey({key: 'a', charCode: 0x61})).to.be.equal('a');
-                expect(KeyboardUtil.getKey({key: 'Unidentified', charCode: 0x61})).to.be.equal('a');
-            });
-        });
     });
 
     describe('getKeysym', function () {
@@ -213,7 +175,6 @@ describe('Helpers', function () {
 
         describe('Numpad', function () {
             it('should handle Numpad numbers', function () {
-                if (browser.isEdge()) this.skip();
                 expect(KeyboardUtil.getKeysym({code: 'Digit5', key: '5', location: 0})).to.be.equal(0x0035);
                 expect(KeyboardUtil.getKeysym({code: 'Numpad5', key: '5', location: 3})).to.be.equal(0xFFB5);
             });
@@ -224,7 +185,6 @@ describe('Helpers', function () {
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: 'Delete', location: 3})).to.be.equal(0xFF9F);
             });
             it('should handle Numpad Decimal key', function () {
-                if (browser.isEdge()) this.skip();
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: '.', location: 3})).to.be.equal(0xFFAE);
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: ',', location: 3})).to.be.equal(0xFFAC);
             });
index 591aa19535e3d3db93b85961412231c7834225b3..1b721e02aa1c033803cfc56696dea7e24c671341 100644 (file)
@@ -1,7 +1,6 @@
 const expect = chai.expect;
 
 import Keyboard from '../core/input/keyboard.js';
-import * as browser from '../core/util/browser.js';
 
 describe('Key Event Handling', function () {
     "use strict";
@@ -20,7 +19,6 @@ describe('Key Event Handling', function () {
 
     describe('Decode Keyboard Events', function () {
         it('should decode keydown events', function (done) {
-            if (browser.isEdge()) this.skip();
             const kbd = new Keyboard(document);
             kbd.onkeyevent = (keysym, code, down) => {
                 expect(keysym).to.be.equal(0x61);
@@ -31,7 +29,6 @@ describe('Key Event Handling', function () {
             kbd._handleKeyDown(keyevent('keydown', {code: 'KeyA', key: 'a'}));
         });
         it('should decode keyup events', function (done) {
-            if (browser.isEdge()) this.skip();
             let calls = 0;
             const kbd = new Keyboard(document);
             kbd.onkeyevent = (keysym, code, down) => {
@@ -125,9 +122,6 @@ describe('Key Event Handling', function () {
         });
 
         describe('suppress the right events at the right time', function () {
-            beforeEach(function () {
-                if (browser.isEdge()) this.skip();
-            });
             it('should suppress anything with a valid key', function () {
                 const kbd = new Keyboard(document, {});
                 const evt1 = keyevent('keydown', {code: 'KeyA', key: 'a'});
@@ -156,7 +150,6 @@ describe('Key Event Handling', function () {
 
     describe('Fake keyup', function () {
         it('should fake keyup events for virtual keyboards', function (done) {
-            if (browser.isEdge()) this.skip();
             let count = 0;
             const kbd = new Keyboard(document);
             kbd.onkeyevent = (keysym, code, down) => {
@@ -178,9 +171,6 @@ describe('Key Event Handling', function () {
     });
 
     describe('Track Key State', function () {
-        beforeEach(function () {
-            if (browser.isEdge()) this.skip();
-        });
         it('should send release using the same keysym as the press', function (done) {
             const kbd = new Keyboard(document);
             kbd.onkeyevent = (keysym, code, down) => {