Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove support of jsVersion configuration property (closes #2911) #3002

Merged
merged 1 commit into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
"""