From 2bb4e3691cc79ea7d46096c6cf154e5f3acc82af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Usarz?= Date: Tue, 15 May 2018 18:01:28 +0200 Subject: [PATCH] fix: remove support of jsVersion configuration property (#3002) Fixes #2911 --- docs/config/01-configuration-file.md | 12 ------------ lib/middleware/karma.js | 26 -------------------------- test/client/karma.conf.js | 2 -- test/e2e/tag.feature | 3 --- 4 files changed, 43 deletions(-) diff --git a/docs/config/01-configuration-file.md b/docs/config/01-configuration-file.md index 8b40bbc49..a2bb5f5bb 100644 --- a/docs/config/01-configuration-file.md +++ b/docs/config/01-configuration-file.md @@ -794,18 +794,6 @@ All of Karma's urls get prefixed with the `urlRoot`. This is helpful when using sometimes you might want to proxy a url that is already taken by Karma. -## jsVersion -**Type:** Number - -**Default:** `0` - -**Description:** The JavaScript version to use in the Firefox browser. - -If `> 0`, Karma will add a JavaScript version tag to the included JavaScript files. - -Note: This will only be applied to the Firefox browser up to version 58. Support for JavaScript version was [removed](https://bugzilla.mozilla.org/show_bug.cgi?id=1428745) in Firefox 59. This property is deprecated and will be removed in the next major release of Karma. - - [plugins]: plugins.html [config/files]: files.html [config/browsers]: browsers.html diff --git a/lib/middleware/karma.js b/lib/middleware/karma.js index 4d8d0ea3a..b9d06fcfc 100644 --- a/lib/middleware/karma.js +++ b/lib/middleware/karma.js @@ -14,7 +14,6 @@ var path = require('path') var util = require('util') var url = require('url') -var useragent = require('useragent') var _ = require('lodash') var log = require('../logger').create('middleware:karma') @@ -72,17 +71,6 @@ var getXUACompatibleUrl = function (url) { return value } -var isFirefox = function (req) { - if (!(req && req.headers)) { - return false - } - - // Browser check - var firefox = useragent.is(req.headers['user-agent']).firefox - - return firefox -} - var createKarmaMiddleware = function ( filesPromise, serveStaticFile, @@ -99,7 +87,6 @@ var createKarmaMiddleware = function ( var customContextFile = injector.get('config.customContextFile') var customDebugFile = injector.get('config.customDebugFile') var customClientContextFile = injector.get('config.customClientContextFile') - var jsVersion = injector.get('config.jsVersion') var includeCrossOriginAttribute = injector.get('config.crossOriginAttribute') var requestUrl = request.normalizedUrl.replace(/\?.*/, '') @@ -221,19 +208,6 @@ var createKarmaMiddleware = function ( var scriptFileType = (fileType || fileExt.substring(1)) var scriptType = (SCRIPT_TYPE[scriptFileType] || 'text/javascript') - // In case there is a JavaScript version specified and this is a Firefox browser - if (jsVersion && jsVersion > 0 && isFirefox(request)) { - var agent = useragent.parse(request.headers['user-agent']) - - log.warn('jsVersion configuration property is deprecated and will be removed in the next major release of Karma.') - - if (agent.major < 59) { - scriptType += ';version=' + jsVersion - } else { - log.warn('jsVersion is not supported in Firefox 59+ (see https://bugzilla.mozilla.org/show_bug.cgi?id=1428745 for more details). Ignoring.') - } - } - var crossOriginAttribute = includeCrossOriginAttribute ? CROSSORIGIN_ATTRIBUTE : '' scriptTags.push(util.format(SCRIPT_TAG, scriptType, filePath, crossOriginAttribute)) } diff --git a/test/client/karma.conf.js b/test/client/karma.conf.js index 1ffff3041..4422ca7cb 100644 --- a/test/client/karma.conf.js +++ b/test/client/karma.conf.js @@ -156,8 +156,6 @@ module.exports = function (config) { forceJSONP: true, - jsVersion: 0, - browserStack: { project: 'Karma' } diff --git a/test/e2e/tag.feature b/test/e2e/tag.feature index 63c3ff35a..960fa0f10 100644 --- a/test/e2e/tag.feature +++ b/test/e2e/tag.feature @@ -8,7 +8,6 @@ Feature: JavaScript Tag """ files = ['tag/tag.js', 'tag/test-with-version.js']; browsers = ['Firefox'] - jsVersion = 1.8 plugins = [ 'karma-jasmine', 'karma-firefox-launcher' @@ -26,7 +25,6 @@ Feature: JavaScript Tag """ files = ['tag/tag.js', 'tag/test-with-version.js']; browsers = ['Chrome']; - jsVersion = 1.8; plugins = [ 'karma-jasmine', 'karma-chrome-launcher' @@ -72,4 +70,3 @@ Feature: JavaScript Tag . Chrome """ - \ No newline at end of file