Closed
Bug 768035
Opened 12 years ago
Closed 12 years ago
navigator.userAgent property is not changed when requesting desktop site
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(fennec+)
RESOLVED
FIXED
Firefox 22
Tracking | Status | |
---|---|---|
fennec | + | --- |
People
(Reporter: xti, Assigned: wesj)
References
()
Details
(Whiteboard: [rdm])
Attachments
(2 files, 4 obsolete files)
2.92 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
8.72 KB,
patch
|
bnicholson
:
review+
|
Details | Diff | Splinter Review |
Firefox 16.0a1 (2012-06-25)
Device: Galaxy Nexus
OS: Android 4.0.2
Steps to reproduce:
1. Open Fennec
2. Browse to espn.go.com
3. Tap on Menu > Request Desktop Site
Expected result:
Desktop site version is loaded after step 3.
Actual result:
Mobile version is still displayed after step 3.
Updated•12 years ago
|
URL: http://espn.go.com/
Comment 1•12 years ago
|
||
It's not the same mobile site; it's a less mobile optimized version (i.e, basic HTML).The same thing happens on Stock browser. Requesting the desktop site yields a more basic basic mobile site.
I think this is invalid; there might not be any way around this.
Comment 2•12 years ago
|
||
This happens because ESPN uses navigator.userAgent to perform the mobile redirection in JS. Request Desktop Site changes the UA when requesting HTTP resources, but it doesn't change the navigator.userAgent property.
That property comes from here: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/http/nsHttpHandler.cpp#501
To fix this, we need to change this implementation to support tab-based UAs rather than a global preference, or resort to some nasty hack that changes this pref whenever a tab is switched.
The stock browser does work correctly if you manually go to "http://espn.go.com" after switching to desktop mode.
Updated•12 years ago
|
Summary: Mobile version is loaded after enabling "Request Desktop Site" for espn.go.com → navigator.userAgent property is not changed when requesting desktop site
Updated•12 years ago
|
Whiteboard: rdm
Updated•12 years ago
|
Whiteboard: rdm → [rdm]
Updated•12 years ago
|
tracking-fennec: --- → ?
Updated•12 years ago
|
tracking-fennec: ? → 18+
Updated•12 years ago
|
Assignee: nobody → bugmail.mozilla
Updated•12 years ago
|
tracking-fennec: 18+ → +
Assignee | ||
Comment 3•12 years ago
|
||
I'm going to steal this if you don't mind. We have built in per URI useragent stuff now, so I'm hoping we can use it?
Assignee: bugmail.mozilla → wjohnston
Comment 4•12 years ago
|
||
(In reply to Wesley Johnston (:wesj) from comment #3)
> I'm going to steal this if you don't mind. We have built in per URI
> useragent stuff now, so I'm hoping we can use it?
Is URI fine-grained enough? What is the same page is opened in two different tabs? It seems like we would need a way to set UA per docshell.
Assignee | ||
Comment 5•12 years ago
|
||
This should work and brings us back closer in line with what desktop/b2g use. Clobbering...
Assignee | ||
Comment 6•12 years ago
|
||
Dang it. Spoke to soon. UserAgentOverrides is called by Navigator.getUserAgent, but only to do the site specific stuff. I'm going to modify it to also do a check based on docshell that we can catch ourselves.
Assignee | ||
Comment 7•12 years ago
|
||
This modifies SitesSpecificUserAgent's getUserAgentForURI to getUserAgentForURIAndDocShell to allow changes to the UA based on either URI or on tab. We made the choice to go with a per-tab request desktop site solution for Fennec at: https://bugzilla.mozilla.org/show_bug.cgi?id=790954#c15. Happy to hear about alternative ways to do this bz.
Attachment #717221 -
Attachment is obsolete: true
Attachment #717261 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 8•12 years ago
|
||
This implements a custom Fennec version of nsISiteSpecificUseAgent to send user agents based on docshell or uri. It also modifies Fennec to use UserAgentOverrides.jsm like before, so that we're more in line with other Firefox implementations.
Attachment #717262 -
Flags: review?(bnicholson)
Comment 9•12 years ago
|
||
Comment on attachment 717261 [details] [diff] [review]
Patch 1/2
This seems ok, but why not just use the window instead of the docshell? Does the callee actually want the docshell?
Attachment #717261 -
Flags: review?(bzbarsky) → review+
Comment 10•12 years ago
|
||
Comment on attachment 717262 [details] [diff] [review]
Patch 2/2
drive by
> observe: function ua_observe(aSubject, aTopic, aData) {
>+ let args = JSON.parse(aData);
>+ let tab = BrowserApp.getTabForId(args.tabId);
>+ if (tab != null)
>+ tab.reloadWithMode(args.desktopMode);
Can we keep and if or switch for the "DesktopMode:Change" part so we know what topic the code handles?
>+ SiteSpecificUserAgent.js \
Forgot to hg add the file?
Comment 11•12 years ago
|
||
Comment on attachment 717262 [details] [diff] [review]
Patch 2/2
Cancelling review for missing SiteSpecificUserAgent.js.
Attachment #717262 -
Flags: review?(bnicholson)
Assignee | ||
Comment 12•12 years ago
|
||
Sorry for the churn bz. I like using windows better as well.
Attachment #717261 -
Attachment is obsolete: true
Attachment #718747 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 13•12 years ago
|
||
Updated to use window instead. With missing file.
Attachment #717262 -
Attachment is obsolete: true
Attachment #718749 -
Flags: review?(bnicholson)
Assignee | ||
Comment 14•12 years ago
|
||
Grr. Removed extra logging.
Attachment #718749 -
Attachment is obsolete: true
Attachment #718749 -
Flags: review?(bnicholson)
Attachment #718760 -
Flags: review?(bnicholson)
Comment 15•12 years ago
|
||
Comment on attachment 718747 [details] [diff] [review]
Patch 1/2
r=me
Attachment #718747 -
Flags: review?(bzbarsky) → review+
Comment 16•12 years ago
|
||
Comment on attachment 718760 [details] [diff] [review]
Patch 2/2
Review of attachment 718760 [details] [diff] [review]:
-----------------------------------------------------------------
Nice, looks good!
Attachment #718760 -
Flags: review?(bnicholson) → review+
Assignee | ||
Comment 17•12 years ago
|
||
Comment 18•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/0f39615ecb37
https://hg.mozilla.org/mozilla-central/rev/5b573c5f2920
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•