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

Parse Headless Chrome versions #263

Merged
merged 2 commits into from
Nov 9, 2017

Conversation

mgol
Copy link
Contributor

@mgol mgol commented Jul 26, 2017

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.

Also, a test for a bare Chrome 60 instance was added.

This PR is needed to resolve karma-runner/karma#2762

@the-spyke
Copy link

@elsigh May you give any timing on merging this? Thank you.

@@ -6657,11 +6657,17 @@ test_cases:
minor: '7'
patch: '10'

- user_agent_string: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This testcase has been deleted. Is there a reason for this?
Please put it in again. Thx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a version that would have HeadlessChrome without a version. My regex would fail then. Can both scenarios be handled? Should there be two regexes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rogeriopvl used the UA without Version in his tests. So he got this string from that version. That is what is now fixed in the tests, and we should not change those. Indeed you'll need to change your rexeg maybe this does the job: (With this we could get rid of the family_replacement line)

  - regex: '(HeadlessChrome)(?:/(\d+)\.(\d+)\.?(\d+)?)?'

Please check with current UA and your new ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@commenthol The version-less UA string now passes the regex as well.

@mgol mgol force-pushed the headless-chrome-version branch from ceb0e71 to a1f710a Compare November 8, 2017 11:28
@mgol
Copy link
Contributor Author

mgol commented Nov 8, 2017

PR updated. The version-less HeadlessChrome is supported again. PTAL.

mgol added 2 commits November 8, 2017 12:30
The initial implementation of the Headless Chrome detection (ua-parser#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 ua-parser#228
Ref karma-runner/karma#2762
@mgol mgol force-pushed the headless-chrome-version branch from a1f710a to 8d5b307 Compare November 8, 2017 11:31
@commenthol commenthol merged commit 7e5b0c6 into ua-parser:master Nov 9, 2017
@commenthol
Copy link
Contributor

Thanks

@commenthol commenthol removed the invalid label Nov 9, 2017
@mgol mgol deleted the headless-chrome-version branch November 9, 2017 23:46
rkuzsma added a commit to rkuzsma/karma that referenced this pull request Nov 3, 2018
Bump useragent 2.3.0 to pull in ua-parser/uap-core#263
Fixes [karma-runner#2762](karma-runner#2762) Headless Chrome version detected to be 0.0.0
rkuzsma added a commit to rkuzsma/karma that referenced this pull request Nov 3, 2018
Bump useragent 2.3.0 to pull in ua-parser/uap-core#263 in which Headless Chrome version detected to be 0.0.0.
Update tests to reflect latest useragent OS major version string identifiers.
Fixes karma-runner#2762
rkuzsma added a commit to rkuzsma/karma that referenced this pull request Nov 3, 2018
Bump useragent 2.3.0 to pull in ua-parser/uap-core#263 in which Headless Chrome version detected to be 0.0.0.
Update tests to reflect latest useragent OS major version string identifiers.
Fixes karma-runner#2762
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Headless Chrome version detected to be 0.0.0
3 participants