From 54bee72bef2077b76cbdf31c54962c0a34c25fce Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Fri, 3 Nov 2023 09:16:13 +0000 Subject: [PATCH] Remove outdated browser workarounds Remove workarounds for bugs in Firefox 22 and Safari 5. --- lib/SugarClient/primus.js | 42 --------------------------------------- 1 file changed, 42 deletions(-) diff --git a/lib/SugarClient/primus.js b/lib/SugarClient/primus.js index 4aa3924..e317b13 100644 --- a/lib/SugarClient/primus.js +++ b/lib/SugarClient/primus.js @@ -3782,48 +3782,6 @@ Primus.prototype.decoder = function decoder(data, fn) { }; Primus.prototype.version = "8.0.8"; -if ( - 'undefined' !== typeof document - && 'undefined' !== typeof navigator -) { - // - // Hack 2: If you press ESC in FireFox it will close all active connections. - // Normally this makes sense, when your page is still loading. But versions - // before FireFox 22 will close all connections including WebSocket connections - // after page load. One way to prevent this is to do a `preventDefault()` and - // cancel the operation before it bubbles up to the browsers default handler. - // It needs to be added as `keydown` event, if it's added keyup it will not be - // able to prevent the connection from being closed. - // - if (document.addEventListener) { - document.addEventListener('keydown', function keydown(e) { - if (e.keyCode !== 27 || !e.preventDefault) return; - - e.preventDefault(); - }, false); - } - - // - // Hack 3: This is a Mac/Apple bug only, when you're behind a reverse proxy or - // have you network settings set to `automatic proxy discovery` the safari - // browser will crash when the WebSocket constructor is initialised. There is - // no way to detect the usage of these proxies available in JavaScript so we - // need to do some nasty browser sniffing. This only affects Safari versions - // lower then 5.1.4 - // - var ua = (navigator.userAgent || '').toLowerCase() - , parsed = ua.match(/.+(?:rv|it|ra|ie)[/: ](\d+)\.(\d+)(?:\.(\d+))?/) || [] - , version = +[parsed[1], parsed[2]].join('.'); - - if ( - !~ua.indexOf('chrome') - && ~ua.indexOf('safari') - && version < 534.54 - ) { - Primus.prototype.AVOID_WEBSOCKETS = true; - } -} - // // Expose the library. //