diff options
| -rw-r--r-- | firefox-packager-build.patch | 12 | ||||
| -rw-r--r-- | firefox-redhat-default-prefs.js | 2 | ||||
| -rw-r--r-- | firefox.1 | 55 | ||||
| -rw-r--r-- | firefox.spec | 89 | ||||
| -rw-r--r-- | mozilla-239254.patch | 483 | 
5 files changed, 105 insertions, 536 deletions
diff --git a/firefox-packager-build.patch b/firefox-packager-build.patch new file mode 100644 index 0000000..f35d566 --- /dev/null +++ b/firefox-packager-build.patch @@ -0,0 +1,12 @@ +diff -up firefox-21.0/mozilla-release/toolkit/mozapps/installer/packager.py.old firefox-21.0/mozilla-release/toolkit/mozapps/installer/packager.py +--- firefox-21.0/mozilla-release/toolkit/mozapps/installer/packager.py.old	2013-05-15 08:27:23.000000000 +0200 ++++ firefox-21.0/mozilla-release/toolkit/mozapps/installer/packager.py	2013-05-15 08:27:54.828483740 +0200 +@@ -344,7 +344,7 @@ def main(): +     # Fill startup cache +     if isinstance(formatter, OmniJarFormatter) and launcher.can_launch(): +         if buildconfig.substs['LIBXUL_SDK']: +-            gre_path = buildconfig.substs['LIBXUL_DIST'] ++            gre_path = buildconfig.substs['LIBXUL_DIST'] + '/bin' +         else: +             gre_path = None +         for base in sorted([[p for p in [mozpack.path.join('bin', b), b] diff --git a/firefox-redhat-default-prefs.js b/firefox-redhat-default-prefs.js index 825f6ff..1b07ed4 100644 --- a/firefox-redhat-default-prefs.js +++ b/firefox-redhat-default-prefs.js @@ -11,3 +11,5 @@ pref("dom.ipc.plugins.enabled.nswrapper*",  false);  pref("extensions.shownSelectionUI",         true);  pref("extensions.autoDisableScope",         0);  pref("gfx.color_management.enablev4",       true); +pref("ui.SpellCheckerUnderlineStyle",       1); +pref("startup.homepage_override_url",       ""); @@ -56,18 +56,9 @@ Make all warnings fatal  .SS "Firefox options"  .TP -\fB\-height\fR \fIvalue\fR -Set height of startup window to \fIvalue\fR. -.TP  .B \-h, \-help  Show summary of options.  .TP -.B \-installer -Start with 4.x migration window. -.TP -\fB\-width\fR \fIvalue\fR -Set width of startup window to \fIvalue\fR. -.TP  .B \-v, \-version  Print \fB/usr/bin/firefox-bin\fR version.  .TP @@ -77,31 +68,53 @@ Create \fIprofile\fR.  \fB\-P\fR \fIprofile\fR  Start with \fIprofile\fR.  .TP -.B \-ProfileWizard -Start with profile wizard. -.TP  .B \-ProfileManager  Start with profile manager.  .TP -.B \-SelectProfile -Start with profile selection dialog. -.TP -\fB\-lang\fR \fIlang-region\fR -Start with \fIlang-region\fR resources. -.TP  \fB\-remote\fR \fIcommand\fR  Execute \fIcommand\fR in an already running Firefox process.  For more info,  see: \fIhttp://www.mozilla.org/unix/remote.html\fR  .TP -.B \-splash -Enable splash screen. -.TP  .B \-jsconsole  Start with Javascript Console  .TP  \fB\-chrome\fR \fIurl\fR  Load the specified chrome.  .TP +\fB\-no\-remote\fR +Don't connect to any other running instances of \fBfirefox\fR. Use this if you want to run \fBfirefox\fR +in an entirely new process. By default, \fBfirefox\fR will delegate a command to an already running instance. +.TP +\fB\-safe\-mode\fR +Start \fBfirefox\fR in safe-mode. This disables all third-party extensions, and may be necessary if +you are having problems with an extension you installed. +.TP +\fB\-new\-tab\fR \fIurl\fR +Open \fIurl\fR in a new tab. +.TP +\fB\-new\-window\fR \fIurl\fR +Open \fIurl\fR in a new window. +.TP +\fB\-preferences\fR +Open the preferences dialog. +.TP +\fB\-private\fR +Start \fBfirefox\fR in private browsing mode. +.TP +\fB\-private\-toggle\fR +Toggle private browsing mode. +.TP +\fB\-setDefaultBrowser\fR +Set \fBfirefox\fR as the default web browser. +.TP +\fB\-search\fR \fIterm\fR +Search for \fIterm\fR with your default search engine. +.TP +\fB\-migration\fR +Start with migration wizard. +.TP +\fB\-new-instance\fR +Open new instance, not a new window in running instance.  .SH FILES  \fI/usr/bin/firefox\fR - shell script wrapping diff --git a/firefox.spec b/firefox.spec index cfb96ba..d096a14 100644 --- a/firefox.spec +++ b/firefox.spec @@ -1,5 +1,5 @@  # Use system nss/nspr? -%if 0%{?fedora} < 17 +%if 0%{?fedora} < 18  %define system_nss        0  %else  %define system_nss        1 @@ -33,13 +33,13 @@  %define default_bookmarks_file %{_datadir}/bookmarks/default-bookmarks.html  %define firefox_app_id \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} -%global xulrunner_version      20.0.1 -%global xulrunner_version_max  20.1 +%global xulrunner_version      21.0 +%global xulrunner_version_max  21.1  %global xulrunner_release      1  %global alpha_version          0  %global beta_version           0  %global rc_version             0 -%global datelang               20130415 +%global datelang               20130514  %global mozappdir     %{_libdir}/firefox  %global langpackdir   %{mozappdir}/langpacks @@ -74,7 +74,7 @@  Summary:        Mozilla Firefox Web browser  Name:           firefox -Version:        20.0.1 +Version:        21.0  Release:        1%{?pre_tag}%{?dist}  URL:            http://www.mozilla.org/projects/firefox/  License:        MPLv1.1 or GPLv2+ or LGPLv2+ @@ -93,6 +93,7 @@ Source23:       firefox.1  #Build patches  Patch0:         firefox-install-dir.patch +Patch1:         firefox-packager-build.patch  # Fedora patches  Patch14:        firefox-5.0-asciidel.patch @@ -100,7 +101,6 @@ Patch15:        firefox-15.0-enable-addons.patch  Patch16:        firefox-duckduckgo.patch  # Upstream patches -Patch100:       mozilla-239254.patch  %if %{official_branding}  # Required by Mozilla Corporation @@ -145,6 +145,7 @@ cd %{tarballdir}  # there is a compare of config and js/config directories and .orig suffix is   # ignored during this compare.  %patch0 -p1 +%patch1 -p2 -b .build  # For branding specific patches. @@ -154,7 +155,6 @@ cd %{tarballdir}  %patch16 -p1 -b .duckduckgo  # Upstream patches -%patch100 -p1 -b .239254  %if %{official_branding}  # Required by Mozilla Corporation @@ -188,8 +188,14 @@ echo "ac_add_options --disable-system-cairo" >> .mozconfig  %endif  # Set up SDK path -echo "ac_add_options --with-libxul-sdk=\ -`pkg-config --variable=sdkdir libxul`" >> .mozconfig +MOZILLA_SDK_PATH=`pkg-config --variable=sdkdir libxul` +if [ -z $MOZILLA_SDK_PATH ]; then +    echo "XulRunner SDK is not available!" +    exit 1 +else +    echo "XulRunner SDK path: $MOZILLA_SDK_PATH" +    echo "ac_add_options --with-libxul-sdk=$MOZILLA_SDK_PATH" >> .mozconfig +fi  %if !%{?separated_plugins}  echo "ac_add_options --disable-ipc" >> .mozconfig @@ -277,7 +283,7 @@ cd %{tarballdir}  # set up our prefs and add it to the package manifest file, so it gets pulled in  # to omni.jar which gets created during make install -%{__cp} %{SOURCE12} dist/bin/defaults/preferences/all-redhat.js +%{__cp} %{SOURCE12} dist/bin/browser/defaults/preferences/all-redhat.js  # This sed call "replaces" firefox.js with all-redhat.js, newline, and itself (&)  # having the net effect of prepending all-redhat.js above firefox.js  %{__sed} -i -e\ @@ -285,15 +291,15 @@ cd %{tarballdir}      browser/installer/package-manifest.in  # set up our default bookmarks -%{__cp} -p %{default_bookmarks_file} dist/bin/defaults/profile/bookmarks.html +%{__cp} -p %{default_bookmarks_file} dist/bin/browser/defaults/profile/bookmarks.html  # Make sure locale works for langpacks -%{__cat} > dist/bin/defaults/preferences/firefox-l10n.js << EOF +%{__cat} > dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF  pref("general.useragent.locale", "chrome://global/locale/intl.properties");  EOF  # resolves bug #461880 -%{__cat} > dist/bin/chrome/en-US/locale/branding/browserconfig.properties << EOF +%{__cat} > dist/bin/browser/chrome/en-US/locale/branding/browserconfig.properties << EOF  browser.startup.homepage=%{homepage}  EOF @@ -342,14 +348,14 @@ for langpack in `ls firefox-langpacks/*.xpi`; do    language=`basename $langpack .xpi`    extensionID=langpack-$language@firefox.mozilla.org    %{__mkdir_p} $extensionID -  unzip $langpack -d $extensionID +  unzip -qq $langpack -d $extensionID    find $extensionID -type f | xargs chmod 644    sed -i -e "s|browser.startup.homepage.*$|browser.startup.homepage=%{homepage}|g;" \ -     $extensionID/chrome/$language/locale/branding/browserconfig.properties +     $extensionID/browser/chrome/$language/locale/branding/browserconfig.properties    cd $extensionID -  zip -r9mX ../${extensionID}.xpi * +  zip -qq -r9mX ../${extensionID}.xpi *    cd -    %{__install} -m 644 ${extensionID}.xpi $RPM_BUILD_ROOT%{langpackdir} @@ -385,6 +391,9 @@ create_default_langpack "sv-SE" "sv"  create_default_langpack "zh-TW" "zh"  %endif # build_langpacks +# New preferences dir +%{__mkdir_p} $RPM_BUILD_ROOT/%{mozappdir}/browser/defaults/preferences +  # System extensions  %{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/mozilla/extensions/%{firefox_app_id}  %{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/mozilla/extensions/%{firefox_app_id} @@ -392,9 +401,6 @@ create_default_langpack "zh-TW" "zh"  # Copy over the LICENSE  %{__install} -p -c -m 644 LICENSE $RPM_BUILD_ROOT/%{mozappdir} -# Remove tmp files -find $RPM_BUILD_ROOT/%{mozappdir}/modules -name '.mkdir.done' -exec rm -rf {} \; -  # Enable crash reporter for Firefox application  %if %{include_debuginfo}  sed -i -e "s/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/" $RPM_BUILD_ROOT/%{mozappdir}/application.ini @@ -447,21 +453,21 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :  %{_datadir}/applications/*.desktop  %dir %{mozappdir}  %doc %{mozappdir}/LICENSE -%{mozappdir}/chrome -%{mozappdir}/chrome.manifest -%dir %{mozappdir}/components -%{mozappdir}/components/*.so -%{mozappdir}/components/binary.manifest -%{mozappdir}/defaults/preferences/channel-prefs.js -%attr(644, root, root) %{mozappdir}/blocklist.xml -%dir %{mozappdir}/extensions -%{mozappdir}/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} +%{mozappdir}/browser/chrome +%{mozappdir}/browser/chrome.manifest +%dir %{mozappdir}/browser/components +%{mozappdir}/browser/components/*.so +%{mozappdir}/browser/components/components.manifest +%dir %{mozappdir}/browser/defaults/preferences +%attr(644, root, root) %{mozappdir}/browser/blocklist.xml +%dir %{mozappdir}/browser/extensions +%{mozappdir}/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}  %if %{build_langpacks}  %dir %{langpackdir}  %endif -%{mozappdir}/omni.ja -%{mozappdir}/icons -%{mozappdir}/searchplugins +%{mozappdir}/browser/omni.ja +%{mozappdir}/browser/icons +%{mozappdir}/browser/searchplugins  %{mozappdir}/run-mozilla.sh  %{mozappdir}/application.ini  %exclude %{mozappdir}/removed-files @@ -473,7 +479,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :  %{_datadir}/icons/hicolor/48x48/apps/firefox.png  %{mozappdir}/xulrunner  %{mozappdir}/webapprt-stub -%{mozappdir}/modules/*  %dir %{mozappdir}/webapprt  %{mozappdir}/webapprt/omni.ja  %{mozappdir}/webapprt/webapprt.ini @@ -487,6 +492,26 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :  #---------------------------------------------------------------------  %changelog +* Tue May 14 2013 Remi Collet <RPMS@FamilleCollet.com> - 21.0-1 +- Update to 21.0 + +* Tue May 14 2013 Martin Stransky <stransky@redhat.com> - 21.0-1 +- Updated to latest upstream (21.0) + +* Thu May 9 2013 Martin Stransky <stransky@redhat.com> - 20.0-5 +- Removed firstrun page (rhbz#864793) +- Made zip/unzip quiet in langpacks processing + +* Thu Apr 18 2013 Martin Stransky <stransky@redhat.com> - 20.0-4 +- Updated xulrunner check + +* Thu Apr 18 2013 Martin Stransky <stransky@redhat.com> - 20.0-3 +- Added a workaround for rhbz#907424 - textarea redrawn wrongly  +  during edit + +* Thu Apr 18 2013 Jan Horak <jhorak@redhat.com> - 20.0-2 +- Updated manual page +  * Mon Apr 15 2013 Remi Collet <RPMS@FamilleCollet.com> - 20.0.1-1  - Update to 20.0.1 diff --git a/mozilla-239254.patch b/mozilla-239254.patch deleted file mode 100644 index 9ce3838..0000000 --- a/mozilla-239254.patch +++ /dev/null @@ -1,483 +0,0 @@ -# HG changeset patch -# Parent cb34bd8957ec517c72d506f7c439e3af1950e38d -# User Martin Stransky <stransky@redhat.com> -Bug 239254 - [Linux] Support disk cache on a local path, r=michal.novotny - -diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp ---- a/netwerk/cache/nsCacheService.cpp -+++ b/netwerk/cache/nsCacheService.cpp -@@ -712,27 +712,18 @@ nsCacheProfilePrefObserver::ReadPrefs(ns -             nsCOMPtr<nsIFile> profDir; -             NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, -                                    getter_AddRefs(profDir)); -             NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR, -                                    getter_AddRefs(directory)); -             if (!directory) -                 directory = profDir; -             else if (profDir) { --                bool same; --                if (NS_SUCCEEDED(profDir->Equals(directory, &same)) && !same) { --                    // We no longer store the cache directory in the main --                    // profile directory, so we should cleanup the old one. --                    rv = profDir->AppendNative(NS_LITERAL_CSTRING("Cache")); --                    if (NS_SUCCEEDED(rv)) { --                        bool exists; --                        if (NS_SUCCEEDED(profDir->Exists(&exists)) && exists) --                            nsDeleteDir::DeleteDir(profDir, false); --                    } --                } -+                nsCacheService::MoveOrRemoveDiskCache(profDir, directory,  -+                                                      "Cache"); -             } -         } -         // use file cache in build tree only if asked, to avoid cache dir litter -         if (!directory && PR_GetEnv("NECKO_DEV_ENABLE_DISK_CACHE")) { -             rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, -                                         getter_AddRefs(directory)); -         } -         if (directory) -@@ -788,16 +779,20 @@ nsCacheProfilePrefObserver::ReadPrefs(ns -             // try to get the profile directory (there may not be a profile yet) -             nsCOMPtr<nsIFile> profDir; -             NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, -                                    getter_AddRefs(profDir)); -             NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR, -                                    getter_AddRefs(directory)); -             if (!directory) -                 directory = profDir; -+            else if (profDir) { -+                nsCacheService::MoveOrRemoveDiskCache(profDir, directory,  -+                                                      "OfflineCache"); -+            } -         } - #if DEBUG -         if (!directory) { -             // use current process directory during development -             rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, -                                         getter_AddRefs(directory)); -         } - #endif -@@ -3012,16 +3007,67 @@ nsCacheService::SetDiskSmartSize_Locked( -         DispatchToCacheIOThread(event); -     } else { -         return NS_ERROR_FAILURE; -     } -  -     return NS_OK; - } -  -+void -+nsCacheService::MoveOrRemoveDiskCache(nsIFile *aOldCacheDir,  -+                                      nsIFile *aNewCacheDir, -+                                      const char *aCacheSubdir) -+{ -+    bool same; -+    if (NS_FAILED(aOldCacheDir->Equals(aNewCacheDir, &same)) || same) -+        return; -+ -+    nsCOMPtr<nsIFile> aOldCacheSubdir; -+    aOldCacheDir->Clone(getter_AddRefs(aOldCacheSubdir)); -+ -+    nsresult rv = aOldCacheSubdir->AppendNative( -+        nsDependentCString(aCacheSubdir)); -+    if (NS_FAILED(rv)) -+        return; -+ -+    bool exists; -+    if (NS_FAILED(aOldCacheSubdir->Exists(&exists)) || !exists) -+        return; -+ -+    nsCOMPtr<nsIFile> aNewCacheSubdir; -+    aNewCacheDir->Clone(getter_AddRefs(aNewCacheSubdir)); -+ -+    rv = aNewCacheSubdir->AppendNative(nsDependentCString(aCacheSubdir)); -+    if (NS_FAILED(rv)) -+        return; -+     -+    nsAutoCString newPath; -+    rv = aNewCacheSubdir->GetNativePath(newPath); -+    if (NS_FAILED(rv)) -+        return; -+         -+    if (NS_SUCCEEDED(aNewCacheSubdir->Exists(&exists)) && !exists) { -+        // New cache directory does not exist, try to move the old one here -+        // rename needs an empty target directory -+        rv = aNewCacheSubdir->Create(nsIFile::DIRECTORY_TYPE, 0777);  -+        if (NS_SUCCEEDED(rv)) { -+            nsAutoCString oldPath; -+            rv = aOldCacheSubdir->GetNativePath(oldPath); -+            if (NS_FAILED(rv)) -+                return; -+            if(rename(oldPath.get(), newPath.get()) == 0) -+                return; -+        } -+    } -+     -+    // Delay delete by 1 minute to avoid IO thrash on startup. -+    nsDeleteDir::DeleteDir(aOldCacheSubdir, false, 60000); -+} -+ - static bool - IsEntryPrivate(nsCacheEntry* entry) - { -     return entry->IsPrivate(); - } -  - void - nsCacheService::LeavePrivateBrowsing() -diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h ---- a/netwerk/cache/nsCacheService.h -+++ b/netwerk/cache/nsCacheService.h -@@ -194,16 +194,20 @@ public: -  -     static void      SetMemoryCache(); -  -     static void      SetCacheCompressionLevel(int32_t level); -  -     // Starts smart cache size computation if disk device is available -     static nsresult  SetDiskSmartSize(); -  -+    static void      MoveOrRemoveDiskCache(nsIFile *aOldCacheDir, -+                                           nsIFile *aNewCacheDir, -+                                           const char *aCacheSubdir); -+ -     nsresult         Init(); -     void             Shutdown(); -  -     static bool      IsInitialized() -     { -       if (!gService) { -           return false; -       } -diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp ---- a/startupcache/StartupCache.cpp -+++ b/startupcache/StartupCache.cpp -@@ -168,16 +168,30 @@ StartupCache::Init() -     nsCOMPtr<nsIFile> file; -     rv = NS_GetSpecialDirectory("ProfLDS", -                                 getter_AddRefs(file)); -     if (NS_FAILED(rv)) { -       // return silently, this will fail in mochitests's xpcshell process. -       return rv; -     } -  -+    nsCOMPtr<nsIFile> profDir; -+    NS_GetSpecialDirectory("ProfDS", getter_AddRefs(profDir)); -+    if (profDir) { -+      bool same; -+      if (NS_SUCCEEDED(profDir->Equals(file, &same)) && !same) { -+        // We no longer store the startup cache in the main profile -+        // directory, so we should cleanup the old one. -+        if (NS_SUCCEEDED( -+              profDir->AppendNative(NS_LITERAL_CSTRING("startupCache")))) { -+          profDir->Remove(true); -+        } -+      } -+    } -+ -     rv = file->AppendNative(NS_LITERAL_CSTRING("startupCache")); -     NS_ENSURE_SUCCESS(rv, rv); -  -     // Try to create the directory if it's not there yet -     rv = file->Create(nsIFile::DIRECTORY_TYPE, 0777); -     if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS) -       return rv; -  -diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp ---- a/toolkit/xre/nsXREDirProvider.cpp -+++ b/toolkit/xre/nsXREDirProvider.cpp -@@ -1170,18 +1170,32 @@ nsXREDirProvider::GetUserDataDirectoryHo - #elif defined(MOZ_WIDGET_GONK) -   rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true, -                              getter_AddRefs(localDir)); - #elif defined(XP_UNIX) -   const char* homeDir = getenv("HOME"); -   if (!homeDir || !*homeDir) -     return NS_ERROR_FAILURE; -  --  rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true, --                             getter_AddRefs(localDir)); -+  if (aLocal) { -+    // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache. -+    const char* cacheHome = getenv("XDG_CACHE_HOME"); -+    if (cacheHome && *cacheHome) { -+      rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), true, -+                                 getter_AddRefs(localDir)); -+    } else { -+      rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true, -+                                 getter_AddRefs(localDir)); -+      if (NS_SUCCEEDED(rv)) -+        rv = localDir->AppendNative(NS_LITERAL_CSTRING(".cache")); -+    } -+  } else { -+    rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true, -+                               getter_AddRefs(localDir)); -+  } - #else - #error "Don't know how to get product dir on your platform" - #endif -  -   NS_IF_ADDREF(*aFile = localDir); -   return rv; - } -  -@@ -1256,17 +1270,17 @@ nsXREDirProvider::GetUserDataDirectory(n -                                        const nsACString* aProfileName, -                                        const nsACString* aAppName, -                                        const nsACString* aVendorName) - { -   nsCOMPtr<nsIFile> localDir; -   nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), aLocal); -   NS_ENSURE_SUCCESS(rv, rv); -  --  rv = AppendProfilePath(localDir, aProfileName, aAppName, aVendorName); -+  rv = AppendProfilePath(localDir, aProfileName, aAppName, aVendorName, aLocal); -   NS_ENSURE_SUCCESS(rv, rv); -  - #ifdef DEBUG_jungshik -   nsAutoCString cwd; -   localDir->GetNativePath(cwd); -   printf("nsXREDirProvider::GetUserDataDirectory: %s\n", cwd.get()); - #endif -   rv = EnsureDirectoryExists(localDir); -@@ -1377,17 +1391,18 @@ nsXREDirProvider::AppendSysUserExtension -   return NS_OK; - } -  -  - nsresult - nsXREDirProvider::AppendProfilePath(nsIFile* aFile, -                                     const nsACString* aProfileName, -                                     const nsACString* aAppName, --                                    const nsACString* aVendorName) -+                                    const nsACString* aVendorName, -+                                    bool aLocal) - { -   NS_ASSERTION(aFile, "Null pointer!"); -    -   if (!gAppData) { -     return NS_ERROR_FAILURE; -   } -  -   nsAutoCString profile; -@@ -1439,28 +1454,31 @@ nsXREDirProvider::AppendProfilePath(nsIF -   // The parent of this directory is set in GetUserDataDirectoryHome -   // XXX: handle gAppData->profile properly -   // XXXsmaug ...and the rest of the profile creation! -   MOZ_ASSERT(!aAppName, -              "Profile creation for external applications is not implemented!"); -   rv = aFile->AppendNative(nsDependentCString("mozilla")); -   NS_ENSURE_SUCCESS(rv, rv); - #elif defined(XP_UNIX) --  // Make it hidden (i.e. using the ".") --  nsAutoCString folder("."); -+  nsAutoCString folder; -+  // Make it hidden (by starting with "."), except when local (the -+  // profile is already under ~/.cache or XDG_CACHE_HOME). -+  if (!aLocal) -+    folder.Assign('.'); -  -   if (!profile.IsEmpty()) { -     // Skip any leading path characters -     const char* profileStart = profile.get(); -     while (*profileStart == '/' || *profileStart == '\\') -       profileStart++; -  -     // On the off chance that someone wanted their folder to be hidden don't -     // let it become ".." --    if (*profileStart == '.') -+    if (*profileStart == '.' && !aLocal) -       profileStart++; -  -     folder.Append(profileStart); -     ToLowerCase(folder); -  -     rv = AppendProfileString(aFile, folder.BeginReading()); -   } -   else { -diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h ---- a/toolkit/xre/nsXREDirProvider.h -+++ b/toolkit/xre/nsXREDirProvider.h -@@ -109,17 +109,18 @@ protected: -   static nsresult EnsureDirectoryExists(nsIFile* aDirectory); -   void EnsureProfileFileExists(nsIFile* aFile); -  -   // Determine the profile path within the UAppData directory. This is different -   // on every major platform. -   static nsresult AppendProfilePath(nsIFile* aFile, -                                     const nsACString* aProfileName, -                                     const nsACString* aAppName, --                                    const nsACString* aVendorName); -+                                    const nsACString* aVendorName, -+                                    bool aLocal); -  -   static nsresult AppendSysUserExtensionPath(nsIFile* aFile); -  -   // Internal helper that splits a path into components using the '/' and '\\' -   // delimiters. -   static inline nsresult AppendProfileString(nsIFile* aFile, const char* aPath); -  -   // Calculate and register extension and theme bundle directories. -# HG changeset patch -# User Tim Taubert <ttaubert@mozilla.com> -# Date 1360362227 -3600 -# Node ID 873170d2679ac23114f22543cee3214a940abef3 -Bug 239254 - [Linux] Migrate existing thumbnails to their new local path - -diff --git a/browser/components/thumbnails/PageThumbs.jsm b/browser/components/thumbnails/PageThumbs.jsm ---- a/browser/components/thumbnails/PageThumbs.jsm -+++ b/browser/components/thumbnails/PageThumbs.jsm -@@ -7,17 +7,17 @@ - this.EXPORTED_SYMBOLS = ["PageThumbs", "PageThumbsStorage"]; -  - const Cu = Components.utils; - const Cc = Components.classes; - const Ci = Components.interfaces; -  - const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; - const PREF_STORAGE_VERSION = "browser.pagethumbnails.storage_version"; --const LATEST_STORAGE_VERSION = 2; -+const LATEST_STORAGE_VERSION = 3; -  - const EXPIRATION_MIN_CHUNK_SIZE = 50; - const EXPIRATION_INTERVAL_SECS = 3600; -  - /** -  * Name of the directory in the profile that contains the thumbnails. -  */ - const THUMBNAIL_DIRECTORY = "thumbnails"; -@@ -359,47 +359,51 @@ let PageThumbsStorageMigrator = { -  -   set currentVersion(aVersion) { -     Services.prefs.setIntPref(PREF_STORAGE_VERSION, aVersion); -   }, -  -   migrate: function Migrator_migrate() { -     let version = this.currentVersion; -  --    if (version < 1) { --      this.removeThumbnailsFromRoamingProfile(); --    } --    if (version < 2) { --      this.renameThumbnailsFolder(); -+    // Storage version 1 never made it to beta. -+    // At the time of writing only Windows had (ProfD != ProfLD) and we -+    // needed to move thumbnails from the roaming profile to the locale -+    // one so that they're not needlessly included in backups and/or -+    // written via SMB. -+ -+    // Storage version 2 also never made it to beta. -+    // The thumbnail folder structure has been changed and old thumbnails -+    // were not migrated. Instead, we just renamed the current folder to -+    // "<name>-old" and will remove it later. -+ -+    if (version < 3) { -+      this.migrateToVersion3(); -     } -  -     this.currentVersion = LATEST_STORAGE_VERSION; -   }, -  --  removeThumbnailsFromRoamingProfile: --  function Migrator_removeThumbnailsFromRoamingProfile() { --    let local = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]); -+  /** -+   * Bug 239254 added support for having the disk cache and thumbnail -+   * directories on a local path (i.e. ~/.cache/) under Linux. We'll first -+   * try to move the old thumbnails to their new location. If that's not -+   * possible (because ProfD might be on a different file system than -+   * ProfLD) we'll just discard them. -+   */ -+  migrateToVersion3: function Migrator_migrateToVersion3() { -+    let local = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY], true); -     let roaming = FileUtils.getDir("ProfD", [THUMBNAIL_DIRECTORY]); -  --    if (!roaming.equals(local) && roaming.exists()) { --      roaming.followLinks = false; --      try { --        roaming.remove(true); --      } catch (e) { --        // The directory might not exist or we're not permitted to remove it. --      } --    } --  }, -- --  renameThumbnailsFolder: function Migrator_renameThumbnailsFolder() { --    let dir = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]); --    try { --      dir.moveTo(null, dir.leafName + "-old"); --    } catch (e) { --      // The directory might not exist or we're not permitted to rename it. -+    if (!roaming.equals(local)) { -+      PageThumbsWorker.postMessage({ -+        type: "moveOrDeleteAllThumbnails", -+        from: roaming.path, -+        to: local.path -+      }); -     } -   } - }; -  - let PageThumbsExpiration = { -   _filters: [], -  -   init: function Expiration_init() { -diff --git a/browser/components/thumbnails/PageThumbsWorker.js b/browser/components/thumbnails/PageThumbsWorker.js ---- a/browser/components/thumbnails/PageThumbsWorker.js -+++ b/browser/components/thumbnails/PageThumbsWorker.js -@@ -20,16 +20,19 @@ let PageThumbsWorker = { -  -     switch (msg.type) { -       case "removeFile": -         data.result = this.removeFile(msg); -         break; -       case "expireFilesInDirectory": -         data.result = this.expireFilesInDirectory(msg); -         break; -+      case "moveOrDeleteAllThumbnails": -+        data.result = this.moveOrDeleteAllThumbnails(msg); -+        break; -       default: -         data.result = false; -         data.detail = "message not understood"; -         break; -     } -  -     self.postMessage(data); -   }, -@@ -62,12 +65,35 @@ let PageThumbsWorker = { -   getFileEntriesInDirectory: -   function Worker_getFileEntriesInDirectory(aPath, aSkipFiles) { -     let skip = new Set(aSkipFiles); -     let iter = new OS.File.DirectoryIterator(aPath); -  -     return [entry -             for (entry in iter) -             if (!entry.isDir && !entry.isSymLink && !skip.has(entry.name))]; -+  }, -+ -+  moveOrDeleteAllThumbnails: -+  function Worker_moveOrDeleteAllThumbnails(msg) { -+    if (!OS.File.exists(msg.from)) -+      return true; -+ -+    let iter = new OS.File.DirectoryIterator(msg.from); -+    for (let entry in iter) { -+      if (!entry.isDir && !entry.isSymLink) { -+        let from = OS.Path.join(msg.from, entry.name); -+        let to = OS.Path.join(msg.to, entry.name); -+ -+        try { -+          OS.File.move(from, to, {noOverwrite: true, noCopy: true}); -+        } catch (e) { -+          OS.File.remove(from); -+        } -+      } -+    } -+ -+    OS.File.removeEmptyDir(msg.from); -+    return true; -   } - }; -  - self.onmessage = PageThumbsWorker.handleMessage.bind(PageThumbsWorker);  | 
