Last Comment Bug 800157 - Make User Agent overrides affect navigator.userAgent in addition to the HTTP header
: Make User Agent overrides affect navigator.userAgent in addition to the HTTP ...
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla19
Assigned To: Dão Gottwald [:dao]
: Andrew Overholt [:overholt]
Depends on: 814379
Blocks: 795348 822551
  Show dependency treegraph
Reported: 2012-10-10 15:22 PDT by Dão Gottwald [:dao]
Modified: 2013-04-08 13:24 PDT (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (11.44 KB, patch)
2012-10-11 02:26 PDT, Dão Gottwald [:dao]
bzbarsky: review+
Details | Diff | Splinter Review
override for testing (1012 bytes, patch)
2012-10-11 02:28 PDT, Dão Gottwald [:dao]
no flags Details | Diff | Splinter Review
patch, review comments addressed (11.40 KB, patch)
2012-10-11 15:00 PDT, Dão Gottwald [:dao]
lukasblakk+bugs: approval‑mozilla‑aurora+
lukasblakk+bugs: approval‑mozilla‑beta+
Details | Diff | Splinter Review

Description Dão Gottwald [:dao] 2012-10-10 15:22:44 PDT
Bug 795348 might need this unless that site can be evangelized. Either way, it will be good to have the ability to override navigator.userAgent up our sleeve.

I suppose UserAgentOverrides.jsm needs to converted to an XPCOM service, or an XPCOM services utilizing UserAgentOverrides.jsm needs to be added, such that Navigator.cpp can use that. Does this sound reasonable?
Comment 1 Boris Zbarsky [:bz] (still a bit busy) 2012-10-10 17:56:13 PDT
Seems fine to me, yes.
Comment 2 Dão Gottwald [:dao] 2012-10-11 02:26:32 PDT
Created attachment 670305 [details] [diff] [review]
Comment 3 Dão Gottwald [:dao] 2012-10-11 02:28:33 PDT
Created attachment 670306 [details] [diff] [review]
override for testing

You can test this on <>. With the override applied, the login form should be present.
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2012-10-11 14:19:18 PDT
Comment on attachment 670305 [details] [diff] [review]

>+++ b/dom/base/Navigator.cpp
> Navigator::GetUserAgent(nsAString& aUserAgent)

Second arg should be rv.

>+  nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());

  nsIDocument* doc = win->GetExtantDoc();

r=me with those.
Comment 5 Dão Gottwald [:dao] 2012-10-11 15:00:09 PDT
Created attachment 670558 [details] [diff] [review]
patch, review comments addressed
Comment 6 Dão Gottwald [:dao] 2012-10-11 15:56:03 PDT
Comment 7 Dão Gottwald [:dao] 2012-10-11 15:57:25 PDT
(In reply to Dão Gottwald [:dao] from comment #6)

wrong link...
Comment 8 Ed Morley [:emorley] 2012-10-12 04:15:19 PDT
Comment 9 Dão Gottwald [:dao] 2012-10-13 02:45:00 PDT
Comment on attachment 670558 [details] [diff] [review]
patch, review comments addressed

[Approval Request Comment]

Extends our ability to react to sites that are broken due to bad UA sniffing.

Bug caused by (feature/regressing bug #): n/a
User impact if declined: n/a
Testing completed (on m-c, etc.): on m-c
Risk to taking this patch (and alternatives if risky): low, I think
String or UUID changes made by this patch: none

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