{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/24691376","id":24691376,"diff_hunk":"@@ -0,0 +1,49 @@\n+define(function(require) {\n+  'use strict';\n+\n+  // Return the url of the app icon that is the best match for the\n+  // specified target size. This will return the URL of the smallest\n+  // icon that is at least as big as the target. Or, if no such icon\n+  // exists, it will return the largest icon. targetSize should be\n+  // specified in CSS pixels. This function will convert to device\n+  // pixels.\n+  function getIconURL(app, targetSize) {\n+    var manifest = app.manifest || app.updateManifest;\n+    var icons = manifest && manifest.icons;\n+\n+    if (!icons || !Object.keys(icons).length) {\n+      return '../style/images/default.png';\n+    }\n+\n+    targetSize *= window.devicePixelRatio;\n+    var bestSize = Infinity;\n+    var maxSize = 0;\n+\n+    for (var size in icons) {\n+      size = parseInt(size, 10);\n+      if (size >= targetSize && size < bestSize) {\n+        bestSize = size;\n+      }\n+      if (size > maxSize) {\n+        maxSize = size;\n+      }\n+    }\n+    // If there is an icon matching the preferred size, we return the result,\n+    // if there isn't, we will return the maximum available size.\n+    if (bestSize === Infinity) {\n+      bestSize = maxSize;\n+    }\n+\n+    var url = icons[bestSize];\n+\n+    if (url) {\n+      return !(/^(http|https|data):/.test(url)) ? app.origin + url : url;","path":"apps/settings/js/modules/app_icon_helper.js","position":40,"original_position":40,"commit_id":"0f1d84608c08d9148f3d383a5db4d5a3e677244f","original_commit_id":"0f1d84608c08d9148f3d383a5db4d5a3e677244f","user":{"login":"davidflanagan","id":516914,"avatar_url":"https://avatars.githubusercontent.com/u/516914?v=3","gravatar_id":"","url":"https://api.github.com/users/davidflanagan","html_url":"https://github.com/davidflanagan","followers_url":"https://api.github.com/users/davidflanagan/followers","following_url":"https://api.github.com/users/davidflanagan/following{/other_user}","gists_url":"https://api.github.com/users/davidflanagan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidflanagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidflanagan/subscriptions","organizations_url":"https://api.github.com/users/davidflanagan/orgs","repos_url":"https://api.github.com/users/davidflanagan/repos","events_url":"https://api.github.com/users/davidflanagan/events{/privacy}","received_events_url":"https://api.github.com/users/davidflanagan/received_events","type":"User","site_admin":false},"body":"Modifying to use URL(). Thanks for that. But if I use manifestURL instead of origin, then the icons for apps like Marketplace do not resolve.\r\n\r\nUsing manifestURL as the base URL, I get:  https://marketplace.firefox.com/app-icons/90.png\r\nBut using the origin, I get: app://packaged.marketplace.allizom.org/app-icons/90.png","created_at":"2015-02-13T19:52:28Z","updated_at":"2015-02-13T19:52:28Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/28137#discussion_r24691376","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/24691376"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28137#discussion_r24691376"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137","id":29075186,"html_url":"https://github.com/mozilla-b2g/gaia/pull/28137","diff_url":"https://github.com/mozilla-b2g/gaia/pull/28137.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/28137.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28137","number":28137,"state":"open","locked":false,"title":"Bug 1131773 - an addon manager panel in the settings app","user":{"login":"davidflanagan","id":516914,"avatar_url":"https://avatars.githubusercontent.com/u/516914?v=3","gravatar_id":"","url":"https://api.github.com/users/davidflanagan","html_url":"https://github.com/davidflanagan","followers_url":"https://api.github.com/users/davidflanagan/followers","following_url":"https://api.github.com/users/davidflanagan/following{/other_user}","gists_url":"https://api.github.com/users/davidflanagan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidflanagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidflanagan/subscriptions","organizations_url":"https://api.github.com/users/davidflanagan/orgs","repos_url":"https://api.github.com/users/davidflanagan/repos","events_url":"https://api.github.com/users/davidflanagan/events{/privacy}","received_events_url":"https://api.github.com/users/davidflanagan/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-11T08:49:12Z","updated_at":"2015-02-13T19:52:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c1efd4c07216bcea1de18fe3c88a471948b5148","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137/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/28137/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/0f1d84608c08d9148f3d383a5db4d5a3e677244f","head":{"label":"davidflanagan:bug1131773","ref":"bug1131773","sha":"0f1d84608c08d9148f3d383a5db4d5a3e677244f","user":{"login":"davidflanagan","id":516914,"avatar_url":"https://avatars.githubusercontent.com/u/516914?v=3","gravatar_id":"","url":"https://api.github.com/users/davidflanagan","html_url":"https://github.com/davidflanagan","followers_url":"https://api.github.com/users/davidflanagan/followers","following_url":"https://api.github.com/users/davidflanagan/following{/other_user}","gists_url":"https://api.github.com/users/davidflanagan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidflanagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidflanagan/subscriptions","organizations_url":"https://api.github.com/users/davidflanagan/orgs","repos_url":"https://api.github.com/users/davidflanagan/repos","events_url":"https://api.github.com/users/davidflanagan/events{/privacy}","received_events_url":"https://api.github.com/users/davidflanagan/received_events","type":"User","site_admin":false},"repo":{"id":5606914,"name":"gaia","full_name":"davidflanagan/gaia","owner":{"login":"davidflanagan","id":516914,"avatar_url":"https://avatars.githubusercontent.com/u/516914?v=3","gravatar_id":"","url":"https://api.github.com/users/davidflanagan","html_url":"https://github.com/davidflanagan","followers_url":"https://api.github.com/users/davidflanagan/followers","following_url":"https://api.github.com/users/davidflanagan/following{/other_user}","gists_url":"https://api.github.com/users/davidflanagan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidflanagan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidflanagan/subscriptions","organizations_url":"https://api.github.com/users/davidflanagan/orgs","repos_url":"https://api.github.com/users/davidflanagan/repos","events_url":"https://api.github.com/users/davidflanagan/events{/privacy}","received_events_url":"https://api.github.com/users/davidflanagan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davidflanagan/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project","fork":true,"url":"https://api.github.com/repos/davidflanagan/gaia","forks_url":"https://api.github.com/repos/davidflanagan/gaia/forks","keys_url":"https://api.github.com/repos/davidflanagan/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidflanagan/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidflanagan/gaia/teams","hooks_url":"https://api.github.com/repos/davidflanagan/gaia/hooks","issue_events_url":"https://api.github.com/repos/davidflanagan/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/davidflanagan/gaia/events","assignees_url":"https://api.github.com/repos/davidflanagan/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/davidflanagan/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/davidflanagan/gaia/tags","blobs_url":"https://api.github.com/repos/davidflanagan/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidflanagan/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidflanagan/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidflanagan/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidflanagan/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/davidflanagan/gaia/languages","stargazers_url":"https://api.github.com/repos/davidflanagan/gaia/stargazers","contributors_url":"https://api.github.com/repos/davidflanagan/gaia/contributors","subscribers_url":"https://api.github.com/repos/davidflanagan/gaia/subscribers","subscription_url":"https://api.github.com/repos/davidflanagan/gaia/subscription","commits_url":"https://api.github.com/repos/davidflanagan/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidflanagan/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidflanagan/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidflanagan/gaia/issues/comments/{number}","contents_url":"https://api.github.com/repos/davidflanagan/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/davidflanagan/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidflanagan/gaia/merges","archive_url":"https://api.github.com/repos/davidflanagan/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidflanagan/gaia/downloads","issues_url":"https://api.github.com/repos/davidflanagan/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/davidflanagan/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/davidflanagan/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/davidflanagan/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidflanagan/gaia/labels{/name}","releases_url":"https://api.github.com/repos/davidflanagan/gaia/releases{/id}","created_at":"2012-08-29T21:29:12Z","updated_at":"2014-08-07T04:28:24Z","pushed_at":"2015-02-13T08:11:00Z","git_url":"git://github.com/davidflanagan/gaia.git","ssh_url":"git@github.com:davidflanagan/gaia.git","clone_url":"https://github.com/davidflanagan/gaia.git","svn_url":"https://github.com/davidflanagan/gaia","homepage":"https://wiki.mozilla.org/B2G","size":933094,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"3c6d38bb0b016eb8d1083a8f3c3d837303a71dda","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-02-13T15:10:38Z","pushed_at":"2015-02-13T13:14:05Z","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":1412313,"stargazers_count":1872,"watchers_count":1872,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2221,"mirror_url":null,"open_issues_count":905,"forks":2221,"open_issues":905,"watchers":1872,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/28137"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28137"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/28137/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/28137/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/28137/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/0f1d84608c08d9148f3d383a5db4d5a3e677244f"}}}}