Bug 124229 - [GTK] Remove Chromium as user agent and claim to be Safari on OS X
Summary: [GTK] Remove Chromium as user agent and claim to be Safari on OS X
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Víctor M. Jáquez L.
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-12 13:29 PST by Víctor M. Jáquez L.
Modified: 2015-11-16 09:42 PST (History)
6 users (show)

See Also:


Attachments
the page is rendered correctly using chromium (345.19 KB, image/png)
2013-11-12 13:31 PST, Víctor M. Jáquez L.
no flags Details
page is not rendered right with epiphany (452.90 KB, image/png)
2013-11-12 13:32 PST, Víctor M. Jáquez L.
no flags Details
Patch (3.09 KB, patch)
2013-11-13 08:09 PST, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff
Patch (4.12 KB, patch)
2013-11-19 09:02 PST, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff
Patch (4.32 KB, patch)
2013-11-20 07:43 PST, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Víctor M. Jáquez L. 2013-11-12 13:29:08 PST
Steps to reproduce:

A)
1. create an account on Duolingo and complete the tutorial

B)
1. log in with an existing account.

Result:
Only the background and the menus are shonw

Expected result:
A floating frame with the course status.
Comment 1 Víctor M. Jáquez L. 2013-11-12 13:31:15 PST
Created attachment 216714 [details]
the page is rendered correctly using chromium
Comment 2 Víctor M. Jáquez L. 2013-11-12 13:32:27 PST
Created attachment 216715 [details]
page is not rendered right with epiphany

this is also shown using minibroswer and gtklauncher using current master
Comment 3 Martin Robinson 2013-11-12 14:20:15 PST
Some errors on the console:

[Error] TypeError: undefined is not an object (evaluating 'duo.user.get')
	(anonymous function) (all.js, line 78)
[Error] ReferenceError: Can't find variable: chrome
	render (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 467)
	switchView (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 191)
	home (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 898)
	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 271)
	(anonymous function)
	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
	some
	any (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 226)
	loadUrl (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
	loadUrl (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 905)
	start (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 276)
	(anonymous function) (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 902)
	t (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 66)
	fireWith (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 67)
	ready (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 56)
	K (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 65)

It looks like the page is looking for Chromium specific (!) variables in the window object.
Comment 4 Víctor M. Jáquez L. 2013-11-12 18:57:13 PST
> It looks like the page is looking for Chromium specific (!) variables in the window object.

Yes, as the minibrowser and gtklaunch sets as user-agent "Chrome" (among others) a js script assumes it is a chromium browsers and calls a chromium specific variable (yeah).

As a workaround, if we remove the Chrome thing in the user-agent string, the page is rendered normally.

So, I don't think this is WebKit bug, but a bug in the js script, or perhaps (maybe) in the browser, which uses that user-agent.
Comment 5 Martin Robinson 2013-11-13 00:08:15 PST
(In reply to comment #4)

> So, I don't think this is WebKit bug, but a bug in the js script, or perhaps (maybe) in the browser, which uses that user-agent.

We may need to think of a workaround. Clearly there are problems with pretending to be Chromium. We may need to start pretending to be OS X Safari.
Comment 6 Sergio Villar Senin 2013-11-13 00:22:56 PST
(In reply to comment #5)
> (In reply to comment #4)
> 
> > So, I don't think this is WebKit bug, but a bug in the js script, or perhaps (maybe) in the browser, which uses that user-agent.
> 
> We may need to think of a workaround. Clearly there are problems with pretending to be Chromium. We may need to start pretending to be OS X Safari.

Agree specially after the fork, engines might start to diverge quickly.
Comment 7 Víctor M. Jáquez L. 2013-11-13 08:09:10 PST
Created attachment 216802 [details]
Patch
Comment 8 Martin Robinson 2013-11-13 08:16:12 PST
Comment on attachment 216802 [details]
Patch

We can't just claim to be Safari. We need to claim to be Safari on OS X. It's in the comment! :)
Comment 9 Víctor M. Jáquez L. 2013-11-13 08:35:28 PST
(In reply to comment #8)
> (From update of attachment 216802 [details])
> We can't just claim to be Safari. We need to claim to be Safari on OS X. It's in the comment! :)

I don't understand why we need to say we are running OS X.

Do you mean something like this:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2

from here: http://www.useragentstring.com/pages/Safari/
Comment 10 Martin Robinson 2013-11-13 08:47:03 PST
(In reply to comment #9) 
> Do you mean something like this: 
> Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
 from here: http://www.useragentstring.com/pages/Safari/

Yes. When we claim to be Safari on Linux, some sites assume that Safari && !OSX is Safari && iOS. iOS pages are often light-weight versions that aren't suitable for desktop display or are missing resources such as custom fonts.
Comment 11 Víctor M. Jáquez L. 2013-11-13 09:00:25 PST
(In reply to comment #10)
> (In reply to comment #9) 
> > Do you mean something like this: 
> > Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
>  from here: http://www.useragentstring.com/pages/Safari/
> 
> Yes. When we claim to be Safari on Linux, some sites assume that Safari && !OSX is Safari && iOS. iOS pages are often light-weight versions that aren't suitable for desktop display or are missing resources such as custom fonts.

AAAhhh..the comment in code was a @TODO ... roger that!
Comment 12 Martin Robinson 2013-11-13 09:23:12 PST
(In reply to comment #11)

> AAAhhh..the comment in code was a @TODO ... roger that!

Not really a TODO. We had essentially two choices: we could either claim to be Safari + OS X or Chromium on the proper operating system. The previous version just claimed to be Safari on Linux, which led to issues. The comment tried to explain the situation.
Comment 13 Víctor M. Jáquez L. 2013-11-19 09:02:45 PST
Created attachment 217303 [details]
Patch
Comment 14 Martin Robinson 2013-11-19 09:56:06 PST
Comment on attachment 217303 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=217303&action=review

> Source/WebCore/platform/gtk/UserAgentGtk.cpp:47
> +#if CPU(PPC) || CPU(PPC64)
> +#define PROCESSOR "PPC"
> +#elif CPU(X86) || CPU(X86_64)
> +#define PROCESSOR "Intel"
> +#elif CPU(ARM) || CPU(ARM64)
> +#define PROCESSOR "ARM"
> +#else
> +#define PROCESSOR "Unknown"
> +#endif

I'd rather this be a function than a preprocessor definition. Perhaps something like "cpuDescriptionForUSAString"

> Source/WebCore/platform/gtk/UserAgentGtk.cpp:74
> +#elif OS(DARWIN) || OS(UNIX)
> +    uaOSVersion = String(PROCESSOR " Mac OS X");
>  #else

I think a small comment here could be useful. We need to explain that Linux+Safari triggers the iOS path on some websites.
Comment 15 Víctor M. Jáquez L. 2013-11-20 07:43:48 PST
Created attachment 217431 [details]
Patch
Comment 16 Martin Robinson 2013-11-20 08:42:04 PST
Comment on attachment 217431 [details]
Patch

Okay. We need to test this *very thoroughly* before releasing it.
Comment 17 Víctor M. Jáquez L. 2013-11-20 10:12:16 PST
(In reply to comment #16)
> (From update of attachment 217431 [details])
> Okay. We need to test this *very thoroughly* before releasing it.

I'll commit it. But I have no idea how to test it. Do you mean to see the user experience in a ton of real websites?
Comment 18 WebKit Commit Bot 2013-11-20 10:41:38 PST
Comment on attachment 217431 [details]
Patch

Clearing flags on attachment: 217431

Committed r159572: <http://trac.webkit.org/changeset/159572>
Comment 19 WebKit Commit Bot 2013-11-20 10:41:41 PST
All reviewed patches have been landed.  Closing bug.
Comment 20 Martin Robinson 2013-11-20 10:58:21 PST
(In reply to comment #17)
> (In reply to comment #16)
> > (From update of attachment 217431 [details] [details])
> > Okay. We need to test this *very thoroughly* before releasing it.
> 
> I'll commit it. But I have no idea how to test it. Do you mean to see the user experience in a ton of real websites?

Yep. Exactly. We need to ensure that this doesn't introduce more problems than it solves. User agents are very delicate.
Comment 21 mknepher 2014-01-07 10:42:46 PST
Running Fedora 20 with epiphany-3.10.3 / webkitgtk3-2.2.3, and Amazon's cloud reader at https://read.amazon.com now throws up an unsupported browser page. It lists acceptable browsers as:

Chrome 20+
Safari 5+
Firefox 10+
IE 10+

I'm not sure when this change made it into Fedora, but I've been running 20 since alpha, and I know the site was working as of a few weeks ago.
Comment 22 Michael Catanzaro 2015-11-16 09:34:48 PST
(In reply to comment #3)
> Some errors on the console:
> 
> [Error] TypeError: undefined is not an object (evaluating 'duo.user.get')
> 	(anonymous function) (all.js, line 78)
> [Error] ReferenceError: Can't find variable: chrome
> 	render (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 467)
> 	switchView (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 191)
> 	home (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 898)
> 	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 271)
> 	(anonymous function)
> 	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
> 	some
> 	any (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 226)
> 	loadUrl (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
> 	loadUrl (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 905)
> 	start (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 276)
> 	(anonymous function) (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 902)
> 	t (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 66)
> 	fireWith (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 67)
> 	ready (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 56)
> 	K (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 65)
> 
> It looks like the page is looking for Chromium specific (!) variables in the
> window object.

Martin, my worry is that if we put Chromium in the user agent by default, we'll have similar issues on various sites. I've never seen something like this occur without Chromium in the UA.
Comment 23 Martin Robinson 2015-11-16 09:41:50 PST
(In reply to comment #22)
> (In reply to comment #3)
> > Some errors on the console:
> > 
> > [Error] TypeError: undefined is not an object (evaluating 'duo.user.get')
> > 	(anonymous function) (all.js, line 78)
> > [Error] ReferenceError: Can't find variable: chrome
> > 	render (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 467)
> > 	switchView (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 191)
> > 	home (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 898)
> > 	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 271)
> > 	(anonymous function)
> > 	(anonymous function) (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
> > 	some
> > 	any (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 226)
> > 	loadUrl (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 277)
> > 	loadUrl (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 905)
> > 	start (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 276)
> > 	(anonymous function) (f5c9405066ce187ddd25fa480d65fd02_mv_.min.js, line 902)
> > 	t (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 66)
> > 	fireWith (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 67)
> > 	ready (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 56)
> > 	K (1b104f59bca045b5837b0eb7f0d6de09_mv_.min.js, line 65)
> > 
> > It looks like the page is looking for Chromium specific (!) variables in the
> > window object.
> 
> Martin, my worry is that if we put Chromium in the user agent by default,
> we'll have similar issues on various sites. I've never seen something like
> this occur without Chromium in the UA.

I guess we can always try to file a bug with Typescript and hope for the best. :)
Comment 24 Martin Robinson 2015-11-16 09:42:30 PST
(In reply to comment #23)

> I guess we can always try to file a bug with Typescript and hope for the
> best. :)

Sorry. I meant "TypeKit" here.