Skip to content

Commit

Permalink
Parse Headless Chrome versions
Browse files Browse the repository at this point in the history
The initial implementation of the Headless Chrome detection (#228) didn't detect
versions of the headless version. This has been fixed.

A test for Ubuntu Chromium in headless mode was also added. I haven't made it
recognized as HeadlessChromium as it has HeadlessChrome in the user agent. It
might be worthwhile to check how a pure compiled from source Chromium behaves.
Nevertheless, this commit is still an improvement.

Ref #228
Ref karma-runner/karma#2762
  • Loading branch information
mgol committed Nov 8, 2017
1 parent 4673c1c commit 4b92784
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 1 addition & 3 deletions regexes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,7 @@ user_agent_parsers:

# Headless Chrome
# https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
# Currently only available on Linux
- regex: 'HeadlessChrome'
family_replacement: 'HeadlessChrome'
- regex: '(HeadlessChrome)(?:/(\d+)\.(\d+)\.(\d+))?'

# Browser/major_version.minor_version
- regex: '(bingbot|Bolt|AdobeAIR|Jasmine|IceCat|Skyfire|Midori|Maxthon|Lynx|Arora|IBrowse|Dillo|Camino|Shiira|Fennec|Phoenix|Flock|Netscape|Lunascape|Epiphany|WebPilot|Opera Mini|Opera|NetFront|Netfront|Konqueror|Googlebot|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|iCab|iTunes|MacAppStore|NetNewsWire|Space Bison|Stainless|Orca|Dolfin|BOLT|Minimo|Tizen Browser|Polaris|Abrowser|Planetweb|ICE Browser|mDolphin|qutebrowser|Otter|QupZilla|MailBar|kmail2|YahooMobileMail|ExchangeWebServices|ExchangeServicesClient|Dragon|Outlook-iOS-Android)/(\d+)\.(\d+)(?:\.(\d+))?'
Expand Down
12 changes: 12 additions & 0 deletions tests/test_ua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6699,6 +6699,18 @@ test_cases:
minor:
patch:

- user_agent_string: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/62.0.3202.89 Safari/537.36'
family: 'HeadlessChrome'
major: '62'
minor: '0'
patch: '3202'

- user_agent_string: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/59.0.3071.109 HeadlessChrome/59.0.3071.109 Safari/537.36'
family: 'HeadlessChrome'
major: '59'
minor: '0'
patch: '3071'

- user_agent_string: 'Roku/DVP-6.2 (096.02E06005A)'
family: 'Roku'
major: '6'
Expand Down

0 comments on commit 4b92784

Please sign in to comment.