[extensions-web] js: Guard against a missing result.pk
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] js: Guard against a missing result.pk
- Date: Thu, 1 Dec 2011 22:23:52 +0000 (UTC)
commit 8adcc90c22322517c0e017a03c1cd98d43e935db
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Dec 1 17:23:29 2011 -0500
js: Guard against a missing result.pk
If the user has existing extensions, they may not have a "version" key.
Don't let the user uninstall the extension in this case.
sweettooth/static/js/extensions.js | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 7e69283..4135af6 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -210,10 +210,16 @@ function($, messages, dbusProxy, extensionUtils) {
$elem.
find('span.author').text(" by ").append($('<a>', {'href': "/accounts/profile/" + result.creator}).text(result.creator)).end().
find('img.icon').detach().end().
- find('h3').html($('<a>', {'href': result.link}).append($('<img>', {'class': 'icon', 'src': result.icon})).append(extension.name)).end().
- append($('<button>', {'class': 'uninstall', 'title': "Uninstall"}).text("Uninstall").bind('click', uninstall)).
- data('pk', result.pk).
- data('svm', result.shell_version_map);
+ find('h3').html($('<a>', {'href': result.link}).append($('<img>', {'class': 'icon', 'src': result.icon})).append(extension.name)).end();
+
+ // The PK might not exist if the extension wasn't
+ // installed from GNOME Shell Extensions.
+ if (result.pk !== undefined) {
+ $elem.
+ data('pk', result.pk).
+ data('svm', result.shell_version_map).
+ append($('<button>', {'class': 'uninstall', 'title': "Uninstall"}).text("Uninstall").bind('click', uninstall));
+ }
addExtensionSwitch(uuid, extension, $elem);
}).fail(function(e) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]