extensionDownloader: Properly error out when downloading/parsing infos
When the extension downloader was originally designed, the information downloading part was inserted at the last minute, along with the modal dialog as a security feature to make sure an extension didn't silently get installed on the user's machines either due to a security issue in the browser-plugin, or an XSS issue on the extensions website. Correct the mistake I made when writing the code; instead of dropping an error on the floor, log it correctly. This "bug" has already bitten a number of users who forgot to configure proxy settings in the control center. https://bugzilla.gnome.org/show_bug.cgi?id=679099
This commit is contained in:
parent
8915bb4892
commit
1d1359b58f
@ -28,12 +28,23 @@ function installExtensionFromUUID(uuid) {
|
||||
|
||||
let message = Soup.form_request_new_from_hash('GET', REPOSITORY_URL_INFO, params);
|
||||
|
||||
_httpSession.queue_message(message,
|
||||
function(session, message) {
|
||||
let info = JSON.parse(message.response_body.data);
|
||||
let dialog = new InstallExtensionDialog(uuid, info);
|
||||
dialog.open(global.get_current_time());
|
||||
});
|
||||
_httpSession.queue_message(message, function(session, message) {
|
||||
if (message.status_code != Soup.KnownStatusCode.OK) {
|
||||
ExtensionSystem.logExtensionError(uuid, 'downloading info: ' + message.status_code);
|
||||
return;
|
||||
}
|
||||
|
||||
let info;
|
||||
try {
|
||||
info = JSON.parse(message.response_body.data);
|
||||
} catch (e) {
|
||||
ExtensionSystem.logExtensionError(uuid, 'parsing info: ' + e);
|
||||
return;
|
||||
}
|
||||
|
||||
let dialog = new InstallExtensionDialog(uuid, info);
|
||||
dialog.open(global.get_current_time());
|
||||
});
|
||||
}
|
||||
|
||||
function uninstallExtensionFromUUID(uuid) {
|
||||
@ -85,6 +96,12 @@ function gotExtensionZipFile(session, message, uuid) {
|
||||
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function(pid, status) {
|
||||
GLib.spawn_close_pid(pid);
|
||||
|
||||
if (status != 0) {
|
||||
ExtensionSystem.logExtensionError(uuid, 'extract: could not extract');
|
||||
invocation.return_dbus_error('org.gnome.Shell.ExtractExtensionError', '');
|
||||
return;
|
||||
}
|
||||
|
||||
// Add extension to 'enabled-extensions' for the user, always...
|
||||
let enabledExtensions = global.settings.get_strv(ExtensionSystem.ENABLED_EXTENSIONS_KEY);
|
||||
if (enabledExtensions.indexOf(uuid) == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user