mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1127448 - Append the build id to the ua string for youtube. r=mconley
We want to be able to distinguish different builds to track down crashes and other problems with the YouTube site. Pushing the build id lets google group statistics from their logging in the same bins for comparison. Limited by #ifdef MOZ_UPDATE_CHANNEL to beta, aurora, and nightly. Limited by media.mediasource.enabled pref. We put this in nsBrowserGlue.js instead of browser.js so it runs once, rather than once per window like the fennec implementation we copied. They only ever have one window, so it's ok there. --HG-- extra : rebase_source : f933523c24391adc50090dc17e06d4cf37655f5c
This commit is contained in:
parent
ce8e1d1154
commit
84a6fce271
@ -119,6 +119,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",
|
||||
"resource://gre/modules/UpdateChannel.jsm");
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(MOZ_UPDATE_CHANNEL) && MOZ_UPDATE_CHANNEL != release
|
||||
#define MOZ_DEBUG_UA // Shorthand define for subsequent conditional sections.
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides",
|
||||
"resource://gre/modules/UserAgentOverrides.jsm");
|
||||
#endif
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ShellService", function() {
|
||||
try {
|
||||
return Cc["@mozilla.org/browser/shell-service;1"].
|
||||
@ -684,6 +691,11 @@ BrowserGlue.prototype = {
|
||||
Services.prefs.addObserver(POLARIS_ENABLED, this, false);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DEBUG_UA
|
||||
UserAgentOverrides.init();
|
||||
DebugUserAgent.init();
|
||||
#endif
|
||||
|
||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||
|
||||
AddonWatcher.init(this._notifySlowAddon);
|
||||
@ -917,6 +929,9 @@ BrowserGlue.prototype = {
|
||||
if (Services.prefs.getBoolPref("dom.identity.enabled")) {
|
||||
SignInToWebsiteUX.uninit();
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_DEBUG_UA
|
||||
UserAgentOverrides.uninit();
|
||||
#endif
|
||||
webrtcUI.uninit();
|
||||
FormValidationHandler.uninit();
|
||||
@ -2835,3 +2850,36 @@ let globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessag
|
||||
globalMM.addMessageListener("UITour:onPageEvent", function(aMessage) {
|
||||
UITour.onPageEvent(aMessage, aMessage.data);
|
||||
});
|
||||
|
||||
#ifdef MOZ_DEBUG_UA
|
||||
// Modify the user agent string for specific domains
|
||||
// to route debug information through their logging.
|
||||
var DebugUserAgent = {
|
||||
DEBUG_UA: null,
|
||||
DOMAINS: [
|
||||
'youtube.com',
|
||||
'www.youtube.com',
|
||||
'youtube-nocookie.com',
|
||||
'www.youtube-nocookie.com',
|
||||
],
|
||||
|
||||
init: function() {
|
||||
// Only run if the MediaSource Extension API is available.
|
||||
if (!Services.prefs.getBoolPref("media.mediasource.enabled")) {
|
||||
return;
|
||||
}
|
||||
// Install our override filter.
|
||||
UserAgentOverrides.addComplexOverride(this.onRequest.bind(this));
|
||||
let ua = Cc["@mozilla.org/network/protocol;1?name=http"]
|
||||
.getService(Ci.nsIHttpProtocolHandler).userAgent;
|
||||
this.DEBUG_UA = ua + " Build/" + Services.appinfo.appBuildID;
|
||||
},
|
||||
|
||||
onRequest: function(channel, defaultUA) {
|
||||
if (this.DOMAINS.includes(channel.URI.host)) {
|
||||
return this.DEBUG_UA;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
};
|
||||
#endif // MOZ_DEBUG_UA
|
||||
|
Loading…
Reference in New Issue
Block a user