commit ac551546690ebd2d3f226df32da26805ebf2ffaa Author: Sukhbir Singh sukhbir@torproject.org Date: Tue Sep 1 12:01:19 2015 -0400
Rebase patches for Instantbird nightly and Firefox 42
- Kathleen's patch for setting Firefox profile directory - Patch for disabling search engine options in the preferences window - Patch for setting top protocols - Removed the js-locale.mozpatch --- ...e-the-default-Firefox-profile-director.mozpatch | 72 ++++--- projects/instantbird/account-picture.patch | 7 - projects/instantbird/config | 1 - projects/instantbird/js-locale.mozpatch | 204 -------------------- projects/instantbird/search-preferences-xul.patch | 8 +- projects/instantbird/top-protocols.patch | 11 +- 6 files changed, 39 insertions(+), 264 deletions(-)
diff --git a/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch b/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch index 11ba270..45ab38c 100644 --- a/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch +++ b/projects/instantbird/Bug-9173-Change-the-default-Firefox-profile-director.mozpatch @@ -1,23 +1,8 @@ -From e40c55e5d4c8ea9e354f00277478accae84970de Mon Sep 17 00:00:00 2001 -From: Kathy Brade brade@pearlcrescent.com -Date: Fri, 18 Oct 2013 15:20:06 -0400 -Subject: [PATCH] Bug #9173: Change the default Firefox profile directory to be - TBB-relative. - -This should eliminate our need to rely on a wrapper script that sets $HOME and -launches Firefox with -profile. ---- - toolkit/xre/nsXREDirProvider.cpp | 153 ++++++++------------------------- - toolkit/xre/nsXREDirProvider.h | 10 +-- - xpcom/io/moz.build | 4 + - xpcom/io/nsAppFileLocationProvider.cpp | 96 ++++++++------------- - 4 files changed, 79 insertions(+), 184 deletions(-) - diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index c496a14ce84a..689cb0f8ecb1 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp -@@ -33,6 +33,7 @@ +@@ -32,6 +32,7 @@ #include "nsArrayEnumerator.h" #include "nsEnumeratorUtils.h" #include "nsReadableUtils.h" @@ -25,7 +10,7 @@ index c496a14ce84a..689cb0f8ecb1 100644 #include "mozilla/Services.h" #include "mozilla/Omnijar.h" #include "mozilla/Preferences.h" -@@ -195,9 +196,6 @@ nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult, +@@ -200,9 +201,6 @@ aProfileName, aAppName, aVendorName);
if (NS_SUCCEEDED(rv)) { @@ -35,7 +20,7 @@ index c496a14ce84a..689cb0f8ecb1 100644 // We must create the profile directory here if it does not exist. nsresult tmp = EnsureDirectoryExists(file); if (NS_FAILED(tmp)) { -@@ -220,9 +218,6 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult, +@@ -225,9 +223,6 @@ aProfileName, aAppName, aVendorName);
if (NS_SUCCEEDED(rv)) { @@ -45,7 +30,7 @@ index c496a14ce84a..689cb0f8ecb1 100644 // We must create the profile directory here if it does not exist. nsresult tmp = EnsureDirectoryExists(file); if (NS_FAILED(tmp)) { -@@ -1212,82 +1207,45 @@ nsresult +@@ -1222,90 +1217,45 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal) { // Copied from nsAppFileLocationProvider (more or less) @@ -53,7 +38,11 @@ index c496a14ce84a..689cb0f8ecb1 100644 + NS_ENSURE_ARG_POINTER(aFile); nsCOMPtr<nsIFile> localDir;
--#if defined(XP_MACOSX) ++ nsresult rv = GetAppDir()->Clone(getter_AddRefs(localDir)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ int levelsToRemove = 0; + #if defined(XP_MACOSX) - FSRef fsRef; - OSType folderType; - if (aLocal) { @@ -63,21 +52,14 @@ index c496a14ce84a..689cb0f8ecb1 100644 - folderType = kDomainLibraryFolderType; -#else - folderType = kApplicationSupportFolderType; --#endif ++ levelsToRemove += 1; + #endif - } - OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef); - NS_ENSURE_FALSE(err, NS_ERROR_FAILURE); - - rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localDir)); -+ nsresult rv = GetAppDir()->Clone(getter_AddRefs(localDir)); - NS_ENSURE_SUCCESS(rv, rv); - -- nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir); -- NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED); -+ int levelsToRemove = 0; -+#if defined(XP_MACOSX) -+ levelsToRemove += 1; -+#endif +- NS_ENSURE_SUCCESS(rv, rv); + while (localDir && (levelsToRemove > 0)) { + // When crawling up the hierarchy, components named "." do not count. + nsAutoCString removedName; @@ -85,24 +67,36 @@ index c496a14ce84a..689cb0f8ecb1 100644 + NS_ENSURE_SUCCESS(rv, rv); + bool didRemove = !removedName.Equals(".");
-- rv = dirFileMac->InitWithFSRef(&fsRef); -- NS_ENSURE_SUCCESS(rv, rv); +- nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir); +- NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED); + // Remove a directory component. + nsCOMPtr<nsIFile> parentDir; + rv = localDir->GetParent(getter_AddRefs(parentDir)); + NS_ENSURE_SUCCESS(rv, rv); + localDir = parentDir;
+- rv = dirFileMac->InitWithFSRef(&fsRef); +- NS_ENSURE_SUCCESS(rv, rv); ++ if (didRemove) ++ --levelsToRemove; ++ } + - localDir = do_QueryInterface(dirFileMac, &rv); +-#elif defined(XP_IOS) +- nsAutoCString userDir; +- if (GetUIKitDirectory(aLocal, userDir)) { +- rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir)); +- } else { +- rv = NS_ERROR_FAILURE; +- } +- NS_ENSURE_SUCCESS(rv, rv); -#elif defined(XP_WIN) - nsString path; - if (aLocal) { - rv = GetShellFolderPath(CSIDL_LOCAL_APPDATA, path); - if (NS_FAILED(rv)) - rv = GetRegWindowsAppDataFolder(aLocal, path); -+ if (didRemove) -+ --levelsToRemove; - } +- } - if (!aLocal || NS_FAILED(rv)) { - rv = GetShellFolderPath(CSIDL_APPDATA, path); - if (NS_FAILED(rv)) { @@ -111,7 +105,7 @@ index c496a14ce84a..689cb0f8ecb1 100644 - } - } - NS_ENSURE_SUCCESS(rv, rv); - +- - rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir)); -#elif defined(MOZ_WIDGET_GONK) - rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true, @@ -154,7 +148,7 @@ index c496a14ce84a..689cb0f8ecb1 100644
NS_IF_ADDREF(*aFile = localDir); return rv; -@@ -1500,48 +1458,25 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile, +@@ -1518,48 +1468,25 @@ }
nsAutoCString profile; @@ -206,7 +200,7 @@ index c496a14ce84a..689cb0f8ecb1 100644
#elif defined(ANDROID) // The directory used for storing profiles -@@ -1553,12 +1488,6 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile, +@@ -1571,12 +1498,6 @@ rv = aFile->AppendNative(nsDependentCString("mozilla")); NS_ENSURE_SUCCESS(rv, rv); #elif defined(XP_UNIX) @@ -219,7 +213,7 @@ index c496a14ce84a..689cb0f8ecb1 100644 if (!profile.IsEmpty()) { // Skip any leading path characters const char* profileStart = profile.get(); -@@ -1567,31 +1496,17 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile, +@@ -1585,31 +1506,17 @@
// On the off chance that someone wanted their folder to be hidden don't // let it become ".." diff --git a/projects/instantbird/account-picture.patch b/projects/instantbird/account-picture.patch index 14a3ed3..300ecc6 100644 --- a/projects/instantbird/account-picture.patch +++ b/projects/instantbird/account-picture.patch @@ -1,10 +1,3 @@ -# HG changeset patch -# User Sukhbir Singh sukhbir@torproject.org -# Date 1415618519 18000 -# Node ID 6193b9d64e63818366e61126625727543fb81d3f -# Parent 09d259c6155857eda3d4488c68a4a9d8d851138f -Disable the account picture dialog - diff --git a/im/content/blist.xul b/im/content/blist.xul --- a/im/content/blist.xul +++ b/im/content/blist.xul diff --git a/projects/instantbird/config b/projects/instantbird/config index 49d76af..2089829 100644 --- a/projects/instantbird/config +++ b/projects/instantbird/config @@ -117,7 +117,6 @@ input_files: enable: '[% c("var/windows") %]' - filename: Bug-9173-Change-the-default-Firefox-profile-director.mozpatch - filename: block-plugins.mozpatch - - filename: js-locale.mozpatch - filename: 824009fbc42f.mozpatch enable: '[% c("var/windows") %]' - filename: Bug-1133689-backport-Make-D3DVsyncDisplay-destructor.mozpatch diff --git a/projects/instantbird/js-locale.mozpatch b/projects/instantbird/js-locale.mozpatch deleted file mode 100644 index bf45525..0000000 --- a/projects/instantbird/js-locale.mozpatch +++ /dev/null @@ -1,204 +0,0 @@ -diff --git a/browser/base/content/test/general/mochitest.ini b/browser/base/content/test/general/mochitest.ini -index 139133e..a129d73 100644 ---- a/browser/base/content/test/general/mochitest.ini -+++ b/browser/base/content/test/general/mochitest.ini -@@ -28,6 +28,7 @@ support-files = - - [test_bug364677.html] - [test_bug395533.html] -+[test_bug_jsdefaultlocale.html] - [test_contextmenu.html] - skip-if = toolkit == "gtk2" || toolkit == "gtk3" || (os == 'mac' && os_version != '10.6') # disabled on Linux due to bug 513558, on Mac after 10.6 due to bug 792304 - [test_contextmenu_input.html] -diff --git a/browser/base/content/test/general/test_bug_jsdefaultlocale.html b/browser/base/content/test/general/test_bug_jsdefaultlocale.html -new file mode 100644 -index 0000000..6566ae0 ---- /dev/null -+++ b/browser/base/content/test/general/test_bug_jsdefaultlocale.html -@@ -0,0 +1,41 @@ -+<!DOCTYPE HTML> -+<html> -+<!-- -+https://bugs.torproject.org/13019 -+--> -+<head> -+ <meta charset="utf-8"> -+ <title>Test for Tor Bug #13019: Prevent fingerprinting of JS-exposed locale</title> -+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> -+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> -+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -+</head> -+<body> -+<a target="_blank" href="https://bugs.torproject.org">Bug 13019</a> -+<p id="display"></p> -+<pre id="test"></pre> -+<script type="application/javascript;version=1.8"> -+let prefName = "javascript.use_us_english_locale", -+ originalPrefValue = null, -+ date = new Date(); -+// Read the current pref value. -+try { -+ originalPrefValue = SpecialPowers.getBoolPref(prefName); -+} catch (e) { } -+// Enable pref "javascript.use_us_english_locale". -+SpecialPowers.setBoolPref(prefName, true); -+// Test that we are getting en-US locale everywhere it is exposed in JavaScript -+is(Intl.Collator().resolvedOptions().locale, "en-US", "content JS locale from Intl.Collator"); -+is(Intl.DateTimeFormat().resolvedOptions().locale, "en-US", "content JS locale Intl.DateTimeFormat"); -+is(Intl.NumberFormat().resolvedOptions().locale, "en-US", "content JS locale from Intl.NumberFormat"); -+is(date.toLocaleString(), date.toLocaleString("en-US"), "Date formatted by JS locale"); -+// Return pref to its original value, if it had one. -+if (originalPrefValue === null) { -+ SpecialPowers.clearUserPref(prefName); -+} else { -+ SpecialPowers.setBoolPref(prefName, originalPrefValue); -+} -+ -+</script> -+</body> -+</html> -diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp -index 169981e9..877056e 100644 ---- a/js/src/jsapi.cpp -+++ b/js/src/jsapi.cpp -@@ -5217,6 +5217,13 @@ JS_SetDefaultLocale(JSRuntime* rt, const char* locale) - return rt->setDefaultLocale(locale); - } - -+JS_PUBLIC_API(const char*) -+JS_GetDefaultLocale(JSRuntime *rt) -+{ -+ AssertHeapIsIdle(rt); -+ return rt->getDefaultLocale(); -+} -+ - JS_PUBLIC_API(void) - JS_ResetDefaultLocale(JSRuntime* rt) - { -diff --git a/js/src/jsapi.h b/js/src/jsapi.h -index 2b279b5..2a6fe34 100644 ---- a/js/src/jsapi.h -+++ b/js/src/jsapi.h -@@ -4266,6 +4266,15 @@ extern JS_PUBLIC_API(bool) - JS_SetDefaultLocale(JSRuntime* rt, const char* locale); - - /* -+ * Returns the default locale for the ECMAScript Internationalization API -+ * (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat). -+ * Note that the Internationalization API encourages clients to -+ * specify their own locales. -+ */ -+extern JS_PUBLIC_API(const char*) -+JS_GetDefaultLocale(JSRuntime *rt); -+ -+/* - * Reset the default locale to OS defaults. - */ - extern JS_PUBLIC_API(void) -diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp -index a58d89c..292652d 100644 ---- a/xpcom/build/XPCOMInit.cpp -+++ b/xpcom/build/XPCOMInit.cpp -@@ -8,6 +8,7 @@ - - #include "mozilla/Atomics.h" - #include "mozilla/Poison.h" -+#include "mozilla/Preferences.h" - #include "mozilla/XPCOM.h" - #include "nsXULAppAPI.h" - -@@ -43,6 +44,8 @@ - #include "nsSupportsPrimitives.h" - #include "nsConsoleService.h" - -+#include "nsIJSRuntimeService.h" -+ - #include "nsComponentManager.h" - #include "nsCategoryManagerUtils.h" - #include "nsIServiceManager.h" -@@ -485,6 +488,67 @@ NS_IMPL_ISUPPORTS(NesteggReporter, nsIMemoryReporter) - CountingAllocatorBase<NesteggReporter>::sAmount(0); - #endif /* MOZ_WEBM */ - -+// Anonymous namespace for customizing the default locale that JavaScript -+// uses, according to the value of the "javascript.use_us_english_locale" pref. -+// The current default locale can be detected in JavaScript by calling -+// `Intl.DateTimeFormat().resolvedOptions().locale` -+namespace { -+ -+#define USE_US_ENGLISH_LOCALE_PREF "javascript.use_us_english_locale" -+ -+static char* sSystemLocale; -+static char* sJSLocale; -+ -+// Returns a pointer to the current JS Runtime. -+static -+JSRuntime* GetRuntime() { -+ nsresult rv; -+ nsCOMPtr<nsIJSRuntimeService> rts = do_GetService("@mozilla.org/js/xpc/RuntimeService;1", &rv); -+ if (NS_FAILED(rv)) return NULL; -+ JSRuntime* rt; -+ rts->GetRuntime(&rt); -+ return rt; -+} -+ -+// If the USE_US_ENGLISH_LOCALE_PREF is active, set all locales to US English. -+// Otherwise, fall back to the default system and JS locales. -+static -+void UseUSEnglishLocalePrefChangedCallback(const char* /* pref */, void* /* closure */) { -+ // Get a pointer to the default JS Runtime. -+ JSRuntime* rt = GetRuntime(); -+ if (rt) { -+ // Read the pref to see if we will use US English locale. -+ bool useUSEnglishLocale = mozilla::Preferences::GetBool(USE_US_ENGLISH_LOCALE_PREF, false); -+ // Set the application-wide C-locale. Needed for Date.toLocaleFormat(). -+ setlocale(LC_ALL, useUSEnglishLocale ? "C" : sSystemLocale); -+ // Now override the JavaScript Runtime Locale that is used by the Intl API -+ // as well as Date.toLocaleString, Number.toLocaleString, and String.localeCompare. -+ JS_SetDefaultLocale(rt, useUSEnglishLocale ? "en-US" : sJSLocale); -+ } -+} -+ -+static -+void StartWatchingUseUSEnglishLocalePref() { -+ // Get the default system locale. To be used if US English locale pref is deactivated. -+ sSystemLocale = strdup(setlocale(LC_ALL,NULL)); -+ // Store the default JavaScript locale. -+ JSRuntime* rt = GetRuntime(); -+ if (rt) { -+ sJSLocale = strdup(JS_GetDefaultLocale(rt)); -+ } -+ // Now keep the locale updated with the current pref value. -+ mozilla::Preferences::RegisterCallbackAndCall(UseUSEnglishLocalePrefChangedCallback, USE_US_ENGLISH_LOCALE_PREF); -+} -+ -+static -+void StopWatchingUseUSEnglishLocalePref() { -+ mozilla::Preferences::UnregisterCallback(UseUSEnglishLocalePrefChangedCallback, USE_US_ENGLISH_LOCALE_PREF); -+ if (sSystemLocale) free(sSystemLocale); -+ if (sJSLocale) JS_free(nullptr, sJSLocale); -+} -+ -+} // anonymous namespace for locale hiding -+ - // Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser - EXPORT_XPCOM_API(nsresult) - NS_InitXPCOM2(nsIServiceManager** aResult, -@@ -766,6 +830,8 @@ NS_InitXPCOM2(nsIServiceManager** aResult, - mozilla::eventtracer::Init(); - #endif - -+ // Start watching the "javascript.use_us_english_locale" pref. -+ StartWatchingUseUSEnglishLocalePref(); - return NS_OK; - } - -@@ -1038,6 +1104,8 @@ ShutdownXPCOM(nsIServiceManager* aServMgr) - delete sExitManager; - sExitManager = nullptr; - -+ StopWatchingUseUSEnglishLocalePref(); -+ - Omnijar::CleanUp(); - - HangMonitor::Shutdown(); diff --git a/projects/instantbird/search-preferences-xul.patch b/projects/instantbird/search-preferences-xul.patch index 647d9a5..a6b2a31 100644 --- a/projects/instantbird/search-preferences-xul.patch +++ b/projects/instantbird/search-preferences-xul.patch @@ -1,7 +1,7 @@ diff --git a/im/content/preferences/advanced.xul b/im/content/preferences/advanced.xul --- a/im/content/preferences/advanced.xul +++ b/im/content/preferences/advanced.xul -@@ -135,17 +135,6 @@ +@@ -143,17 +143,6 @@ preference="layout.spellcheckDefault"/> </groupbox>
@@ -16,6 +16,6 @@ diff --git a/im/content/preferences/advanced.xul b/im/content/preferences/advanc - oncommand="gAdvancedPane.showSearchEngineManager();"/> - </groupbox> - - #ifdef HAVE_SHELL_SERVICE - <!-- System Defaults --> - <groupbox id="systemDefaultsGroup" orient="horizontal"> + <!-- Advanced Configuration --> + <groupbox> + <caption label="&configEditDesc.label;"/> diff --git a/projects/instantbird/top-protocols.patch b/projects/instantbird/top-protocols.patch index c6c58a5..f808beb 100644 --- a/projects/instantbird/top-protocols.patch +++ b/projects/instantbird/top-protocols.patch @@ -1,19 +1,12 @@ -# HG changeset patch -# User Sukhbir Singh sukhbir@torproject.org -# Date 1414029949 -19800 -# Thu Oct 23 07:35:49 2014 +0530 -# Node ID 947732f86131ec2882340344ba0c29cc9943de48 -# Parent 1d142c56cdf63cb3b0bcab81607c72c4b8a04599 -Redesign the account creation protocol screen (closes #13323) - diff --git a/im/locales/en-US/chrome/instantbird/accountWizard.properties b/im/locales/en-US/chrome/instantbird/accountWizard.properties +index da7d6b7..90fbf3e 100644 --- a/im/locales/en-US/chrome/instantbird/accountWizard.properties +++ b/im/locales/en-US/chrome/instantbird/accountWizard.properties @@ -8,11 +8,13 @@ # Exceeding 4 protocols may cause scrolling. A list of the # available protocols can be found at # https://wiki.instantbird.org/Protocol_Identifiers --topProtocol.list=prpl-gtalk,prpl-facebook,prpl-twitter,prpl-aim,prpl-msn,prpl-yahoo +-topProtocol.list=prpl-gtalk,prpl-facebook,prpl-twitter,prpl-aim,prpl-yahoo +topProtocol.list=prpl-irc,prpl-jabber,prpl-gtalk,prpl-facebook
# LOCALIZATION NOTE