extensionSystem: Store extensions in a Map

After making the extensions map private to the ExtensionManager, we can
switch it to a proper hash table which is more appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=789852
This commit is contained in:
Florian Müllner
2019-07-08 00:01:11 +02:00
committed by Florian Müllner
parent 1d6ddf060b
commit 43cb3754d9
5 changed files with 37 additions and 30 deletions

View File

@ -44,7 +44,7 @@ function installExtension(uuid, invocation) {
}
function uninstallExtension(uuid) {
let extension = Main.extensionManager.extensions[uuid];
let extension = Main.extensionManager.lookup(uuid);
if (!extension)
return false;
@ -113,7 +113,7 @@ function updateExtension(uuid) {
_httpSession.queue_message(message, (session, message) => {
gotExtensionZipFile(session, message, uuid, newExtensionTmpDir, () => {
let oldExtension = Main.extensionManager.extensions[uuid];
let oldExtension = Main.extensionManager.lookup(uuid);
let extensionDir = oldExtension.dir;
if (!Main.extensionManager.unloadExtension(oldExtension))
@ -151,9 +151,9 @@ function updateExtension(uuid) {
function checkForUpdates() {
let metadatas = {};
for (let uuid in Main.extensionManager.extensions) {
Main.extensionManager.getUuids().forEach(uuid => {
metadatas[uuid] = Main.extensionManager.extensions[uuid].metadata;
}
});
let params = { shell_version: Config.PACKAGE_VERSION,
installed: JSON.stringify(metadatas) };