diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /toolkit/modules/GMPInstallManager.sys.mjs | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/GMPInstallManager.sys.mjs')
-rw-r--r-- | toolkit/modules/GMPInstallManager.sys.mjs | 98 |
1 files changed, 56 insertions, 42 deletions
diff --git a/toolkit/modules/GMPInstallManager.sys.mjs b/toolkit/modules/GMPInstallManager.sys.mjs index c187215096..32355418a1 100644 --- a/toolkit/modules/GMPInstallManager.sys.mjs +++ b/toolkit/modules/GMPInstallManager.sys.mjs @@ -832,48 +832,62 @@ GMPDownloader.prototype = { gmpAddon.version, ]); let installPromise = gmpInstaller.install(); - return installPromise.then( - extractedPaths => { - // Success, set the prefs - let now = Math.round(Date.now() / 1000); - GMPPrefs.setInt(GMPPrefs.KEY_PLUGIN_LAST_UPDATE, now, gmpAddon.id); - // Remember our ABI, so that if the profile is migrated to another - // platform or from 32 -> 64 bit, we notice and don't try to load the - // unexecutable plugin library. - let abi = GMPUtils._expectedABI(gmpAddon); - log.info("Setting ABI to '" + abi + "' for " + gmpAddon.id); - GMPPrefs.setString(GMPPrefs.KEY_PLUGIN_ABI, abi, gmpAddon.id); - // We use the combination of the hash and version to ensure we are - // up to date. - GMPPrefs.setString( - GMPPrefs.KEY_PLUGIN_HASHVALUE, - gmpAddon.hashValue, - gmpAddon.id - ); - // Setting the version pref signals installation completion to consumers, - // if you need to set other prefs etc. do it before this. - GMPPrefs.setString( - GMPPrefs.KEY_PLUGIN_VERSION, - gmpAddon.version, - gmpAddon.id - ); - return extractedPaths; - }, - reason => { - GMPPrefs.setString( - GMPPrefs.KEY_PLUGIN_LAST_INSTALL_FAIL_REASON, - reason, - gmpAddon.id - ); - let now = Math.round(Date.now() / 1000); - GMPPrefs.setInt( - GMPPrefs.KEY_PLUGIN_LAST_INSTALL_FAILED, - now, - gmpAddon.id - ); - throw reason; - } - ); + return installPromise + .then( + extractedPaths => { + // Success, set the prefs + let now = Math.round(Date.now() / 1000); + GMPPrefs.setInt( + GMPPrefs.KEY_PLUGIN_LAST_UPDATE, + now, + gmpAddon.id + ); + // Remember our ABI, so that if the profile is migrated to another + // platform or from 32 -> 64 bit, we notice and don't try to load the + // unexecutable plugin library. + let abi = GMPUtils._expectedABI(gmpAddon); + log.info("Setting ABI to '" + abi + "' for " + gmpAddon.id); + GMPPrefs.setString(GMPPrefs.KEY_PLUGIN_ABI, abi, gmpAddon.id); + // We use the combination of the hash and version to ensure we are + // up to date. + GMPPrefs.setString( + GMPPrefs.KEY_PLUGIN_HASHVALUE, + gmpAddon.hashValue, + gmpAddon.id + ); + // Setting the version pref signals installation completion to consumers, + // if you need to set other prefs etc. do it before this. + GMPPrefs.setString( + GMPPrefs.KEY_PLUGIN_VERSION, + gmpAddon.version, + gmpAddon.id + ); + return extractedPaths; + }, + reason => { + GMPPrefs.setString( + GMPPrefs.KEY_PLUGIN_LAST_INSTALL_FAIL_REASON, + reason, + gmpAddon.id + ); + let now = Math.round(Date.now() / 1000); + GMPPrefs.setInt( + GMPPrefs.KEY_PLUGIN_LAST_INSTALL_FAILED, + now, + gmpAddon.id + ); + throw reason; + } + ) + .finally(() => { + log.info(`Deleting ${gmpAddon.id} temporary zip file ${zipPath}`); + // We need to send out an observer event to ensure the nsZipReaderCache + // clears its cache entries associated with our temporary file. Otherwise + // if the addons downloader reuses the temporary file path, then we may hit + // the cache and get different contents than expected. + Services.obs.notifyObservers(null, "flush-cache-entry", zipPath); + IOUtils.remove(zipPath); + }); }, reason => { GMPPrefs.setString( |