Last Comment Bug 766159 - User-Agent ProductSub depends on whether logging is enabled
: User-Agent ProductSub depends on whether logging is enabled
Product: Core
Classification: Components
Component: Networking: HTTP (show other bugs)
: 16 Branch
: x86_64 Linux
-- normal (vote)
: mozilla16
Assigned To: Patrick McManus [:mcmanus]
: Patrick McManus [:mcmanus]
Depends on:
  Show dependency treegraph
Reported: 2012-06-19 09:16 PDT by Patrick McManus [:mcmanus]
Modified: 2012-06-21 04:04 PDT (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch 0 (2.10 KB, patch)
2012-06-19 09:27 PDT, Patrick McManus [:mcmanus]
jduell.mcbugs: review+
Details | Diff | Splinter Review

Description User image Patrick McManus [:mcmanus] 2012-06-19 09:16:42 PDT
the user-agent string is constructed on a first-time-used basis from

It depends on a bunch of member variables being setup correctly, including mProductSub.. That one is set on line 287 of ::Init().

unfortunately, on, there is an invocation of UserAgent() in a NSPR LOG(()) statement. If that is executed (only when logging is enabled), the string is constructed and cached for future use without mProductSub being initialized.

The result is different UA with and without logging. bad news.

logging: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/ Firefox/16.0a1
no-logging: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/16.0 Firefox/16.0a1

The URL /u/0/_/notifications/frame for some reason is quite sensitive to this - and returns 0 byte responses with large set-cookies for the logging version, and normal gzip'd responses for the no-logging version. The with-log version resulted in random save-as dialogs :(

To fix it, just move the log statement to after the initialization.
Comment 1 User image Patrick McManus [:mcmanus] 2012-06-19 09:27:26 PDT
Created attachment 634469 [details] [diff] [review]
patch 0
Comment 2 User image Patrick McManus [:mcmanus] 2012-06-20 14:24:55 PDT
Thanks jason - this is a small thing but knowing where those random save-as dialogs were coming from is a big deal to me!
Comment 3 User image Ed Morley [:emorley] 2012-06-21 04:04:24 PDT

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