fingerprintjs2
Advanced tools
Comparing version 1.8.1 to 1.8.4
@@ -119,2 +119,8 @@ /* | ||
var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext | ||
if (AudioContext === null) { | ||
keys.addPreprocessedComponent({key: 'audio_fp', value: null}) | ||
return done(keys) | ||
} | ||
var context = new AudioContext(1, 44100, 44100) | ||
@@ -176,3 +182,3 @@ | ||
// IE 9,10 on Windows 10 does not have the `navigator.language` property any longer | ||
keys.addPreprocessedComponent({ key: 'language', value: navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || '' }) | ||
keys.addPreprocessedComponent({key: 'language', value: navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || ''}) | ||
} | ||
@@ -179,0 +185,0 @@ return keys |
{ | ||
"name": "fingerprintjs2", | ||
"version": "1.8.1", | ||
"version": "1.8.4", | ||
"description": "Modern & flexible browser fingerprinting library", | ||
@@ -5,0 +5,0 @@ "repository": { |
/* global jasmine, describe, spyOn, it, expect, Fingerprint2 */ | ||
'use strict' | ||
function getComponent(components, key) { | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === key) { | ||
return components[x].value | ||
} | ||
} | ||
throw new Error('Component not found: ' + key) | ||
} | ||
describe('Fingerprint2', function () { | ||
@@ -156,9 +166,4 @@ describe('new', function () { | ||
it('checks if js_fonts component is array', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'js_fonts') { | ||
expect(components[x].value).toBeArray() | ||
} | ||
} | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'js_fonts')).toBeArray() | ||
done() | ||
@@ -180,7 +185,4 @@ }) | ||
var baseFonts = ['monospace', 'sans-serif', 'serif'] | ||
var ctr = 0 | ||
for (var _ in baseFonts) { | ||
(() => 'ignored')(_) | ||
ctr++ | ||
} | ||
// eslint-disable-next-line | ||
var ctr = 0; for (var _ in baseFonts) { ctr++ } | ||
@@ -267,28 +269,7 @@ expect(baseFonts.length).toEqual(3) | ||
it('checks audio fingerprint', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
var audioFp = null | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'audio_fp') { | ||
audioFp = components[x].value | ||
} | ||
} | ||
expect(audioFp).not.toBeNull() | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'audio_fp')).not.toBeNull() | ||
done() | ||
}) | ||
}) | ||
it('checks exclude audio fingerprint', function (done) { | ||
var fp2 = new Fingerprint2({excludeAudioFP: true}) | ||
fp2.get(function (result, components) { | ||
var audioFp = null | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'audio_fp') { | ||
audioFp = components[x].value | ||
} | ||
} | ||
expect(audioFp).toBeNull() | ||
done() | ||
}) | ||
}) | ||
}) | ||
@@ -344,13 +325,7 @@ | ||
fp2.get(function (result, components) { | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'webgl') { | ||
fp2.each(webglExpectedArray, function (item) { | ||
expect(components[x].value.indexOf(item)).not.toEqual(-1) | ||
}) | ||
done() | ||
return | ||
} | ||
} | ||
done.fail() | ||
fp2.get(function (_, components) { | ||
fp2.each(webglExpectedArray, function (item) { | ||
expect(getComponent(components, 'webgl').indexOf(item)).not.toEqual(-1) | ||
}) | ||
done() | ||
}) | ||
@@ -362,12 +337,5 @@ }) | ||
it('checks that preprocessor not used by default', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'user_agent') { | ||
expect(components[x].value).not.toEqual('MyUserAgent') | ||
done() | ||
return | ||
} | ||
} | ||
done.fail() | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'user_agent')).not.toEqual('MyUserAgent') | ||
done() | ||
}) | ||
@@ -382,16 +350,8 @@ }) | ||
} | ||
return value | ||
} | ||
} | ||
var fp2 = new Fingerprint2(options) | ||
fp2.get(function (result, components) { | ||
for (var x = 0; x < components.length; x++) { | ||
if (components[x].key === 'user_agent') { | ||
expect(components[x].value).toEqual('MyUserAgent') | ||
done() | ||
return | ||
} | ||
} | ||
done.fail() | ||
(new Fingerprint2(options)).get(function (_, components) { | ||
expect(getComponent(components, 'user_agent')).toEqual('MyUserAgent') | ||
done() | ||
}) | ||
@@ -398,0 +358,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331526
6845