From e3bb2acd2407581c04ad14e49a87225d7d7a37cc Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 24 Feb 2013 10:11:02 +0100 Subject: Xulrunner 19.0 --- mozilla-239254.patch | 483 +++++++++++++++++++++++ mozilla-677092-restartless-lang.patch | 698 ---------------------------------- rhbz-911314.patch | 547 ++++++++++++++++++++++++++ xulrunner.spec | 26 +- 4 files changed, 1051 insertions(+), 703 deletions(-) create mode 100644 mozilla-239254.patch delete mode 100644 mozilla-677092-restartless-lang.patch create mode 100644 rhbz-911314.patch diff --git a/mozilla-239254.patch b/mozilla-239254.patch new file mode 100644 index 0000000..9ce3838 --- /dev/null +++ b/mozilla-239254.patch @@ -0,0 +1,483 @@ +# HG changeset patch +# Parent cb34bd8957ec517c72d506f7c439e3af1950e38d +# User Martin Stransky +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 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 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 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 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 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 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 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 +# 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 ++ // "-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); diff --git a/mozilla-677092-restartless-lang.patch b/mozilla-677092-restartless-lang.patch deleted file mode 100644 index a08de9b..0000000 --- a/mozilla-677092-restartless-lang.patch +++ /dev/null @@ -1,698 +0,0 @@ -# HG changeset patch -# User Axel Hecht -# Date 1348128099 -7200 -# Node ID 38adce439c3c0b5fd7a035dc53ffd853e80f87ba -# Parent 08d435dedc7fc19bfad3d31c62daec9013525c6d -bug 677092, make language packs restartless, r=Unfocused -Make language packs just trigger the chrome registration hooks, and -disable picking up bootstrap.js, and declare them restartless. - -diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm ---- a/toolkit/mozapps/extensions/XPIProvider.jsm -+++ b/toolkit/mozapps/extensions/XPIProvider.jsm -@@ -740,8 +740,8 @@ - } - } - else { -- // spell check dictionaries never require a restart -- if (addon.type == "dictionary") -+ // spell check dictionaries and language packs never require a restart -+ if (addon.type == "dictionary" || addon.type == "locale") - addon.bootstrap = true; - - // Only extensions are allowed to provide an optionsURL, optionsType or aboutURL. For -@@ -3695,6 +3695,11 @@ - Components.manager.addBootstrappedManifestLocation(aFile); - - try { -+ // Don't call bootstrap.js methods for language packs, -+ // they only contain chrome. -+ if (aType == "locale") -+ return; -+ - // Load the scope if it hasn't already been loaded - if (!(aId in this.bootstrapScopes)) - this.loadBootstrapScope(aId, aFile, aVersion, aType); -diff --git a/toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/chrome.manifest b/toolkit/mozapps/extensions/test/addons/test_langpack/chrome.manifest -copy from toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/chrome.manifest -copy to toolkit/mozapps/extensions/test/addons/test_langpack/chrome.manifest ---- a/toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/chrome.manifest -+++ b/toolkit/mozapps/extensions/test/addons/test_langpack/chrome.manifest -@@ -1,6 +1,1 @@ --content test-addon-1 chrome/content --# comment! -- locale test-addon-1 en-US locale/en-US -- # commentaire! -- locale test-addon-1 fr-FR locale/fr-FR --overlay chrome://browser/content/browser.xul chrome://test-addon-1/content/overlay.xul -+locale test-langpack x-testing locale/x-testing -diff --git a/toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/install.rdf b/toolkit/mozapps/extensions/test/addons/test_langpack/install.rdf -copy from toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/install.rdf -copy to toolkit/mozapps/extensions/test/addons/test_langpack/install.rdf ---- a/toolkit/mozapps/extensions/test/addons/test_chromemanifest_1/install.rdf -+++ b/toolkit/mozapps/extensions/test/addons/test_langpack/install.rdf -@@ -4,12 +4,12 @@ - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - - -- addon1@tests.mozilla.org -+ langpack-x-testing@tests.mozilla.org -+ 8 - 1.0 - - -- Test 1 -- Test Description -+ Language Pack x-testing - - - -diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js b/toolkit/mozapps/extensions/test/xpcshell/test_langpack.js -copy from toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js -copy to toolkit/mozapps/extensions/test/xpcshell/test_langpack.js ---- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js -+++ b/toolkit/mozapps/extensions/test/xpcshell/test_langpack.js -@@ -2,7 +2,7 @@ - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - --// This verifies that bootstrappable add-ons can be used without restarts. -+// This verifies that language packs can be used without restarts. - Components.utils.import("resource://gre/modules/Services.jsm"); - - // Enable loading extensions from the user scopes -@@ -18,91 +18,22 @@ - userExtDir.append(gAppInfo.ID); - registerDirectory("XREUSysExt", userExtDir.parent); - --Components.utils.import("resource://testing-common/httpd.js"); --var testserver; -+var chrome = Components.classes["@mozilla.org/chrome/chrome-registry;1"] -+ .getService(Components.interfaces.nsIXULChromeRegistry); - --/** -- * This object is both a factory and an mozISpellCheckingEngine implementation (so, it -- * is de-facto a service). It's also an interface requestor that gives out -- * itself when asked for mozISpellCheckingEngine. -- */ --var HunspellEngine = { -- dictionaryDirs: [], -- listener: null, -- -- QueryInterface: function hunspell_qi(iid) { -- if (iid.equals(Components.interfaces.nsISupports) || -- iid.equals(Components.interfaces.nsIFactory) || -- iid.equals(Components.interfaces.mozISpellCheckingEngine)) -- return this; -- throw Components.results.NS_ERROR_NO_INTERFACE; -- }, -- createInstance: function hunspell_ci(outer, iid) { -- if (outer) -- throw Components.results.NS_ERROR_NO_AGGREGATION; -- return this.QueryInterface(iid); -- }, -- lockFactory: function hunspell_lockf(lock) { -- throw Components.results.NS_ERROR_NOT_IMPLEMENTED; -- }, -- -- addDirectory: function hunspell_addDirectory(dir) { -- this.dictionaryDirs.push(dir); -- if (this.listener) -- this.listener("addDirectory"); -- }, -- -- removeDirectory: function hunspell_addDirectory(dir) { -- this.dictionaryDirs.splice(this.dictionaryDirs.indexOf(dir), 1); -- if (this.listener) -- this.listener("removeDirectory"); -- }, -- -- getInterface: function hunspell_gi(iid) { -- if (iid.equals(Components.interfaces.mozISpellCheckingEngine)) -- return this; -- throw Components.results.NS_ERROR_NO_INTERFACE; -- }, -- -- contractID: "@mozilla.org/spellchecker/engine;1", -- classID: Components.ID("{6f3c63bc-a4fd-449b-9a58-a2d9bd972cce}"), -- -- activate: function hunspell_activate() { -- this.origClassID = Components.manager.nsIComponentRegistrar -- .contractIDToCID(this.contractID); -- this.origFactory = Components.manager -- .getClassObject(Components.classes[this.contractID], -- Components.interfaces.nsIFactory); -- -- Components.manager.nsIComponentRegistrar -- .unregisterFactory(this.origClassID, this.origFactory); -- Components.manager.nsIComponentRegistrar.registerFactory(this.classID, -- "Test hunspell", this.contractID, this); -- }, -- -- deactivate: function hunspell_deactivate() { -- Components.manager.nsIComponentRegistrar.unregisterFactory(this.classID, this); -- Components.manager.nsIComponentRegistrar.registerFactory(this.origClassID, -- "Hunspell", this.contractID, this.origFactory); -- }, -- -- isDictionaryEnabled: function hunspell_isDictionaryEnabled(name) { -- return this.dictionaryDirs.some(function(dir) { -- var dic = dir.clone(); -- dic.append(name); -- return dic.exists(); -- }); -+function do_check_locale_not_registered(provider) { -+ let didThrow = false; -+ try { -+ chrome.getSelectedLocale(provider); -+ } catch (e) { -+ didThrow = true; - } --}; -+ do_check_true(didThrow); -+} - - function run_test() { - do_test_pending(); - -- // Create and configure the HTTP server. -- testserver = new HttpServer(); -- testserver.registerDirectory("/addons/", do_get_file("addons")); -- testserver.start(4444); -- - startupManager(); - - run_test_1(); -@@ -114,25 +45,22 @@ - "onNewInstall" - ]); - -- HunspellEngine.activate(); -- -- AddonManager.getInstallForFile(do_get_addon("test_dictionary"), function(install) { -+ AddonManager.getInstallForFile(do_get_addon("test_langpack"), function(install) { - ensure_test_completed(); - - do_check_neq(install, null); -- do_check_eq(install.type, "dictionary"); -+ do_check_eq(install.type, "locale"); - do_check_eq(install.version, "1.0"); -- do_check_eq(install.name, "Test Dictionary"); -+ do_check_eq(install.name, "Language Pack x-testing"); - do_check_eq(install.state, AddonManager.STATE_DOWNLOADED); - do_check_true(install.addon.hasResource("install.rdf")); - do_check_false(install.addon.hasResource("bootstrap.js")); - do_check_eq(install.addon.operationsRequiringRestart & - AddonManager.OP_NEEDS_RESTART_INSTALL, 0); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); - - let addon = install.addon; - prepare_test({ -- "ab-CD@dictionaries.addons.mozilla.org": [ -+ "langpack-x-testing@tests.mozilla.org": [ - ["onInstalling", false], - "onInstalled" - ] -@@ -141,11 +69,7 @@ - "onInstallEnded", - ], function() { - do_check_true(addon.hasResource("install.rdf")); -- HunspellEngine.listener = function(aEvent) { -- HunspellEngine.listener = null; -- do_check_eq(aEvent, "addDirectory"); -- check_test_1(); -- }; -+ check_test_1(); - }); - install.install(); - }); -@@ -157,18 +81,18 @@ - // doesn't require a restart. - do_check_eq(installs.length, 0); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - do_check_neq(b1, null); - do_check_eq(b1.version, "1.0"); - do_check_false(b1.appDisabled); - do_check_false(b1.userDisabled); - do_check_true(b1.isActive); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -+ // check chrome reg that language pack is registered -+ do_check_eq(chrome.getSelectedLocale("test-langpack"), "x-testing"); - do_check_true(b1.hasResource("install.rdf")); - do_check_false(b1.hasResource("bootstrap.js")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); - -- let dir = do_get_addon_root_uri(profileDir, "ab-CD@dictionaries.addons.mozilla.org"); -+ let dir = do_get_addon_root_uri(profileDir, "langpack-x-testing@tests.mozilla.org"); - - AddonManager.getAddonsWithOperationsByTypes(null, function(list) { - do_check_eq(list.length, 0); -@@ -181,9 +105,9 @@ - - // Tests that disabling doesn't require a restart - function run_test_2() { -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - prepare_test({ -- "ab-CD@dictionaries.addons.mozilla.org": [ -+ "langpack-x-testing@tests.mozilla.org": [ - ["onDisabling", false], - "onDisabled" - ] -@@ -199,10 +123,10 @@ - do_check_false(b1.appDisabled); - do_check_true(b1.userDisabled); - do_check_false(b1.isActive); -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -+ // check chrome reg that language pack is not registered -+ do_check_locale_not_registered("test-langpack"); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(newb1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(newb1) { - do_check_neq(newb1, null); - do_check_eq(newb1.version, "1.0"); - do_check_false(newb1.appDisabled); -@@ -217,12 +141,11 @@ - // Test that restarting doesn't accidentally re-enable - function run_test_3() { - shutdownManager(); -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); - startupManager(false); -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -+ // check chrome reg that language pack is not registered -+ do_check_locale_not_registered("test-langpack"); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - do_check_neq(b1, null); - do_check_eq(b1.version, "1.0"); - do_check_false(b1.appDisabled); -@@ -235,9 +158,9 @@ - - // Tests that enabling doesn't require a restart - function run_test_4() { -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - prepare_test({ -- "ab-CD@dictionaries.addons.mozilla.org": [ -+ "langpack-x-testing@tests.mozilla.org": [ - ["onEnabling", false], - "onEnabled" - ] -@@ -253,10 +176,10 @@ - do_check_false(b1.appDisabled); - do_check_false(b1.userDisabled); - do_check_true(b1.isActive); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -+ // check chrome reg that language pack is registered -+ do_check_eq(chrome.getSelectedLocale("test-langpack"), "x-testing"); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(newb1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(newb1) { - do_check_neq(newb1, null); - do_check_eq(newb1.version, "1.0"); - do_check_false(newb1.appDisabled); -@@ -271,13 +194,11 @@ - // Tests that a restart shuts down and restarts the add-on - function run_test_5() { - shutdownManager(); -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); - startupManager(false); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -+ // check chrome reg that language pack is registered -+ do_check_eq(chrome.getSelectedLocale("test-langpack"), "x-testing"); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - do_check_neq(b1, null); - do_check_eq(b1.version, "1.0"); - do_check_false(b1.appDisabled); -@@ -291,9 +212,9 @@ - - // Tests that uninstalling doesn't require a restart - function run_test_7() { -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - prepare_test({ -- "ab-CD@dictionaries.addons.mozilla.org": [ -+ "langpack-x-testing@tests.mozilla.org": [ - ["onUninstalling", false], - "onUninstalled" - ] -@@ -309,333 +230,18 @@ - - function check_test_7() { - ensure_test_completed(); -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -+ // check chrome reg that language pack is not registered -+ do_check_locale_not_registered("test-langpack"); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(b1) { - do_check_eq(b1, null); - - restartManager(); - -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(newb1) { -+ AddonManager.getAddonByID("langpack-x-testing@tests.mozilla.org", function(newb1) { - do_check_eq(newb1, null); - -- run_test_8(); -+ do_test_finished(); - }); - }); - } -- --// Test that a bootstrapped extension dropped into the profile loads properly --// on startup and doesn't cause an EM restart --function run_test_8() { -- shutdownManager(); -- -- let dir = profileDir.clone(); -- dir.append("ab-CD@dictionaries.addons.mozilla.org"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- let zip = AM_Cc["@mozilla.org/libjar/zip-reader;1"]. -- createInstance(AM_Ci.nsIZipReader); -- zip.open(do_get_addon("test_dictionary")); -- dir.append("install.rdf"); -- zip.extract("install.rdf", dir); -- dir = dir.parent; -- dir.append("dictionaries"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- dir.append("ab-CD.dic"); -- zip.extract("dictionaries/ab-CD.dic", dir); -- zip.close(); -- -- startupManager(false); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_false(b1.appDisabled); -- do_check_false(b1.userDisabled); -- do_check_true(b1.isActive); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -- -- run_test_9(); -- }); --} -- --// Test that items detected as removed during startup get removed properly --function run_test_9() { -- shutdownManager(); -- -- let dir = profileDir.clone(); -- dir.append("ab-CD@dictionaries.addons.mozilla.org"); -- dir.remove(true); -- startupManager(false); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_eq(b1, null); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -- -- run_test_12(); -- }); --} -- -- --// Tests that bootstrapped extensions are correctly loaded even if the app is --// upgraded at the same time --function run_test_12() { -- shutdownManager(); -- -- let dir = profileDir.clone(); -- dir.append("ab-CD@dictionaries.addons.mozilla.org"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- let zip = AM_Cc["@mozilla.org/libjar/zip-reader;1"]. -- createInstance(AM_Ci.nsIZipReader); -- zip.open(do_get_addon("test_dictionary")); -- dir.append("install.rdf"); -- zip.extract("install.rdf", dir); -- dir = dir.parent; -- dir.append("dictionaries"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- dir.append("ab-CD.dic"); -- zip.extract("dictionaries/ab-CD.dic", dir); -- zip.close(); -- -- startupManager(true); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_false(b1.appDisabled); -- do_check_false(b1.userDisabled); -- do_check_true(b1.isActive); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -- -- b1.uninstall(); -- restartManager(); -- -- run_test_16(); -- }); --} -- -- --// Tests that bootstrapped extensions don't get loaded when in safe mode --function run_test_16() { -- installAllFiles([do_get_addon("test_dictionary")], function() { -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- // Should have installed and started -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- shutdownManager(); -- -- // Should have stopped -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- gAppInfo.inSafeMode = true; -- startupManager(false); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- // Should still be stopped -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_false(b1.isActive); -- -- shutdownManager(); -- gAppInfo.inSafeMode = false; -- startupManager(false); -- -- // Should have started -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- b1.uninstall(); -- -- run_test_17(); -- }); -- }); -- }); -- }); --} -- --// Check that a bootstrapped extension in a non-profile location is loaded --function run_test_17() { -- shutdownManager(); -- -- let dir = userExtDir.clone(); -- dir.append("ab-CD@dictionaries.addons.mozilla.org"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- let zip = AM_Cc["@mozilla.org/libjar/zip-reader;1"]. -- createInstance(AM_Ci.nsIZipReader); -- zip.open(do_get_addon("test_dictionary")); -- dir.append("install.rdf"); -- zip.extract("install.rdf", dir); -- dir = dir.parent; -- dir.append("dictionaries"); -- dir.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755); -- dir.append("ab-CD.dic"); -- zip.extract("dictionaries/ab-CD.dic", dir); -- zip.close(); -- -- startupManager(); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- // Should have installed and started -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_true(b1.isActive); -- -- // From run_test_21 -- dir = userExtDir.clone(); -- dir.append("ab-CD@dictionaries.addons.mozilla.org"); -- dir.remove(true); -- -- restartManager(); -- -- run_test_23(); -- }); --} -- --// Tests that installing from a URL doesn't require a restart --function run_test_23() { -- prepare_test({ }, [ -- "onNewInstall" -- ]); -- -- let url = "http://localhost:4444/addons/test_dictionary.xpi"; -- AddonManager.getInstallForURL(url, function(install) { -- ensure_test_completed(); -- -- do_check_neq(install, null); -- -- prepare_test({ }, [ -- "onDownloadStarted", -- "onDownloadEnded" -- ], function() { -- do_check_eq(install.type, "dictionary"); -- do_check_eq(install.version, "1.0"); -- do_check_eq(install.name, "Test Dictionary"); -- do_check_eq(install.state, AddonManager.STATE_DOWNLOADED); -- do_check_true(install.addon.hasResource("install.rdf")); -- do_check_false(install.addon.hasResource("bootstrap.js")); -- do_check_eq(install.addon.operationsRequiringRestart & -- AddonManager.OP_NEEDS_RESTART_INSTALL, 0); -- do_check_not_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -- -- let addon = install.addon; -- prepare_test({ -- "ab-CD@dictionaries.addons.mozilla.org": [ -- ["onInstalling", false], -- "onInstalled" -- ] -- }, [ -- "onInstallStarted", -- "onInstallEnded", -- ], function() { -- do_check_true(addon.hasResource("install.rdf")); -- check_test_23(); -- }); -- }); -- install.install(); -- }, "application/x-xpinstall"); --} -- --function check_test_23() { -- AddonManager.getAllInstalls(function(installs) { -- // There should be no active installs now since the install completed and -- // doesn't require a restart. -- do_check_eq(installs.length, 0); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_false(b1.appDisabled); -- do_check_false(b1.userDisabled); -- do_check_true(b1.isActive); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- do_check_true(b1.hasResource("install.rdf")); -- do_check_false(b1.hasResource("bootstrap.js")); -- do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0"); -- -- let dir = do_get_addon_root_uri(profileDir, "ab-CD@dictionaries.addons.mozilla.org"); -- -- AddonManager.getAddonsWithOperationsByTypes(null, function(list) { -- do_check_eq(list.length, 0); -- -- restartManager(); -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- b1.uninstall(); -- restartManager(); -- -- testserver.stop(run_test_25); -- }); -- }); -- }); -- }); --} -- --// Tests that updating from a bootstrappable add-on to a normal add-on calls --// the uninstall method --function run_test_25() { -- installAllFiles([do_get_addon("test_dictionary")], function() { -- HunspellEngine.listener = function(aEvent) { -- HunspellEngine.listener = null; -- do_check_eq(aEvent, "addDirectory"); -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- installAllFiles([do_get_addon("test_dictionary_2")], function() { -- // Needs a restart to complete this so the old version stays running -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_true(b1.isActive); -- do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); -- -- restartManager(); -- -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "2.0"); -- do_check_true(b1.isActive); -- do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); -- -- run_test_26(); -- }); -- }); -- }); -- }; -- }); --} -- --// Tests that updating from a normal add-on to a bootstrappable add-on calls --// the install method --function run_test_26() { -- installAllFiles([do_get_addon("test_dictionary")], function() { -- // Needs a restart to complete this -- do_check_false(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "2.0"); -- do_check_true(b1.isActive); -- do_check_true(hasFlag(b1.pendingOperations, AddonManager.PENDING_UPGRADE)); -- -- restartManager(); -- -- do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic")); -- -- AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1) { -- do_check_neq(b1, null); -- do_check_eq(b1.version, "1.0"); -- do_check_true(b1.isActive); -- do_check_eq(b1.pendingOperations, AddonManager.PENDING_NONE); -- -- HunspellEngine.deactivate(); -- -- do_test_finished(); -- }); -- }); -- }); --} -- -diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini ---- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini -+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini -@@ -139,6 +139,7 @@ - [test_corrupt_strictcompat.js] - [test_db_sanity.js] - [test_dictionary.js] -+[test_langpack.js] - [test_disable.js] - [test_distribution.js] - [test_dss.js] diff --git a/rhbz-911314.patch b/rhbz-911314.patch new file mode 100644 index 0000000..4f1cfa0 --- /dev/null +++ b/rhbz-911314.patch @@ -0,0 +1,547 @@ +Use the runtime page size to control arena decommit (RHBZ#911314) +Return success when decommit is disabled + +Author: Gustavo Luiz Duarte +Based on Terrence Cole's patch v0 on MOZ#840242 + +Index: mozilla-release/js/src/gc/Heap.h +=================================================================== +--- mozilla-release.orig/js/src/gc/Heap.h ++++ mozilla-release/js/src/gc/Heap.h +@@ -800,7 +800,7 @@ struct Chunk + + /* Search for a decommitted arena to allocate. */ + unsigned findDecommittedArenaOffset(); +- ArenaHeader* fetchNextDecommittedArena(); ++ ArenaHeader* fetchNextDecommittedArena(JSRuntime *rt); + + public: + /* Unlink and return the freeArenasHead. */ +Index: mozilla-release/js/src/gc/Memory.cpp +=================================================================== +--- mozilla-release.orig/js/src/gc/Memory.cpp ++++ mozilla-release/js/src/gc/Memory.cpp +@@ -8,6 +8,7 @@ + #include "mozilla/Assertions.h" + + #include "jstypes.h" ++#include "jscntxt.h" + + #include "js/Utility.h" + #include "gc/Memory.h" +@@ -19,39 +20,34 @@ namespace gc { + extern const size_t PageSize; + extern const size_t ArenaSize; + static bool +-DecommitEnabled() ++DecommitEnabled(JSRuntime *rt) + { +- return PageSize == ArenaSize; ++ return rt->gcSystemPageSize == ArenaSize; + } + + #if defined(XP_WIN) + #include "jswin.h" + #include + +-static size_t AllocationGranularity = 0; +- + void +-InitMemorySubsystem() ++InitMemorySubsystem(JSRuntime *rt) + { + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); +- if (sysinfo.dwPageSize != PageSize) { +- fprintf(stderr,"SpiderMonkey compiled with incorrect page size; please update js/public/HeapAPI.h.\n"); +- MOZ_CRASH(); +- } +- AllocationGranularity = sysinfo.dwAllocationGranularity; ++ rt->gcSystemPageSize = sysinfo.dwPageSize; ++ rt->gcSystemAllocGranularity = sysinfo.dwAllocationGranularity; + } + + void * +-MapAlignedPages(size_t size, size_t alignment) ++MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) + { + JS_ASSERT(size >= alignment); + JS_ASSERT(size % alignment == 0); +- JS_ASSERT(size % PageSize == 0); +- JS_ASSERT(alignment % AllocationGranularity == 0); ++ JS_ASSERT(size % rt->gcSystemPageSize == 0); ++ JS_ASSERT(alignment % rt->gcSystemAllocGranularity == 0); + + /* Special case: If we want allocation alignment, no further work is needed. */ +- if (alignment == AllocationGranularity) { ++ if (alignment == rt->gcSystemAllocGranularity) { + return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + } + +@@ -75,7 +71,7 @@ MapAlignedPages(size_t size, size_t alig + if (!p) + return NULL; + void *chunkStart = (void *)(uintptr_t(p) + (alignment - (uintptr_t(p) % alignment))); +- UnmapPages(p, size * 2); ++ UnmapPages(rt, p, size * 2); + p = VirtualAlloc(chunkStart, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + + /* Failure here indicates a race with another thread, so try again. */ +@@ -86,26 +82,26 @@ MapAlignedPages(size_t size, size_t alig + } + + void +-UnmapPages(void *p, size_t size) ++UnmapPages(JSRuntime *rt, void *p, size_t size) + { + JS_ALWAYS_TRUE(VirtualFree(p, 0, MEM_RELEASE)); + } + + bool +-MarkPagesUnused(void *p, size_t size) ++MarkPagesUnused(JSRuntime *rt, void *p, size_t size) + { +- if (!DecommitEnabled()) +- return false; ++ if (!DecommitEnabled(rt)) ++ return true; + +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + LPVOID p2 = VirtualAlloc(p, size, MEM_RESET, PAGE_READWRITE); + return p2 == p; + } + + bool +-MarkPagesInUse(void *p, size_t size) ++MarkPagesInUse(JSRuntime *rt, void *p, size_t size) + { +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + +@@ -127,12 +123,13 @@ GetPageFaultCount() + #define OS2_MAX_RECURSIONS 16 + + void +-InitMemorySubsystem() ++InitMemorySubsystem(JSRuntime *rt) + { ++ rt->gcSystemPageSize = rt->gcSystemAllocGranularity = ArenaSize; + } + + void +-UnmapPages(void *addr, size_t size) ++UnmapPages(JSRuntime *rt, void *addr, size_t size) + { + if (!DosFreeMem(addr)) + return; +@@ -153,7 +150,7 @@ UnmapPages(void *addr, size_t size) + } + + static void * +-MapAlignedPagesRecursively(size_t size, size_t alignment, int& recursions) ++MapAlignedPagesRecursively(JSRuntime *rt, size_t size, size_t alignment, int& recursions) + { + if (++recursions >= OS2_MAX_RECURSIONS) + return NULL; +@@ -179,7 +176,7 @@ MapAlignedPagesRecursively(size_t size, + unsigned long rc = DosQueryMem(&(static_cast(tmp))[size], + &cb, &flags); + if (!rc && (flags & PAG_FREE) && cb >= filler) { +- UnmapPages(tmp, 0); ++ UnmapPages(rt, tmp, 0); + if (DosAllocMem(&tmp, filler, + OBJ_ANY | PAG_COMMIT | PAG_READ | PAG_WRITE)) { + JS_ALWAYS_TRUE(DosAllocMem(&tmp, filler, +@@ -187,19 +184,19 @@ MapAlignedPagesRecursively(size_t size, + } + } + +- void *p = MapAlignedPagesRecursively(size, alignment, recursions); +- UnmapPages(tmp, 0); ++ void *p = MapAlignedPagesRecursively(rt, size, alignment, recursions); ++ UnmapPages(rt, tmp, 0); + + return p; + } + + void * +-MapAlignedPages(size_t size, size_t alignment) ++MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) + { + JS_ASSERT(size >= alignment); + JS_ASSERT(size % alignment == 0); +- JS_ASSERT(size % PageSize == 0); +- JS_ASSERT(alignment % PageSize == 0); ++ JS_ASSERT(size % rt->gcSystemPageSize == 0); ++ JS_ASSERT(alignment % rt->gcSystemAllocGranularity == 0); + + int recursions = -1; + +@@ -208,7 +205,7 @@ MapAlignedPages(size_t size, size_t alig + * of the right size by recursively allocating blocks of unaligned + * free memory until only an aligned allocation is possible. + */ +- void *p = MapAlignedPagesRecursively(size, alignment, recursions); ++ void *p = MapAlignedPagesRecursively(rt, size, alignment, recursions); + if (p) + return p; + +@@ -230,16 +227,15 @@ MapAlignedPages(size_t size, size_t alig + } + + bool +-MarkPagesUnused(void *p, size_t size) +-{ +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++MarkPagesUnused(JSRuntime *rt, void *p, size_t size) { ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + + bool +-MarkPagesInUse(void *p, size_t size) ++MarkPagesInUse(JSRuntime *rt, void *p, size_t size) + { +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + +@@ -259,17 +255,18 @@ GetPageFaultCount() + #endif + + void +-InitMemorySubsystem() ++InitMemorySubsystem(JSRuntime *rt) + { ++ rt->gcSystemPageSize = rt->gcSystemAllocGranularity = size_t(sysconf(_SC_PAGESIZE)); + } + + void * +-MapAlignedPages(size_t size, size_t alignment) ++MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) + { + JS_ASSERT(size >= alignment); + JS_ASSERT(size % alignment == 0); +- JS_ASSERT(size % PageSize == 0); +- JS_ASSERT(alignment % PageSize == 0); ++ JS_ASSERT(size % rt->gcSystemPageSize == 0); ++ JS_ASSERT(alignment % rt->gcSystemAllocGranularity == 0); + + int prot = PROT_READ | PROT_WRITE; + int flags = MAP_PRIVATE | MAP_ANON | MAP_ALIGN | MAP_NOSYNC; +@@ -281,22 +278,22 @@ MapAlignedPages(size_t size, size_t alig + } + + void +-UnmapPages(void *p, size_t size) ++UnmapPages(JSRuntime *rt, void *p, size_t size) + { + JS_ALWAYS_TRUE(0 == munmap((caddr_t)p, size)); + } + + bool +-MarkPagesUnused(void *p, size_t size) ++MarkPagesUnused(JSRuntime *rt, void *p, size_t size) + { +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + + bool +-MarkPagesInUse(void *p, size_t size) ++MarkPagesInUse(JSRuntime *rt, void *p, size_t size) + { +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + +@@ -314,27 +311,24 @@ GetPageFaultCount() + #include + + void +-InitMemorySubsystem() ++InitMemorySubsystem(JSRuntime *rt) + { +- if (size_t(sysconf(_SC_PAGESIZE)) != PageSize) { +- fprintf(stderr,"SpiderMonkey compiled with incorrect page size; please update js/public/HeapAPI.h.\n"); +- MOZ_CRASH(); +- } ++ rt->gcSystemPageSize = rt->gcSystemAllocGranularity = size_t(sysconf(_SC_PAGESIZE)); + } + + void * +-MapAlignedPages(size_t size, size_t alignment) ++MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) + { + JS_ASSERT(size >= alignment); + JS_ASSERT(size % alignment == 0); +- JS_ASSERT(size % PageSize == 0); +- JS_ASSERT(alignment % PageSize == 0); ++ JS_ASSERT(size % rt->gcSystemPageSize == 0); ++ JS_ASSERT(alignment % rt->gcSystemAllocGranularity == 0); + + int prot = PROT_READ | PROT_WRITE; + int flags = MAP_PRIVATE | MAP_ANON; + + /* Special case: If we want page alignment, no further work is needed. */ +- if (alignment == PageSize) { ++ if (alignment == rt->gcSystemAllocGranularity) { + return mmap(NULL, size, prot, flags, -1, 0); + } + +@@ -360,26 +354,26 @@ MapAlignedPages(size_t size, size_t alig + } + + void +-UnmapPages(void *p, size_t size) ++UnmapPages(JSRuntime *rt, void *p, size_t size) + { + JS_ALWAYS_TRUE(0 == munmap(p, size)); + } + + bool +-MarkPagesUnused(void *p, size_t size) ++MarkPagesUnused(JSRuntime *rt, void *p, size_t size) + { +- if (!DecommitEnabled()) +- return false; ++ if (!DecommitEnabled(rt)) ++ return true; + +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + int result = madvise(p, size, MADV_DONTNEED); + return result != -1; + } + + bool +-MarkPagesInUse(void *p, size_t size) ++MarkPagesInUse(JSRuntime *rt, void *p, size_t size) + { +- JS_ASSERT(uintptr_t(p) % PageSize == 0); ++ JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); + return true; + } + +Index: mozilla-release/js/src/gc/Memory.h +=================================================================== +--- mozilla-release.orig/js/src/gc/Memory.h ++++ mozilla-release/js/src/gc/Memory.h +@@ -16,20 +16,20 @@ namespace gc { + + // Sanity check that our compiled configuration matches the currently running + // instance and initialize any runtime data needed for allocation. +-void InitMemorySubsystem(); ++void InitMemorySubsystem(JSRuntime *rt); + + // Allocate or deallocate pages from the system with the given alignment. +-void *MapAlignedPages(size_t size, size_t alignment); +-void UnmapPages(void *p, size_t size); ++void *MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment); ++void UnmapPages(JSRuntime *rt, void *p, size_t size); + + // Tell the OS that the given pages are not in use, so they should not + // be written to a paging file. This may be a no-op on some platforms. +-bool MarkPagesUnused(void *p, size_t size); ++bool MarkPagesUnused(JSRuntime *rt, void *p, size_t size); + + // Undo |MarkPagesUnused|: tell the OS that the given pages are of interest + // and should be paged in and out normally. This may be a no-op on some + // platforms. +-bool MarkPagesInUse(void *p, size_t size); ++bool MarkPagesInUse(JSRuntime *rt, void *p, size_t size); + + // Returns #(hard faults) + #(soft faults) + size_t GetPageFaultCount(); +Index: mozilla-release/js/src/jsapi.cpp +=================================================================== +--- mozilla-release.orig/js/src/jsapi.cpp ++++ mozilla-release/js/src/jsapi.cpp +@@ -1105,8 +1105,6 @@ JS_NewRuntime(uint32_t maxbytes, JSUseHe + #undef MSG_DEF + #endif /* DEBUG */ + +- InitMemorySubsystem(); +- + if (!js::TlsPerThreadData.init()) + return NULL; + +Index: mozilla-release/js/src/jscntxt.h +=================================================================== +--- mozilla-release.orig/js/src/jscntxt.h ++++ mozilla-release/js/src/jscntxt.h +@@ -847,6 +847,15 @@ struct JSRuntime : js::RuntimeFriendFiel + /* Stack of thread-stack-allocated GC roots. */ + js::AutoGCRooter *autoGCRooters; + ++ /* ++ * The GC can only safely decommit memory when the page size of the ++ * running process matches the compiled arena size. ++ */ ++ size_t gcSystemPageSize; ++ ++ /* The OS allocation granularity may not match the page size. */ ++ size_t gcSystemAllocGranularity; ++ + /* Strong references on scripts held for PCCount profiling API. */ + js::ScriptAndCountsVector *scriptAndCountsVector; + +Index: mozilla-release/js/src/jsgc.cpp +=================================================================== +--- mozilla-release.orig/js/src/jsgc.cpp ++++ mozilla-release/js/src/jsgc.cpp +@@ -486,13 +486,13 @@ FinalizeArenas(FreeOp *fop, + } + + static inline Chunk * +-AllocChunk() { +- return static_cast(MapAlignedPages(ChunkSize, ChunkSize)); ++AllocChunk(JSRuntime *rt) { ++ return static_cast(MapAlignedPages(rt, ChunkSize, ChunkSize)); + } + + static inline void +-FreeChunk(Chunk *p) { +- UnmapPages(static_cast(p), ChunkSize); ++FreeChunk(JSRuntime *rt, Chunk *p) { ++ UnmapPages(rt, static_cast(p), ChunkSize); + } + + inline bool +@@ -582,25 +582,25 @@ ChunkPool::expire(JSRuntime *rt, bool re + } + + static void +-FreeChunkList(Chunk *chunkListHead) ++FreeChunkList(JSRuntime *rt, Chunk *chunkListHead) + { + while (Chunk *chunk = chunkListHead) { + JS_ASSERT(!chunk->info.numArenasFreeCommitted); + chunkListHead = chunk->info.next; +- FreeChunk(chunk); ++ FreeChunk(rt, chunk); + } + } + + void + ChunkPool::expireAndFree(JSRuntime *rt, bool releaseAll) + { +- FreeChunkList(expire(rt, releaseAll)); ++ FreeChunkList(rt, expire(rt, releaseAll)); + } + + /* static */ Chunk * + Chunk::allocate(JSRuntime *rt) + { +- Chunk *chunk = static_cast(AllocChunk()); ++ Chunk *chunk = static_cast(AllocChunk(rt)); + + #ifdef JSGC_ROOT_ANALYSIS + // Our poison pointers are not guaranteed to be invalid on 64-bit +@@ -613,7 +613,7 @@ Chunk::allocate(JSRuntime *rt) + // were marked as uncommitted, but it's a little complicated to avoid + // clobbering pre-existing unrelated mappings. + while (IsPoisonedPtr(chunk)) +- chunk = static_cast(AllocChunk()); ++ chunk = static_cast(AllocChunk(rt)); + #endif + + if (!chunk) +@@ -629,7 +629,7 @@ Chunk::release(JSRuntime *rt, Chunk *chu + { + JS_ASSERT(chunk); + chunk->prepareToBeFreed(rt); +- FreeChunk(chunk); ++ FreeChunk(rt, chunk); + } + + inline void +@@ -745,7 +745,7 @@ Chunk::findDecommittedArenaOffset() + } + + ArenaHeader * +-Chunk::fetchNextDecommittedArena() ++Chunk::fetchNextDecommittedArena(JSRuntime *rt) + { + JS_ASSERT(info.numArenasFreeCommitted == 0); + JS_ASSERT(info.numArenasFree > 0); +@@ -756,7 +756,7 @@ Chunk::fetchNextDecommittedArena() + decommittedArenas.unset(offset); + + Arena *arena = &arenas[offset]; +- MarkPagesInUse(arena, ArenaSize); ++ MarkPagesInUse(rt, arena, ArenaSize); + arena->aheader.setAsNotAllocated(); + + return &arena->aheader; +@@ -790,7 +790,7 @@ Chunk::allocateArena(JSCompartment *comp + + ArenaHeader *aheader = JS_LIKELY(info.numArenasFreeCommitted > 0) + ? fetchNextFreeArena(rt) +- : fetchNextDecommittedArena(); ++ : fetchNextDecommittedArena(rt); + aheader->init(comp, thingKind); + if (JS_UNLIKELY(!hasAvailableArenas())) + removeFromAvailableList(); +@@ -893,6 +893,8 @@ static const int64_t JIT_SCRIPT_RELEASE_ + JSBool + js_InitGC(JSRuntime *rt, uint32_t maxbytes) + { ++ InitMemorySubsystem(rt); ++ + if (!rt->gcChunkSet.init(INITIAL_CHUNK_CAPACITY)) + return false; + +@@ -2745,7 +2747,7 @@ DecommitArenasFromAvailableList(JSRuntim + Maybe maybeUnlock; + if (!rt->isHeapBusy()) + maybeUnlock.construct(rt); +- ok = MarkPagesUnused(aheader->getArena(), ArenaSize); ++ ok = MarkPagesUnused(rt, aheader->getArena(), ArenaSize); + } + + if (ok) { +@@ -2813,7 +2815,7 @@ ExpireChunksAndArenas(JSRuntime *rt, boo + { + if (Chunk *toFree = rt->gcChunkPool.expire(rt, shouldShrink)) { + AutoUnlockGC unlock(rt); +- FreeChunkList(toFree); ++ FreeChunkList(rt, toFree); + } + + if (shouldShrink) +Index: mozilla-release/js/public/HeapAPI.h +=================================================================== +--- mozilla-release.orig/js/public/HeapAPI.h ++++ mozilla-release/js/public/HeapAPI.h +@@ -11,24 +11,7 @@ + namespace js { + namespace gc { + +-/* +- * Page size must be static to support our arena pointer optimizations, so we +- * are forced to support each platform with non-4096 pages as a special case. +- * Note: The freelist supports a maximum arena shift of 15. +- * Note: Do not use JS_CPU_SPARC here, this header is used outside JS. +- */ +-#if (defined(SOLARIS) || defined(__FreeBSD__)) && \ +- (defined(__sparc) || defined(__sparcv9) || defined(__ia64)) +-const size_t PageShift = 13; +-const size_t ArenaShift = PageShift; +-#elif defined(__powerpc64__) +-const size_t PageShift = 16; + const size_t ArenaShift = 12; +-#else +-const size_t PageShift = 12; +-const size_t ArenaShift = PageShift; +-#endif +-const size_t PageSize = size_t(1) << PageShift; + const size_t ArenaSize = size_t(1) << ArenaShift; + const size_t ArenaMask = ArenaSize - 1; + diff --git a/xulrunner.spec b/xulrunner.spec index 9a0d072..6461181 100644 --- a/xulrunner.spec +++ b/xulrunner.spec @@ -41,7 +41,7 @@ %if %{?system_nss} # grep 'min_ns.*=[0-9]' configure -%global nspr_version 4.9.3 +%global nspr_version 4.9.4 %global nspr_build_version %(pkg-config --silence-errors --modversion nspr 2>/dev/null || echo 65536) %global nss_version 3.14.1 %global nss_build_version %(pkg-config --silence-errors --modversion nss 2>/dev/null || echo 65536) @@ -63,6 +63,7 @@ %global beta_version 0 %global rc_version 0 +%global tarballname firefox %global mozappdir %{_libdir}/%{name} %global tarballdir mozilla-release @@ -91,14 +92,12 @@ Summary: XUL Runtime for Gecko Applications Name: %{shortname}-last -Version: 18.0.2 +Version: 19.0 Release: 1%{?pre_tag}%{?dist} URL: http://developer.mozilla.org/En/XULRunner License: MPLv1.1 or GPLv2+ or LGPLv2+ Group: Applications/Internet -# You can get sources at ftp://ftp.mozilla.org/pub/firefox/releases/%{version}%{?pre_ver}/source -#Source0: %{name}-%{version}%{?pre_version}.source.tar.bz2 -Source0: firefox-%{version}%{?pre_version}.source.tar.bz2 +Source0: ftp://ftp.mozilla.org/pub/%{tarballname}/releases/%{version}%{?pre_version}/source/%{tarballname}-%{version}%{?pre_version}.source.tar.bz2 Source10: %{shortname}-mozconfig Source11: %{shortname}-mozconfig-debuginfo Source12: %{shortname}-redhat-default-prefs.js @@ -115,9 +114,11 @@ Patch19: rhbz-304121.patch # Fedora specific patches Patch20: mozilla-193-pkgconfig.patch +Patch21: rhbz-911314.patch # Upstream patches Patch101: mozilla-791626.patch +Patch102: mozilla-239254.patch # --------------------------------------------------- @@ -267,7 +268,12 @@ cd %{tarballdir} %patch19 -p2 -b .rhbz-304121 %patch20 -p2 -b .pk +%ifarch ppc ppc64 +%patch21 -p1 -b .ppc +%endif + %patch101 -p1 -b .791626 +%patch102 -p1 -b .239254 %{__rm} -f .mozconfig %{__cat} %{SOURCE10} \ @@ -568,6 +574,16 @@ fi #--------------------------------------------------------------------- %changelog +* Sat Feb 23 2013 Remi Collet - 19.0-1 +- Update to 19.0 + +* Wed Feb 20 2013 Martin Stransky - 19.0-2 +- Added fix for rhbz#911314 (ppc only) + +* Mon Feb 18 2013 Martin Stransky - 19.0-1 +- Update to 19.0 +- Added fix for mozbz#239254 + * Wed Feb 6 2013 Remi Collet - 18.0.2-1 - Update to 18.0.2 -- cgit