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 ...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla19
Assigned To: Dão Gottwald [:dao]
:
Mentors:
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:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
fixed


Attachments
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] 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]
patch
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 <https://direktnet.raiffeisen.hu/rai/direktnet/home.do>. With the override applied, the login form should be present.
Comment 4 Boris Zbarsky [:bz] 2012-10-11 14:19:18 PDT
Comment on attachment 670305 [details] [diff] [review]
patch

>+++ b/dom/base/Navigator.cpp
> Navigator::GetUserAgent(nsAString& aUserAgent)
>+  NS_ENSURE_SUCCESS(rv, NS_OK);

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
https://bugzilla.mozilla.org/attachment.cgi?id=670558
Comment 7 Dão Gottwald [:dao] 2012-10-11 15:57:25 PDT
(In reply to Dão Gottwald [:dao] from comment #6)
> https://bugzilla.mozilla.org/attachment.cgi?id=670558

wrong link...

https://hg.mozilla.org/integration/mozilla-inbound/rev/9f28c28e988f
Comment 8 Ed Morley [:emorley] 2012-10-12 04:15:19 PDT
https://hg.mozilla.org/mozilla-central/rev/9f28c28e988f
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.