Skip to content

Commit

Permalink
Remove the Waterfox specific UA for now :-(. Allows better compatibil…
Browse files Browse the repository at this point in the history
…ity on the web unfortunately, too many sites check for browser name instead of feature detection. Pretend we're 57.0 as well, so add-ons install propely on the Mozilla AMO.
  • Loading branch information
Alex Kontos committed Mar 22, 2018
1 parent a9c77bb commit 3391281
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
26 changes: 13 additions & 13 deletions modules/libpref/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ pref("preferences.allow.omt-write", false);

pref("keyword.enabled", false);
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
pref("general.useragent.compatMode.firefox", true);
pref("general.useragent.compatMode.firefox", false);

// This pref exists only for testing purposes. In order to disable all
// overrides by default, don't initialize UserAgentOverrides.jsm.
pref("general.useragent.site_specific_overrides", true);
#ifdef XP_WIN
pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.chase.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.slack.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
#endif
#ifdef XP_MACOSX
pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.chase.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
pref("general.useragent.override.slack.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
#endif
// #ifdef XP_WIN
// pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.chase.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.slack.com", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:56.0) Gecko/20100101 Firefox/56.0");
// #endif
// #ifdef XP_MACOSX
// pref("general.useragent.override.americanexpress.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.chase.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.discordapp.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
// pref("general.useragent.override.slack.com", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:56.0) Gecko/20100101 Firefox/56.0");
// #endif

pref("general.config.obscure_value", 13); // for MCD .cfg files

Expand Down
19 changes: 13 additions & 6 deletions netwerk/protocol/http/nsHttpHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,17 @@ nsHttpHandler::Init()

nsHttpChannelAuthProvider::InitializePrefs();

mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
// mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
mMisc.AssignLiteral("rv: 57.0");

This comment has been minimized.

Copy link
@laniakea64

laniakea64 Mar 22, 2018

nit: there shouldn't be a space between rv: and the version number


mCompatFirefox.AssignLiteral("Waterfox/" MOZ_APP_UA_VERSION);
// mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION);
mCompatFirefox.AssignLiteral("Firefox/57.0");

nsCOMPtr<nsIXULAppInfo> appInfo =
do_GetService("@mozilla.org/xre/app-info;1");

mAppName.AssignLiteral(MOZ_APP_UA_NAME);
// mAppName.AssignLiteral(MOZ_APP_UA_NAME);
mAppName.AssignLiteral("Firefox");
if (mAppName.Length() == 0 && appInfo) {
// Try to get the UA name from appInfo, falling back to the name
appInfo->GetUAName(mAppName);
Expand Down Expand Up @@ -905,12 +908,16 @@ nsHttpHandler::BuildUserAgent()

bool isFirefox = mAppName.EqualsLiteral("Firefox");
if (isFirefox || mCompatFirefoxEnabled) {
// "Firefox/x.y" (compatibility) app token
mUserAgent += ' ';
mUserAgent += "Firefox";
mUserAgent += mCompatFirefox;
}
if (!isFirefox) {
// App portion
mUserAgent += ' ';
mUserAgent += mAppName;
mUserAgent += '/';
mUserAgent += mAppVersion;
mUserAgent += ' ';
mUserAgent += mCompatFirefox;
}
}

Expand Down

6 comments on commit 3391281

@laniakea64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretend we're 57.0 as well, so add-ons install propely on the Mozilla AMO.

Hi @MrAlex94 , this change actually hoses AMO for Waterfox users. It causes AMO to block installation of compatible legacy extensions (like Classic Theme Restorer) and allow installation of some incompatible WebExtensions (like NoScript 10.1.6.5).

I understand if having the full Waterfox UA is sadly not practical, but could you please revert the version number change?

Thanks

@MrAlex94
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, seems I've made a couple of mistakes with this patch (especially the compatibility version - need to update that). Will see the best course of action tomorrow :-). Thanks for the heads up!

@MrAlex94
Copy link
Collaborator

@MrAlex94 MrAlex94 commented on 3391281 Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@laniakea64, setting extensions.checkCompatibility.56.1;false in about:config fixes all the issues. Give it a try? Managed to install both NoScript and CTR.

@laniakea64
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to have any effect here. AMO still blocks installation of CTR and allows installation of NoScript 10.1.6.5.

Perhaps I wasn't quite clear about what the problem is. Waterfox itself behaves correctly: installing CTR from a downloaded .xpi works fine, and Waterfox correctly rejects the incompatible NoScript 10.1.6.5. The problem here is how AMO behaves in response to detecting version 57 from the UA.

@grahamperrin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrAlex94 @laniakea64 over to #484 (if you don't mind; an issue might be easier to track if I'm to rope in help from elsewhere).

@MrAlex94
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorry, seems I stupidly was testing installing CTR in the current release of Waterfox, got the windows confused 😂. Fixed the issues of not installing WebExtensions though.

I'm not sure what to do here, I'll see if it's worth implementing the archive store and using that for the older add-ons 🤔 as a replacement to the add-ons manager?

Please sign in to comment.