If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Expose device type in user agent

RESOLVED WONTFIX

Status

()

Core
Networking
--
blocker
RESOLVED WONTFIX
8 years ago
7 years ago

People

(Reporter: dougt, Assigned: dougt)

Tracking

unspecified
Points:
---

Firefox Tracking Flags

(status1.9.2 wontfix)

Details

Attachments

(3 attachments, 3 obsolete attachments)

(Assignee)

Description

8 years ago
I have been working on the improving flash performance in Fennec.  When we spoof Fennec's user agent to match Maemo Browser's user agent, we see a very noticeable performance improvement.  We believe that the Maemo Browser is served video using the optimized Sorenson [1] codec and Fennec is not.

We have asked YouTube to treat Fennec in the same way.  However, our current UA string:

"Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322 Fennec/1.0b4pre"

Does not give YouTube any hint as to when they can serve higher quality video.  One easy thing we can do is to start putting the device model in the user agent.  This doesn't provide all of the nice things that something that UAProf gives you, but also doesn't come with the baggage of RDF, figuring out which URL we should put in our headers, or did I already say RDF?

[1] http://en.wikipedia.org/wiki/Sorenson_codec


This patch will expose device information only on the nokia devices (the n8xx sercies and the n900).  Additional devices can be added simply by putting the right logic in nsSystemInfo.cpp.

I also converted some similar logic in the gfx platform code.

With this patch, our fennec user agent becomes:



"Mozilla/5.0 (X11; U; Linux armv7l; Nokia N900; en-US; rv:1.9.2a1pre) Gecko/20090322 Fennec/1.0b4pre"
(Assignee)

Comment 1

8 years ago
Created attachment 408250 [details] [diff] [review]
patch v.1
Attachment #408250 - Flags: review?(vladimir)
Comment on attachment 408250 [details] [diff] [review]
patch v.1

Looks fine, but if on HILDON, use the N900 as the default variables for DPI and sMaemoClassic?  I don't think that data will get set now unless there's an explicit match.
Attachment #408250 - Flags: review?(vladimir) → review+
(Assignee)

Comment 3

8 years ago
@vlad there are matches now, right?  if you add a new nokia device, you are probably going to want to decide on the DPI and on the sMaemoClassic flag.
(Assignee)

Comment 4

8 years ago
http://hg.mozilla.org/mozilla-central/rev/6ced393c6387
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Updated

8 years ago
Attachment #408250 - Flags: approval1.9.2?

Comment 5

8 years ago
you should take this to bug 517086, where our UA is actually being set for final release.
Bug 517086 is only about adding the "Firefox" part to the UA. This patch tweaks the UA at a different level.
Comment on attachment 408250 [details] [diff] [review]
patch v.1

>+    FILE *fp = fopen ("/proc/component_version", "r");
>+    if (fp) {
>+      while ((read = getline(&line, &len, fp)) != -1) {
>+        if (line) {
>+          if (strstr(line, "RX-51")) {
>+            SetPropertyAsACString(NS_ConvertASCIItoUTF16("device"), NS_LITERAL_CSTRING("Nokia N900"));
>+          } else if (strstr(line, "RX-44") ||
>+                     strstr(line, "RX-48") ||
>+                     strstr(line, "RX-32") ) {
>+            SetPropertyAsACString(NS_ConvertASCIItoUTF16("device"), NS_LITERAL_CSTRING("Nokia N8xx"));

You could break out of the while loop if you found a match

>+      if (line)
>+        free(line);
>+    }

Should you close the file?
(Assignee)

Comment 8

8 years ago
Created attachment 408274 [details] [diff] [review]
close file.
(Assignee)

Updated

8 years ago
Attachment #408274 - Flags: review?(vladimir)
(Assignee)

Comment 9

8 years ago
http://hg.mozilla.org/mozilla-central/rev/c01460b6b02f

We want both on 192
(Assignee)

Updated

8 years ago
Blocks: 524413
(Assignee)

Updated

8 years ago
Attachment #408274 - Flags: review?(vladimir)
Comment on attachment 408250 [details] [diff] [review]
patch v.1

a192=beltzner for this and the close file
Attachment #408250 - Flags: approval1.9.2? → approval1.9.2+
(Assignee)

Comment 11

8 years ago
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/087573e67f1c
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/b80e835e5c7f
status1.9.2: --- → beta1-fixed
Doesn't this make Fennec's UA not follow the spec we have for UA strings (https://developer.mozilla.org/En/User_Agent_Strings_Reference)? OS-or-CPU would be "Linux armv7l; Nokia N900", I think that might trip parsers into treating "Nokia N900" as the Localization Information.
(Assignee)

Comment 13

8 years ago
we probably should update the user agent reference on d.m.o.  I do not think that this is incompatible with any RFC.
Keywords: dev-doc-needed
It's not a matter of RFC; it's a matter of how we've been telling people to write UA analyzers for years.  This change will break those analyzers.  Updating the reference does nothing without rolling out new analyzer software across the whole web to deal with the new format...
(Assignee)

Comment 15

8 years ago
i am open to suggestions on where this sort of information can be placed in the UA.  Maybe at the end?
You can put a VendorComment after your VendorProductToken, right?  Would that do the trick?
The continuing comments here bring me to ask: is this ready to be documented, or are we planning to change how we add the device type to the user-agent string before 1.9.2 is done?
Whiteboard: [doc-waiting-info]
(Assignee)

Comment 18

8 years ago
Created attachment 408883 [details] [diff] [review]
move Device Info to end of UA string
You probably want to put it in parens there, no?
(Assignee)

Comment 20

8 years ago
I am not sure parens add anything.

"Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322 Fennec/1.0b4pre Nokia N900"
Your call.  I was looking at the 

  Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en; rv:2.0) Gecko/25250101
  Netscape/5.432b1 (C-MindSpring)

example in the wiki, which seems to fit best here.
(Assignee)

Comment 22

8 years ago
Created attachment 408908 [details] [diff] [review]
what bz said

probably can't hurt.
Attachment #408883 - Attachment is obsolete: true
Attachment #408908 - Flags: review?(bzbarsky)
Attachment #408908 - Flags: review?(bzbarsky) → review?(gerv)
Comment on attachment 408908 [details] [diff] [review]
what bz said

gerv's a better reviewer for this
What exactly are we trying to tell people here? Are we trying to tell them the hardware? Or the OS version? Which two versions of Fennec are we trying to distinguish between (i.e. which should get the high quality video and which the low quality video)?

The UA spec has:
( Platform ; Security  ; OS-or-CPU ;   Localization information ; GeckoVersion )
and the Fennec user agent originally had:
( X11;       U;          Linux armv7l; en-US;                     rv:1.9.2a1pre)

Mac and Windows use the first field to say Mac and Windows, but Unix all says X11 with the proper Unix version in field 3. So that part's right.

Would the problem be solved if "Linux armv7l" became "Maemo armv7l" or "Linux Maemo armv7l"?

Is this problem (of web content negotiation) better solved with the Accept header?

Gerv
(Assignee)

Comment 25

8 years ago
Hey Gerv,

We want to expose the hardware type and CPU is enough.  For example, on some devices, there may be be hw accelerated graphics and video.  Sites would like to know.  Of course this isn't a complete solution (something like UAProf is, but wow... i don't want to go there).

"Maemo armv71" isn't enough because there may be devices that fit that but have drastically different features/characteristics.

I am not sure how an Accept header would help.
So we already expose the CPU, right? That's the armv7l bit. So you just want to expose the "hardware type". But what sort of values would that have? If we start putting brand names like "Nokia N900" in the user agent string, the logical end result of that is massive problems where websites have to update their sniffing every time a new mobile handset comes out with a new name! I mean, there's 30 different Android devices already, each of which would have a different equivalent value for "Nokia N900", and there will be hundreds more.

I'd never heard of UAProf before and you may not like it but, reading the wiki page, I can see why it exists. We can't put the burden of mapping hundreds of device names to sets of capabilities onto websites. That'll put us in a situation where sites just support the most common model names, then people start wanting to spoof user agents to make sites work, and it'll be like the old user agent creeping wars again (IE's UA acquires "Mozilla"; Safari's UA acquires "like Gecko") but much, much worse. 

You are going to end up with:

"Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322
Fennec/1.0b4pre (Nokia N920 (compatible; like N900 and N810 (# for YouTube support)); like iPhone/2.1 and Razr/Android (compatible))"

:-(

Gerv
(Assignee)

Comment 27

8 years ago
i don't not believe that this slipperly slope will happen in practice and I am not suggesting any "compatible" string in the UA.
(Assignee)

Comment 28

8 years ago
backing out the string change to the UA until gerv and I can agree.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 29

8 years ago
Created attachment 409410 [details] [diff] [review]
no UA String change, but leave mDeviceInfo around.
Attachment #408908 - Attachment is obsolete: true
Attachment #408908 - Flags: review?(gerv)
(Assignee)

Updated

8 years ago
Attachment #409410 - Attachment is obsolete: true
(Assignee)

Comment 30

8 years ago
Created attachment 409411 [details] [diff] [review]
no UA String change, but leave mDeviceInfo around.
Attachment #409411 - Flags: review+
(Assignee)

Comment 31

8 years ago
http://hg.mozilla.org/mozilla-central/rev/f12c8531e48d
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/bb5e1bebe26f
status1.9.2: beta1-fixed → ---
Keywords: dev-doc-needed
Whiteboard: [doc-waiting-info]
Sorry, Doug, I thought I was CCed here. Apologies.

How do you want to continue this discussion? Here or elsewhere?

Gerv
(Assignee)

Comment 33

8 years ago
so, we had this on for a while.  many sites served up terribly dumbed-down pages because they sniffed the string "Nokia".  So, i am inclined to just mark this as WONTFIX.
Status: REOPENED → RESOLVED
Last Resolved: 8 years ago8 years ago
Resolution: --- → WONTFIX
Is the rest of the original patch going to be backed out as well?
(In reply to comment #34)
> Is the rest of the original patch going to be backed out as well?

ping?
(Assignee)

Comment 36

8 years ago
not the extra stuff in necko.

Updated

8 years ago
status1.9.2: --- → wontfix
(In reply to comment #20)
> I am not sure parens add anything.
> 
> "Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322
> Fennec/1.0b4pre Nokia N900"

Sorry to comment in a long-dead bug, but the parens turn the added information into a comment rather than claiming to incorporate the versionless sub-product "Nokia" and a second versionless sub-product "N900".

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
You need to log in before you can comment on or make changes to this bug.