Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
Don't mark Firefox as a mobile in Windows XP.
Browse files Browse the repository at this point in the history
Thanks to @connor-prodege for spotting this issue. Fixes #15
  • Loading branch information
mssola committed Aug 21, 2014
1 parent 79de7b2 commit 7edd344
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var uastrings = []struct {
{"AndroidFirefoxTablet", "Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0"},
{"FirefoxOS", "Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0"},
{"FirefoxOSTablet", "Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0"},
{"FirefoxWinXP", "Mozilla/5.0 (Windows NT 5.2; rv:31.0) Gecko/20100101 Firefox/31.0"},

// Opera
{"OperaMac", "Opera/9.27 (Macintosh; Intel Mac OS X; U; en)"},
Expand Down Expand Up @@ -128,6 +129,7 @@ var expected = []string{
"Mozilla:5.0 Platform:Tablet OS:Android Browser:Firefox-26.0 Engine:Gecko-26.0 Bot:false Mobile:true",
"Mozilla:5.0 Platform:Mobile OS:FirefoxOS Browser:Firefox-26.0 Engine:Gecko-26.0 Bot:false Mobile:true",
"Mozilla:5.0 Platform:Tablet OS:FirefoxOS Browser:Firefox-26.0 Engine:Gecko-26.0 Bot:false Mobile:true",
"Mozilla:5.0 Platform:Windows OS:Windows XP x64 Edition Browser:Firefox-31.0 Engine:Gecko-20100101 Bot:false Mobile:false",

// Opera
"Platform:Macintosh OS:Intel Mac OS X Localization:en Browser:Opera-9.27 Engine:Presto Bot:false Mobile:false",
Expand Down
2 changes: 1 addition & 1 deletion operating_systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func gecko(p *UserAgent, comment []string) {
if p.platform == "Android" {
p.mobile = true
p.platform, p.os = normalizeOS(comment[1]), p.platform
} else if len(comment) < 3 {
} else if comment[0] == "Mobile" || comment[0] == "Tablet" {
p.mobile = true
p.os = "FirefoxOS"
} else {
Expand Down

0 comments on commit 7edd344

Please sign in to comment.