From ec586b11a78f4334f7407d4ca550a4ee322894ee Mon Sep 17 00:00:00 2001 From: Tutik Alexsandr Date: Thu, 17 Mar 2022 21:48:20 +0300 Subject: [PATCH] feat(client) detect browser: Firefox Rocket issue #7039 --- Parser/Client/Browser.php | 3 ++- Tests/Parser/Client/fixtures/browser.yml | 26 ++++++++++++++++++++++-- regexes/client/browsers.yml | 2 +- regexes/client/hints/browsers.yml | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Parser/Client/Browser.php b/Parser/Client/Browser.php index b9c3fcfee1..d268b9e990 100644 --- a/Parser/Client/Browser.php +++ b/Parser/Client/Browser.php @@ -672,10 +672,11 @@ public function parse(): ?array $name = $appHash['name']; $version = ''; $short = self::getBrowserShortName($name); + $family = self::getBrowserFamily((string) $short); if (\preg_match('~Chrome/.+ Safari/537.36~i', $this->userAgent)) { $engine = 'Blink'; - $family = 'Chrome'; + $family = $family ?? 'Chrome'; $engineVersion = ''; } diff --git a/Tests/Parser/Client/fixtures/browser.yml b/Tests/Parser/Client/fixtures/browser.yml index 38c4d1a626..1730fcff2d 100644 --- a/Tests/Parser/Client/fixtures/browser.yml +++ b/Tests/Parser/Client/fixtures/browser.yml @@ -1877,8 +1877,8 @@ type: browser name: Firefox Rocket version: "1.6.2" - engine: WebKit - engine_version: "537.36" + engine: Blink + engine_version: "" family: Firefox - user_agent: Mozilla/5.0 Linux; Android 8.0.0 AppleWebKit/537.36 KHTML, like Gecko Version/4.0 Web Explorer/2.6.6 Chrome/75.0.3770.143 Mobile Safari/537.36 @@ -4966,3 +4966,25 @@ family: Chrome headers: X-Requested-With: nextapp.atlas +- + user_agent: Mozilla/5.0 (Linux; Android 11; SM-T725 Build/RP1A.200720.012; rv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Rocket/2.6.0(20651) Chrome/87.0.4280.141 Safari/537.36 + client: + type: browser + name: Firefox Rocket + version: 2.6.0 + engine: Blink + engine_version: "" + family: Firefox + headers: + X-Requested-With: org.mozilla.rocket +- + user_agent: Mozilla/5.0 (Linux; Android 11; SM-A025F Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/94.0.4606.61 Mobile Safari/537.36 + client: + type: browser + name: Firefox Rocket + version: "" + engine: Blink + engine_version: "" + family: Firefox + headers: + X-Requested-With: org.mozilla.rocket diff --git a/regexes/client/browsers.yml b/regexes/client/browsers.yml index ecf4922f2a..fdb96fd61b 100644 --- a/regexes/client/browsers.yml +++ b/regexes/client/browsers.yml @@ -1809,7 +1809,7 @@ name: 'Firefox Rocket' version: '$1' engine: - default: 'WebKit' + default: 'Blink' # Web Explorer - regex: 'Web Explorer/(\d+[\.\d]+).*Chrome' diff --git a/regexes/client/hints/browsers.yml b/regexes/client/hints/browsers.yml index 5ad9be1ccc..cf1b8995f7 100644 --- a/regexes/client/hints/browsers.yml +++ b/regexes/client/hints/browsers.yml @@ -38,3 +38,4 @@ 'com.dolphin.browser.zero': 'Dolphin Zero' 'mobi.mgeek.TunnyBrowser': 'Dolphin' # Dolphin + AdBlock 'nextapp.atlas': 'Atlas' +'org.mozilla.rocket': 'Firefox Rocket' # Firefox Lite