• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

collab-project / videojs-record / 8311686434

17 Mar 2024 12:41AM UTC coverage: 71.152% (+1.3%) from 69.859%
8311686434

push

github

web-flow
build(deps-dev): bump follow-redirects from 1.15.5 to 1.15.6 (#715)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

372 of 581 branches covered (64.03%)

Branch coverage included in aggregate %.

839 of 1121 relevant lines covered (74.84%)

38.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.33
/src/js/utils/detect-browser.js
1
/**
2
 * @file detect-browser.js
3
 * @since 2.0.0
4
 */
5

6
import window from 'global/window';
7

8
/**
9
 * Browser detector.
10
 *
11
 * @private
12
 * @return {object} result containing browser, version and minVersion
13
 *     properties.
14
 */
15
const detectBrowser = function() {
1✔
16
    // returned result object
17
    let result = {};
11✔
18
    result.browser = null;
11✔
19
    result.version = null;
11✔
20
    result.minVersion = null;
11✔
21

22
    // fail early if it's not a browser
23
    if (typeof window === 'undefined' || !window.navigator) {
11!
24
        result.browser = 'Not a supported browser.';
×
25
        return result;
×
26
    }
27

28
    if (navigator.mozGetUserMedia) { // Firefox.
11!
29
        result.browser = 'firefox';
×
30
        result.version = extractVersion(navigator.userAgent,
×
31
            /Firefox\/(\d+)\./, 1);
32
        result.minVersion = 31;
×
33
    } else if (navigator.webkitGetUserMedia) {
11!
34
        // Chrome, Chromium, Webview, Opera.
35
        // Version matches Chrome/WebRTC version.
36
        result.browser = 'chrome';
11✔
37
        result.version = extractVersion(navigator.userAgent,
11✔
38
            /Chrom(e|ium)\/(\d+)\./, 2); // buddy ignore:line
39
        result.minVersion = 38;
11✔
40
    } else if (navigator.mediaDevices &&
×
41
               navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) { // Edge.
42
        result.browser = 'edge';
×
43
        result.version = extractVersion(navigator.userAgent,
×
44
            /Edge\/(\d+).(\d+)$/, 2); // buddy ignore:line
45
        result.minVersion = 10547;
×
46
    } else if (window.RTCPeerConnection &&
×
47
        navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari.
48
        result.browser = 'safari';
×
49
        result.version = extractVersion(navigator.userAgent,
×
50
            /AppleWebKit\/(\d+)\./, 1);
51
    } else {
52
        // Default fallthrough: not supported.
53
        result.browser = 'Not a supported browser.';
×
54
        return result;
×
55
    }
56

57
    return result;
11✔
58
};
59

60
/**
61
 * Extract browser version out of the provided user agent string.
62
 *
63
 * @private
64
 * @param {!string} uastring - userAgent string.
65
 * @param {!string} expr - Regular expression used as match criteria.
66
 * @param {!number} pos - position in the version string to be
67
 *     returned.
68
 * @return {!number} browser version.
69
 */
70
const extractVersion = function(uastring, expr, pos) {
1✔
71
    let match = uastring.match(expr);
11✔
72
    return match && match.length >= pos && parseInt(match[pos], 10); // buddy ignore:line
11✔
73
};
74

75
const isEdge = function() {
1✔
76
    return detectBrowser().browser === 'edge';
×
77
};
78

79
const isSafari = function() {
1✔
80
    return detectBrowser().browser === 'safari';
×
81
};
82

83
const isOpera = function() {
1✔
84
    return !!window.opera || navigator.userAgent.indexOf('OPR/') !== -1;
×
85
};
86

87
const isChrome = function() {
1✔
88
    return detectBrowser().browser === 'chrome';
×
89
};
90

91
const isFirefox = function() {
1✔
92
    return detectBrowser().browser === 'firefox';
6✔
93
};
94

95
export {
96
    detectBrowser, isEdge, isOpera, isChrome, isSafari, isFirefox
97
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc