{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/28814766","id":28814766,"diff_hunk":"@@ -105,6 +108,108 @@ define(function(require) {\n     });\n   }\n \n+  function renameAddon(addon, name) {\n+    if (!name) {\n+      return Promise.reject('no name given');\n+    }\n+\n+    if (!isAddon(addon)) {\n+      return Promise.reject('not an addon');\n+    }\n+\n+    var manifest = getManifest(addon);\n+    if (name === manifest.name) {\n+      return Promise.reject('name is unchanged');\n+    }\n+\n+    // To rename an addon we are creating a new DOMApplication that will have\n+    // an updated name. Other manifest attributes are preserved.\n+    return new Promise(function(resolve, reject) {\n+      // Export an addon as a blob.\n+      addon.export().then(function(blob) {\n+        // Copy over manifest object.\n+        var newManifest = Object.assign({}, manifest);\n+        newManifest.name = name;\n+\n+        deleteAddon(addon).then(function() {\n+          blobToArrayBuffer(blob).then(function(arrayBuffer) {\n+            var addonBlob = generate(newManifest, unpackScript(arrayBuffer));\n+            install(addonBlob).then(resolve).catch(reject);\n+          }).catch(reject);\n+        }).catch(reject);\n+      }).catch(reject);\n+    });\n+  }\n+\n+  function unpackScript(arrayBuffer) {\n+    var zip = new JSZip();\n+    zip.load(arrayBuffer);\n+\n+    var applicationZipFile = zip.file('application.zip');\n+    if (!applicationZipFile) { return; }\n+\n+    var applicationZip = new JSZip();\n+    applicationZip.load(applicationZipFile.asArrayBuffer());\n+\n+    var scriptFile = applicationZip.file('main.js');","path":"apps/settings/js/modules/addon_manager.js","position":66,"original_position":66,"commit_id":"69805d04dc0e4a0f94f266c80ab1b8b2cf87d765","original_commit_id":"69805d04dc0e4a0f94f266c80ab1b8b2cf87d765","user":{"login":"yzen","id":561275,"avatar_url":"https://avatars.githubusercontent.com/u/561275?v=3","gravatar_id":"","url":"https://api.github.com/users/yzen","html_url":"https://github.com/yzen","followers_url":"https://api.github.com/users/yzen/followers","following_url":"https://api.github.com/users/yzen/following{/other_user}","gists_url":"https://api.github.com/users/yzen/gists{/gist_id}","starred_url":"https://api.github.com/users/yzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yzen/subscriptions","organizations_url":"https://api.github.com/users/yzen/orgs","repos_url":"https://api.github.com/users/yzen/repos","events_url":"https://api.github.com/users/yzen/events{/privacy}","received_events_url":"https://api.github.com/users/yzen/received_events","type":"User","site_admin":false},"body":"In case where they are created using customizer, yes. ","created_at":"2015-04-21T19:44:28Z","updated_at":"2015-04-21T19:44:28Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/29358#discussion_r28814766","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/28814766"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/29358#discussion_r28814766"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358","id":32731922,"html_url":"https://github.com/mozilla-b2g/gaia/pull/29358","diff_url":"https://github.com/mozilla-b2g/gaia/pull/29358.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/29358.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/29358","number":29358,"state":"open","locked":false,"title":"Bug 1144849 - adding support for renaming add-ons in the activity detail...","user":{"login":"yzen","id":561275,"avatar_url":"https://avatars.githubusercontent.com/u/561275?v=3","gravatar_id":"","url":"https://api.github.com/users/yzen","html_url":"https://github.com/yzen","followers_url":"https://api.github.com/users/yzen/followers","following_url":"https://api.github.com/users/yzen/following{/other_user}","gists_url":"https://api.github.com/users/yzen/gists{/gist_id}","starred_url":"https://api.github.com/users/yzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yzen/subscriptions","organizations_url":"https://api.github.com/users/yzen/orgs","repos_url":"https://api.github.com/users/yzen/repos","events_url":"https://api.github.com/users/yzen/events{/privacy}","received_events_url":"https://api.github.com/users/yzen/received_events","type":"User","site_admin":false},"body":"... view.\r\n\r\nChange-Id: I30f54eb86cc532379d5af0f087b53aac52aac61b","created_at":"2015-04-07T04:03:17Z","updated_at":"2015-04-21T19:44:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4e1443beb2a98d5f70a308d8375554fb8d3af3e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/29358/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/69805d04dc0e4a0f94f266c80ab1b8b2cf87d765","head":{"label":"yzen:bug-1144849","ref":"bug-1144849","sha":"69805d04dc0e4a0f94f266c80ab1b8b2cf87d765","user":{"login":"yzen","id":561275,"avatar_url":"https://avatars.githubusercontent.com/u/561275?v=3","gravatar_id":"","url":"https://api.github.com/users/yzen","html_url":"https://github.com/yzen","followers_url":"https://api.github.com/users/yzen/followers","following_url":"https://api.github.com/users/yzen/following{/other_user}","gists_url":"https://api.github.com/users/yzen/gists{/gist_id}","starred_url":"https://api.github.com/users/yzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yzen/subscriptions","organizations_url":"https://api.github.com/users/yzen/orgs","repos_url":"https://api.github.com/users/yzen/repos","events_url":"https://api.github.com/users/yzen/events{/privacy}","received_events_url":"https://api.github.com/users/yzen/received_events","type":"User","site_admin":false},"repo":{"id":9679958,"name":"gaia","full_name":"yzen/gaia","owner":{"login":"yzen","id":561275,"avatar_url":"https://avatars.githubusercontent.com/u/561275?v=3","gravatar_id":"","url":"https://api.github.com/users/yzen","html_url":"https://github.com/yzen","followers_url":"https://api.github.com/users/yzen/followers","following_url":"https://api.github.com/users/yzen/following{/other_user}","gists_url":"https://api.github.com/users/yzen/gists{/gist_id}","starred_url":"https://api.github.com/users/yzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yzen/subscriptions","organizations_url":"https://api.github.com/users/yzen/orgs","repos_url":"https://api.github.com/users/yzen/repos","events_url":"https://api.github.com/users/yzen/events{/privacy}","received_events_url":"https://api.github.com/users/yzen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yzen/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see https://wiki.mozilla.org/Release_Management/B2G_Landing","fork":true,"url":"https://api.github.com/repos/yzen/gaia","forks_url":"https://api.github.com/repos/yzen/gaia/forks","keys_url":"https://api.github.com/repos/yzen/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yzen/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yzen/gaia/teams","hooks_url":"https://api.github.com/repos/yzen/gaia/hooks","issue_events_url":"https://api.github.com/repos/yzen/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/yzen/gaia/events","assignees_url":"https://api.github.com/repos/yzen/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/yzen/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/yzen/gaia/tags","blobs_url":"https://api.github.com/repos/yzen/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yzen/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yzen/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/yzen/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yzen/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/yzen/gaia/languages","stargazers_url":"https://api.github.com/repos/yzen/gaia/stargazers","contributors_url":"https://api.github.com/repos/yzen/gaia/contributors","subscribers_url":"https://api.github.com/repos/yzen/gaia/subscribers","subscription_url":"https://api.github.com/repos/yzen/gaia/subscription","commits_url":"https://api.github.com/repos/yzen/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/yzen/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/yzen/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/yzen/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/yzen/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/yzen/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yzen/gaia/merges","archive_url":"https://api.github.com/repos/yzen/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yzen/gaia/downloads","issues_url":"https://api.github.com/repos/yzen/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/yzen/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/yzen/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/yzen/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yzen/gaia/labels{/name}","releases_url":"https://api.github.com/repos/yzen/gaia/releases{/id}","created_at":"2013-04-25T19:49:15Z","updated_at":"2015-04-20T13:57:03Z","pushed_at":"2015-04-21T18:51:53Z","git_url":"git://github.com/yzen/gaia.git","ssh_url":"git@github.com:yzen/gaia.git","clone_url":"https://github.com/yzen/gaia.git","svn_url":"https://github.com/yzen/gaia","homepage":"https://wiki.mozilla.org/B2G","size":888573,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:lightsaber","ref":"lightsaber","sha":"4b6bd3004d4d91d6abea6aa57881402813e34236","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-04-21T17:17:50Z","pushed_at":"2015-04-21T19:41:43Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1521527,"stargazers_count":1907,"watchers_count":1907,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2284,"mirror_url":null,"open_issues_count":981,"forks":2284,"open_issues":981,"watchers":1907,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/29358"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/29358"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/29358/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/29358/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/69805d04dc0e4a0f94f266c80ab1b8b2cf87d765"}}}}