From f4323d6dbead27d1d539309111992845e1cad1ae Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 20 Jan 2024 22:45:50 +0700 Subject: [PATCH] remove MSIE workarounds --- html5/js/Client.js | 34 +++++++--------------------------- html5/js/MediaSourceUtil.js | 8 -------- html5/js/lib/detect-zoom.js | 37 +------------------------------------ html5/js/lib/rencode.js | 11 +---------- 4 files changed, 9 insertions(+), 81 deletions(-) diff --git a/html5/js/Client.js b/html5/js/Client.js index 080ca3db..fb3011f5 100644 --- a/html5/js/Client.js +++ b/html5/js/Client.js @@ -1011,11 +1011,6 @@ class XpraClient { } _keyb_process(pressed, event) { - // MSIE hack - return this.do_keyb_process(pressed, event || window.event); - } - - do_keyb_process(pressed, event) { if (this.server_readonly) { return true; } @@ -1999,10 +1994,6 @@ class XpraClient { init_clipboard() { window.addEventListener("paste", (e) => { let clipboardData = (e.originalEvent || e).clipboardData; - //IE: must use window.clipboardData because the event clipboardData is null! - if (!clipboardData) { - clipboardData = window.clipboardData; - } if ( clipboardData && clipboardData.files && @@ -2095,7 +2086,6 @@ class XpraClient { ", buffer=", clipboard_buffer ); - //for IE: let success = false; if ( Object.hasOwn(window, "clipboardData") && @@ -2103,11 +2093,7 @@ class XpraClient { typeof window.clipboardData.setData === "function" ) { try { - if (Utilities.isIE()) { - window.clipboardData.setData("Text", clipboard_buffer); - } else { - window.clipboardData.setData(clipboard_datatype, clipboard_buffer); - } + window.clipboardData.setData(clipboard_datatype, clipboard_buffer); success = true; } catch { success = false; @@ -2142,16 +2128,9 @@ class XpraClient { //fallback code for legacy mode: let datatype = TEXT_PLAIN; let clipboardData = (e.originalEvent || e).clipboardData; - //IE: must use window.clipboardData because the event clipboardData is null! if (!clipboardData) { - clipboardData = window.clipboardData; - if (!clipboardData) { - this.debug("clipboard", "polling: no data available"); - return false; - } - } - if (Utilities.isIE()) { - datatype = "Text"; + this.debug("clipboard", "polling: no data available"); + return false; } const raw_clipboard_buffer = clipboardData.getData(datatype); if (raw_clipboard_buffer === null) { @@ -4415,20 +4394,21 @@ class XpraClient { return this.clipboard_datatype; } - send_clipboard_token(data) { + send_clipboard_token(data, data_format) { if (!this.clipboard_enabled || !this.connected) { return; } - this.debug("clipboard", "sending clipboard token with data:", data); const claim = true; //Boolean(navigator.clipboard && navigator.clipboard.readText && navigator.clipboard.writeText); const greedy = true; const synchronous = true; + const actual_data_format = data_format || [UTF8_STRING, TEXT_PLAIN]; + this.debug("clipboard", "sending clipboard token with data:", data, "as", actual_data_format); let packet; packet = data ? [ "clipboard-token", "CLIPBOARD", - [UTF8_STRING, TEXT_PLAIN], + actual_data_format, UTF8_STRING, UTF8_STRING, 8, diff --git a/html5/js/MediaSourceUtil.js b/html5/js/MediaSourceUtil.js index 60112e09..ddb79109 100644 --- a/html5/js/MediaSourceUtil.js +++ b/html5/js/MediaSourceUtil.js @@ -115,10 +115,6 @@ const MediaSourceUtil = { }, getAuroraAudioCodecs() { - //IE is totally useless: - if (Utilities.isIE()) { - return {}; - } const codecs_supported = new Map(); const codecs_failed = new Map(); if (AV && AV.Decoder && AV.Decoder.find) { @@ -144,10 +140,6 @@ const MediaSourceUtil = { Utilities.log("audio forwarding: no media source API support"); return []; } - //IE is totally useless: - if (Utilities.isIE()) { - return []; - } const codecs_supported = []; const codecs_failed = {}; for (const codec_option in MediaSourceConstants.CODEC_STRING) { diff --git a/html5/js/lib/detect-zoom.js b/html5/js/lib/detect-zoom.js index bdb2a18a..4ec07744 100644 --- a/html5/js/lib/detect-zoom.js +++ b/html5/js/lib/detect-zoom.js @@ -43,33 +43,6 @@ devicePxPerCssPx: 1 }; }; - /** - * IE 8 and 9: no trick needed! - * TODO: Test on IE10 and Windows 8 RT - * @return {Object} - * @private - **/ - var ie8 = function () { - var zoom = Math.round((screen.deviceXDPI / screen.logicalXDPI) * 100) / 100; - return { - zoom: zoom, - devicePxPerCssPx: zoom * devicePixelRatio() - }; - }; - - /** - * For IE10 we need to change our technique again... - * thanks https://github.com/stefanvanburen - * @return {Object} - * @private - */ - var ie10 = function () { - var zoom = Math.round((document.documentElement.offsetHeight / window.innerHeight) * 100) / 100; - return { - zoom: zoom, - devicePxPerCssPx: zoom * devicePixelRatio() - }; - }; /** * For chrome @@ -271,16 +244,8 @@ */ var detectFunction = (function () { var func = fallback; - //IE8+ - if (!isNaN(screen.logicalXDPI) && !isNaN(screen.systemXDPI)) { - func = ie8; - } - // IE10+ / Touch - else if (window.navigator.msMaxTouchPoints) { - func = ie10; - } //chrome - else if(!!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' Opera') >= 0)){ + if(!!window.chrome && !(!!window.opera || navigator.userAgent.indexOf(' Opera') >= 0)){ func = chrome; } //safari diff --git a/html5/js/lib/rencode.js b/html5/js/lib/rencode.js index 3201d4b7..23e82807 100644 --- a/html5/js/lib/rencode.js +++ b/html5/js/lib/rencode.js @@ -365,16 +365,7 @@ function rdecode_intl(dec) { function rdecode_intq(dec) { const slice = dec.buf.slice(dec.pos+1, dec.pos+9) const dv = new DataView(slice.buffer); - let s = 0; - if ("getBigInt64" in DataView.prototype) { - s = dv.getBigInt64(0); - } - else { - //oh, IE... - const left = dv.getInt32(0); - const right = dv.getUint32(4); - s = 2**32*left + right; - } + const s = dv.getBigInt64(0); dec.pos += 9; if (!Number.isSafeInteger(s)) { //console.warn("value is not a safe integer: ", s);