From cf33f405d068dd74ef0f834de1cb34f786f88d49 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Thu, 21 Jan 2021 22:03:21 -0500 Subject: [PATCH 1/3] fix: remove template literal that breaks old browsers --- static/karma.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/karma.js b/static/karma.js index 8c08d3fca..456673542 100644 --- a/static/karma.js +++ b/static/karma.js @@ -201,7 +201,7 @@ function Karma (updater, socket, iframe, opener, navigator, location, document) } socket.emit('karma_error', message) - self.updater.updateTestStatus(`karma_error ${message}`) + self.updater.updateTestStatus('karma_error ' + message) this.complete() return false } From b4cce5a49b5244e7a7affb718b2c9ddf31e8bd26 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Thu, 21 Jan 2021 22:08:28 -0500 Subject: [PATCH 2/3] fix: also fix client/karma.js --- client/karma.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/karma.js b/client/karma.js index 0734822ff..f9c4c4e96 100644 --- a/client/karma.js +++ b/client/karma.js @@ -191,7 +191,7 @@ function Karma (updater, socket, iframe, opener, navigator, location, document) } socket.emit('karma_error', message) - self.updater.updateTestStatus(`karma_error ${message}`) + self.updater.updateTestStatus('karma_error ' + message) this.complete() return false } From 45ec35e6e9332b94f20337b67cc20e9f7f324f15 Mon Sep 17 00:00:00 2001 From: Long Ho Date: Thu, 21 Jan 2021 22:30:36 -0500 Subject: [PATCH 3/3] fix: convert more client files to ES5 --- client/karma.js | 5 +++-- client/updater.js | 22 +++++++++++----------- static/karma.js | 27 ++++++++++++++------------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/client/karma.js b/client/karma.js index f9c4c4e96..20a5e19e0 100644 --- a/client/karma.js +++ b/client/karma.js @@ -240,8 +240,9 @@ function Karma (updater, socket, iframe, opener, navigator, location, document) // A test could have incorrectly issued a navigate. Wait one turn // to ensure the error from an incorrect navigate is processed. - setTimeout(() => { - if (this.config.clearContext) { + var config = this.config + setTimeout(function () { + if (config.clearContext) { navigateContextTo('about:blank') } diff --git a/client/updater.js b/client/updater.js index 3365b5253..569709e3d 100644 --- a/client/updater.js +++ b/client/updater.js @@ -29,7 +29,7 @@ function StatusUpdater (socket, titleElement, bannerElement, browsersElement) { if (!titleElement || !bannerElement) { return } - titleElement.textContent = `Karma v ${VERSION} - ${connectionText}; test: ${testText}; ${pingText}` + titleElement.textContent = 'Karma v ' + VERSION + ' - ' + connectionText + '; test: ' + testText + '; ' + pingText bannerElement.className = connectionText === 'connected' ? 'online' : 'offline' } @@ -46,32 +46,32 @@ function StatusUpdater (socket, titleElement, bannerElement, browsersElement) { updateBanner() } - socket.on('connect', () => { + socket.on('connect', function () { updateConnectionStatus('connected') }) - socket.on('disconnect', () => { + socket.on('disconnect', function () { updateConnectionStatus('disconnected') }) - socket.on('reconnecting', (sec) => { - updateConnectionStatus(`reconnecting in ${sec} seconds`) + socket.on('reconnecting', function (sec) { + updateConnectionStatus('reconnecting in ' + sec + ' seconds') }) - socket.on('reconnect', () => { + socket.on('reconnect', function () { updateConnectionStatus('reconnected') }) - socket.on('reconnect_failed', () => { + socket.on('reconnect_failed', function () { updateConnectionStatus('reconnect_failed') }) socket.on('info', updateBrowsersInfo) - socket.on('disconnect', () => { + socket.on('disconnect', function () { updateBrowsersInfo([]) }) - socket.on('ping', () => { + socket.on('ping', function () { updatePingStatus('ping...') }) - socket.on('pong', (latency) => { - updatePingStatus(`ping ${latency}ms`) + socket.on('pong', function (latency) { + updatePingStatus('ping ' + latency + 'ms') }) return { updateTestStatus: updateTestStatus } diff --git a/static/karma.js b/static/karma.js index 456673542..1c1111450 100644 --- a/static/karma.js +++ b/static/karma.js @@ -250,8 +250,9 @@ function Karma (updater, socket, iframe, opener, navigator, location, document) // A test could have incorrectly issued a navigate. Wait one turn // to ensure the error from an incorrect navigate is processed. - setTimeout(() => { - if (this.config.clearContext) { + var config = this.config + setTimeout(function () { + if (config.clearContext) { navigateContextTo('about:blank') } @@ -384,7 +385,7 @@ function StatusUpdater (socket, titleElement, bannerElement, browsersElement) { if (!titleElement || !bannerElement) { return } - titleElement.textContent = `Karma v ${VERSION} - ${connectionText}; test: ${testText}; ${pingText}` + titleElement.textContent = 'Karma v ' + VERSION + ' - ' + connectionText + '; test: ' + testText + '; ' + pingText bannerElement.className = connectionText === 'connected' ? 'online' : 'offline' } @@ -401,32 +402,32 @@ function StatusUpdater (socket, titleElement, bannerElement, browsersElement) { updateBanner() } - socket.on('connect', () => { + socket.on('connect', function () { updateConnectionStatus('connected') }) - socket.on('disconnect', () => { + socket.on('disconnect', function () { updateConnectionStatus('disconnected') }) - socket.on('reconnecting', (sec) => { - updateConnectionStatus(`reconnecting in ${sec} seconds`) + socket.on('reconnecting', function (sec) { + updateConnectionStatus('reconnecting in ' + sec + ' seconds') }) - socket.on('reconnect', () => { + socket.on('reconnect', function () { updateConnectionStatus('reconnected') }) - socket.on('reconnect_failed', () => { + socket.on('reconnect_failed', function () { updateConnectionStatus('reconnect_failed') }) socket.on('info', updateBrowsersInfo) - socket.on('disconnect', () => { + socket.on('disconnect', function () { updateBrowsersInfo([]) }) - socket.on('ping', () => { + socket.on('ping', function () { updatePingStatus('ping...') }) - socket.on('pong', (latency) => { - updatePingStatus(`ping ${latency}ms`) + socket.on('pong', function (latency) { + updatePingStatus('ping ' + latency + 'ms') }) return { updateTestStatus: updateTestStatus }