Last Comment Bug 581783 - Remove "Windows;" from the UA string
: Remove "Windows;" from the UA string
Status: RESOLVED FIXED
[parity-IE][parity-opera]
: perf
Product: Core
Classification: Components
Component: Networking: HTTP (show other bugs)
: Trunk
: All Windows XP
-- normal with 1 vote (vote)
: mozilla2.0b4
Assigned To: Dão Gottwald [:dao]
:
: Patrick McManus [:mcmanus]
Mentors:
Depends on: 637395
Blocks: http-fingerprint 586165 589353
  Show dependency treegraph
 
Reported: 2010-07-25 02:46 PDT by Dão Gottwald [:dao]
Modified: 2011-02-28 12:52 PST (History)
21 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (2.43 KB, patch)
2010-07-25 06:46 PDT, Dão Gottwald [:dao]
bzbarsky: review+
mbeltzner: approval2.0+
Details | Diff | Splinter Review

Description User image Dão Gottwald [:dao] 2010-07-25 02:46:50 PDT
The "Windows;" token is useless, as it's always followed by "Windows Foo..." (where "Foo" usually is "NT"). UA string parsers are unlikely to look for "Windows;" including the semi-colon, because:

IE apparently dropped "Windows;" with IE8:
http://www.useragentstring.com/pages/Internet%20Explorer/

Opera never had it, except when it claims to be gecko or webkit:
http://www.useragentstring.com/pages/Opera/
Comment 1 User image Dave Garrett 2010-07-25 06:29:23 PDT
And with Linux it always has "X11;" and with Mac OS X it always has "Macintosh;". The leading platform token is redundant for pretty much everyone and is more obviously redundant with the removal with the intervening "U;". It's probably best to remove this token for everyone. If there is a platform that actually does need it, then for that one it can be merged into the OS/CPU part.

All current possibilities for this platform token:
/netwerk/protocol/http/nsHttpHandler.cpp
687     mPlatform.AssignLiteral(
688 #if defined(ANDROID)
689     "Android"
690 #elif defined(XP_OS2)
691     "OS/2"
692 #elif defined(XP_WIN)
693     "Windows"
694 #elif defined(XP_MACOSX)
695     "Macintosh"
696 #elif defined(XP_BEOS)
697     "BeOS"
698 #elif defined(MOZ_X11)
699     "X11"
700 #else
701     "?"
702 #endif
703     );
Comment 2 User image Dão Gottwald [:dao] 2010-07-25 06:37:16 PDT
The difference is that sniffers looking for X11 or Macintosh won't find it in the OS_CPU token. So that stuff deserves a separate bug.
Comment 3 User image Dão Gottwald [:dao] 2010-07-25 06:46:01 PDT
Created attachment 460143 [details] [diff] [review]
patch
Comment 4 User image Dão Gottwald [:dao] 2010-07-25 06:50:32 PDT
(In reply to comment #2)
> The difference is that sniffers looking for X11 or Macintosh won't find it in
> the OS_CPU token. So that stuff deserves a separate bug.

Also note that Opera used to include Macintosh and X11 despite the omission of Windows. However, they seem to have dropped X11 recently. Not sure about Macintosh.
Comment 5 User image Dave Garrett 2010-07-25 07:06:45 PDT
Hiding this just for Windows would lead to an inconsistent UA across platforms with a different number of tokens on different OSes, possibly leading to inconsistent parsing. Just removing the "Windows;" itself may break some UA parsing if OS checking is simply done by the first token, so it makes sense to break it for everyone at once and remove all the redundant data for everyone.
Comment 6 User image Dão Gottwald [:dao] 2010-07-25 07:53:08 PDT
Sniffers cannot make sane assumptions about the number of tokens. It isn't fixed for Gecko (e.g. because of the 64bit stuff), we've already reduced the average token count from previous releases, and it greatly varies across browsers. With that in mind, see comment 2 and comment 4.
Comment 7 User image rsx11m 2010-07-25 10:37:16 PDT
The "X11" token is used for UNIX platforms as well, thus a general indicator
for the window system used. Strictly speaking, you could also run an X11 server on a Windows platform, though I don't think anybody would run a modified Gecko application on top of it.
Comment 8 User image philippe (part-time) 2010-07-25 18:43:39 PDT
(In reply to comment #4)

> Also note that Opera used to include Macintosh and X11 despite the omission of
> Windows. However, they seem to have dropped X11 recently. Not sure about
> Macintosh.

Opera 10.6 Mac:
Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.6.30 Version/10.60

(I am all in favour of dropping 'Macintosh' - it is useless, along with 'PPC/Intel' and the OS X version)
Comment 9 User image Smokey Ardisson (offline for a while; not following bugs - do not email) 2010-07-27 12:42:34 PDT
(In reply to comment #8)
> (I am all in favour of dropping 'Macintosh' - it is useless, along with
> 'PPC/Intel' and the OS X version)

See also the really awesome bug 414057 :P
Comment 10 User image Boris Zbarsky [:bz] (still a bit busy) 2010-07-28 10:21:49 PDT
Comment on attachment 460143 [details] [diff] [review]
patch

r=bzbarsky
Comment 11 User image Boris Zbarsky [:bz] (still a bit busy) 2010-07-28 10:25:11 PDT
Chris, let the Google folks know?
Comment 12 User image Dão Gottwald [:dao] 2010-07-28 11:31:17 PDT
(In reply to comment #11)
> Chris, let the Google folks know?

Because of bug 579161, I suppose?
Comment 13 User image Boris Zbarsky [:bz] (still a bit busy) 2010-07-28 11:33:19 PDT
Yes.  Apparently their ua parsing is ... fragile.  They asked us to let them know when we make UA changes.
Comment 14 User image Fred Wenzel [:wenzel] 2010-07-28 11:54:17 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > (I am all in favour of dropping 'Macintosh' - it is useless, along with
> > 'PPC/Intel' and the OS X version)
> 
> See also the really awesome bug 414057 :P

I can't believe I am asking this: If we don't like the OSX version, why do we keep the Windows version in there?
Comment 15 User image Dão Gottwald [:dao] 2010-07-28 11:59:41 PDT
Because that would be controversial whereas removing the redundant "Windows;" token is not. I think bug 57555 covers the Windows version.
Comment 16 User image Christopher Blizzard (:blizzard) 2010-07-28 12:21:36 PDT
I'll let them know once we're done making changes.  Until then it's just churn.
Comment 17 User image Benjamin Smedberg [:bsmedberg] 2010-07-29 10:21:16 PDT
Has everyone decided how much UA fiddling are we going to do? I'd like to land and message it all at once, rather than piecemeal.
Comment 18 User image Dão Gottwald [:dao] 2010-07-29 10:28:49 PDT
I don't think more changes are going to happen soon. I don't see other low hanging fruits. Bug 414057, bug 527886, bug 572659, bug 572661 and bug 572665 all seem controversial and don't have owners. I'd like to get bug 581008 done, but that wouldn't affect the default string.
Comment 19 User image Mike Beltzner [:beltzner, not reading bugmail] 2010-08-03 11:17:07 PDT
Comment on attachment 460143 [details] [diff] [review]
patch

a=beltzner for when the tree re-opens, we may have to back this out if it causes a ton of problems
Comment 20 User image Dão Gottwald [:dao] 2010-08-05 03:26:32 PDT
http://hg.mozilla.org/mozilla-central/rev/35b64ad7910c
Comment 21 User image Daniel Veditz [:dveditz] 2010-08-20 18:50:38 PDT
(In reply to comment #7)
> The "X11" token
... and lots of other "token" talk.

These are tokens only in our own minds. The UA spec has product tokens and paren-delimited free-form "comments". We (and other vendors) can sprinkle ';' all we like in the comment for readability, but there's nothing special about having fewer or more of these non-token "tokens". A shorter UA is appreciated, however.
Comment 22 User image rsx11m 2010-08-20 18:56:20 PDT
The other platform-specific "comment items" [ better? ;-) ] are now handled in bug 589353 with a suggestion to make the order and content more consistent.

Note You need to log in before you can comment on or make changes to this bug.