Skip to content

Commit

Permalink
fix: remove support of jsVersion configuration property (#3002)
Browse files Browse the repository at this point in the history
Fixes #2911
  • Loading branch information
lusarz authored and johnjbarton committed May 15, 2018
1 parent 57b7938 commit 2bb4e36
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 43 deletions.
12 changes: 0 additions & 12 deletions docs/config/01-configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions lib/middleware/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand All @@ -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(/\?.*/, '')
Expand Down Expand Up @@ -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))
}
Expand Down
2 changes: 0 additions & 2 deletions test/client/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ module.exports = function (config) {

forceJSONP: true,

jsVersion: 0,

browserStack: {
project: 'Karma'
}
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/tag.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -72,4 +70,3 @@ Feature: JavaScript Tag
.
Chrome
"""

0 comments on commit 2bb4e36

Please sign in to comment.