mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 837215 - YouTube video's redirect on play; broken on tablets r=bnicholson
This commit is contained in:
parent
442472a6a8
commit
e12320ead1
@ -2577,6 +2577,7 @@ var LightWeightThemeWebInstaller = {
|
||||
|
||||
var UserAgent = {
|
||||
DESKTOP_UA: null,
|
||||
YOUTUBE_DOMAIN: /\.?youtube\.com$/,
|
||||
|
||||
init: function ua_init() {
|
||||
Services.obs.addObserver(this, "DesktopMode:Change", false);
|
||||
@ -2633,10 +2634,11 @@ var UserAgent = {
|
||||
if (tab == null)
|
||||
break;
|
||||
|
||||
if (/\.?youtube\.com$/.test(channel.URI.host)) {
|
||||
if (this.YOUTUBE_DOMAIN.test(channel.URI.host)) {
|
||||
let ua = Cc["@mozilla.org/network/protocol;1?name=http"].getService(Ci.nsIHttpProtocolHandler).userAgent;
|
||||
if (ua.indexOf("Android; Tablet;") !== -1) {
|
||||
ua = ua.replace("Android; Tablet;", "Android; Mobile;");
|
||||
// Send the phone UA to youtube if this is a tablet
|
||||
if (ua.indexOf("Android; Mobile;") === -1) {
|
||||
ua = ua.replace("Android;", "Android; Mobile;");
|
||||
channel.setRequestHeader("User-Agent", ua, false);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user