{"action":"created","comment":{"url":"https://api.github.com/repos/electron/electron/pulls/comments/64804479","id":64804479,"diff_hunk":"@@ -69,74 +114,69 @@ app.on('will-quit', function () {\n \n // We can not use protocol or BrowserWindow until app is ready.\n app.once('ready', function () {\n-  var chromeExtensionHandler, i, init, len, srcDirectory\n-\n   // Load persisted extensions.\n   loadedExtensionsPath = path.join(app.getPath('userData'), 'DevTools Extensions')\n   try {\n-    loadedExtensions = JSON.parse(fs.readFileSync(loadedExtensionsPath))\n-    if (!Array.isArray(loadedExtensions)) {\n-      loadedExtensions = []\n-    }\n-\n-    // Preheat the extensionInfo cache.\n-    for (i = 0, len = loadedExtensions.length; i < len; i++) {\n-      srcDirectory = loadedExtensions[i]\n-      getExtensionInfoFromPath(srcDirectory)\n+    let loadedExtensions = JSON.parse(fs.readFileSync(loadedExtensionsPath))\n+    if (Array.isArray(loadedExtensions)) {\n+      // Preheat the manifest cache.\n+      for (let srcDirectory of loadedExtensions) {\n+        getManifestFromPath(srcDirectory)\n+      }\n     }\n   } catch (error) {\n     // Ignore error\n   }\n \n   // The chrome-extension: can map a extension URL request to real file path.\n-  chromeExtensionHandler = function (request, callback) {\n-    var directory, parsed\n-    parsed = url.parse(request.url)\n-    if (!(parsed.hostname && (parsed.path != null))) {\n-      return callback()\n-    }\n-    if (!/extension-\\d+/.test(parsed.hostname)) {\n-      return callback()\n-    }\n-    directory = getPathForHost(parsed.hostname)\n-    if (directory == null) {\n-      return callback()\n+  const chromeExtensionHandler = function (request, callback) {\n+    let parsed = url.parse(request.url)\n+    if (!parsed.hostname || !parsed.path) return callback()\n+    if (!/extension-\\d+/.test(parsed.hostname)) return callback()\n+\n+    let directory = getPathForHost(parsed.hostname)\n+    if (!directory) return callback()\n+\n+    if (parsed.path === '/_generated_background_page.html' &&\n+        backgroundPages[parsed.hostname]) {\n+      return callback({\n+        mimeType: 'text/html',\n+        data: backgroundPages[parsed.hostname].html\n+      })\n     }\n-    return callback(path.join(directory, parsed.path))\n+\n+    fs.readFile(path.join(directory, parsed.path), function (err, content) {\n+      if (err)\n+        callback(-6)  // FILE_NOT_FOUND\n+      else\n+        return callback({mimeType: 'text/html', data: content})","path":"lib/browser/chrome-extension.js","position":198,"original_position":198,"commit_id":"cdfbe876a57f298cb1b2ce57cc41b942130ddf72","original_commit_id":"cdfbe876a57f298cb1b2ce57cc41b942130ddf72","user":{"login":"kevinsawicki","id":671378,"avatar_url":"https://avatars.githubusercontent.com/u/671378?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinsawicki","html_url":"https://github.com/kevinsawicki","followers_url":"https://api.github.com/users/kevinsawicki/followers","following_url":"https://api.github.com/users/kevinsawicki/following{/other_user}","gists_url":"https://api.github.com/users/kevinsawicki/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinsawicki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinsawicki/subscriptions","organizations_url":"https://api.github.com/users/kevinsawicki/orgs","repos_url":"https://api.github.com/users/kevinsawicki/repos","events_url":"https://api.github.com/users/kevinsawicki/events{/privacy}","received_events_url":"https://api.github.com/users/kevinsawicki/received_events","type":"User","site_admin":true},"body":"I don't think you need the `return` here.","created_at":"2016-05-26T19:19:09Z","updated_at":"2016-05-26T19:19:09Z","html_url":"https://github.com/electron/electron/pull/5711#discussion_r64804479","pull_request_url":"https://api.github.com/repos/electron/electron/pulls/5711","_links":{"self":{"href":"https://api.github.com/repos/electron/electron/pulls/comments/64804479"},"html":{"href":"https://github.com/electron/electron/pull/5711#discussion_r64804479"},"pull_request":{"href":"https://api.github.com/repos/electron/electron/pulls/5711"}}},"pull_request":{"url":"https://api.github.com/repos/electron/electron/pulls/5711","id":71537680,"html_url":"https://github.com/electron/electron/pull/5711","diff_url":"https://github.com/electron/electron/pull/5711.diff","patch_url":"https://github.com/electron/electron/pull/5711.patch","issue_url":"https://api.github.com/repos/electron/electron/issues/5711","number":5711,"state":"open","locked":false,"title":"Implement partial chrome.* API for devtools extension","user":{"login":"zcbenz","id":639601,"avatar_url":"https://avatars.githubusercontent.com/u/639601?v=3","gravatar_id":"","url":"https://api.github.com/users/zcbenz","html_url":"https://github.com/zcbenz","followers_url":"https://api.github.com/users/zcbenz/followers","following_url":"https://api.github.com/users/zcbenz/following{/other_user}","gists_url":"https://api.github.com/users/zcbenz/gists{/gist_id}","starred_url":"https://api.github.com/users/zcbenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcbenz/subscriptions","organizations_url":"https://api.github.com/users/zcbenz/orgs","repos_url":"https://api.github.com/users/zcbenz/repos","events_url":"https://api.github.com/users/zcbenz/events{/privacy}","received_events_url":"https://api.github.com/users/zcbenz/received_events","type":"User","site_admin":true},"body":"__work in process__\r\n\r\nThe purpose of this PR is to partially implement chrome.* API to make the React devtools extension work.\r\n\r\nClose #915.","created_at":"2016-05-26T11:04:36Z","updated_at":"2016-05-26T19:19:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"caf5b1f89cec309bfc072c3a8fb722e3601b906b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/electron/electron/pulls/5711/commits","review_comments_url":"https://api.github.com/repos/electron/electron/pulls/5711/comments","review_comment_url":"https://api.github.com/repos/electron/electron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/electron/electron/issues/5711/comments","statuses_url":"https://api.github.com/repos/electron/electron/statuses/cdfbe876a57f298cb1b2ce57cc41b942130ddf72","head":{"label":"electron:extension-code-cleanup","ref":"extension-code-cleanup","sha":"cdfbe876a57f298cb1b2ce57cc41b942130ddf72","user":{"login":"electron","id":13409222,"avatar_url":"https://avatars.githubusercontent.com/u/13409222?v=3","gravatar_id":"","url":"https://api.github.com/users/electron","html_url":"https://github.com/electron","followers_url":"https://api.github.com/users/electron/followers","following_url":"https://api.github.com/users/electron/following{/other_user}","gists_url":"https://api.github.com/users/electron/gists{/gist_id}","starred_url":"https://api.github.com/users/electron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electron/subscriptions","organizations_url":"https://api.github.com/users/electron/orgs","repos_url":"https://api.github.com/users/electron/repos","events_url":"https://api.github.com/users/electron/events{/privacy}","received_events_url":"https://api.github.com/users/electron/received_events","type":"Organization","site_admin":false},"repo":{"id":9384267,"name":"electron","full_name":"electron/electron","owner":{"login":"electron","id":13409222,"avatar_url":"https://avatars.githubusercontent.com/u/13409222?v=3","gravatar_id":"","url":"https://api.github.com/users/electron","html_url":"https://github.com/electron","followers_url":"https://api.github.com/users/electron/followers","following_url":"https://api.github.com/users/electron/following{/other_user}","gists_url":"https://api.github.com/users/electron/gists{/gist_id}","starred_url":"https://api.github.com/users/electron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electron/subscriptions","organizations_url":"https://api.github.com/users/electron/orgs","repos_url":"https://api.github.com/users/electron/repos","events_url":"https://api.github.com/users/electron/events{/privacy}","received_events_url":"https://api.github.com/users/electron/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/electron/electron","description":"Build cross platform desktop apps with JavaScript, HTML, and CSS","fork":false,"url":"https://api.github.com/repos/electron/electron","forks_url":"https://api.github.com/repos/electron/electron/forks","keys_url":"https://api.github.com/repos/electron/electron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/electron/electron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/electron/electron/teams","hooks_url":"https://api.github.com/repos/electron/electron/hooks","issue_events_url":"https://api.github.com/repos/electron/electron/issues/events{/number}","events_url":"https://api.github.com/repos/electron/electron/events","assignees_url":"https://api.github.com/repos/electron/electron/assignees{/user}","branches_url":"https://api.github.com/repos/electron/electron/branches{/branch}","tags_url":"https://api.github.com/repos/electron/electron/tags","blobs_url":"https://api.github.com/repos/electron/electron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/electron/electron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/electron/electron/git/refs{/sha}","trees_url":"https://api.github.com/repos/electron/electron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/electron/electron/statuses/{sha}","languages_url":"https://api.github.com/repos/electron/electron/languages","stargazers_url":"https://api.github.com/repos/electron/electron/stargazers","contributors_url":"https://api.github.com/repos/electron/electron/contributors","subscribers_url":"https://api.github.com/repos/electron/electron/subscribers","subscription_url":"https://api.github.com/repos/electron/electron/subscription","commits_url":"https://api.github.com/repos/electron/electron/commits{/sha}","git_commits_url":"https://api.github.com/repos/electron/electron/git/commits{/sha}","comments_url":"https://api.github.com/repos/electron/electron/comments{/number}","issue_comment_url":"https://api.github.com/repos/electron/electron/issues/comments{/number}","contents_url":"https://api.github.com/repos/electron/electron/contents/{+path}","compare_url":"https://api.github.com/repos/electron/electron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/electron/electron/merges","archive_url":"https://api.github.com/repos/electron/electron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/electron/electron/downloads","issues_url":"https://api.github.com/repos/electron/electron/issues{/number}","pulls_url":"https://api.github.com/repos/electron/electron/pulls{/number}","milestones_url":"https://api.github.com/repos/electron/electron/milestones{/number}","notifications_url":"https://api.github.com/repos/electron/electron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/electron/electron/labels{/name}","releases_url":"https://api.github.com/repos/electron/electron/releases{/id}","deployments_url":"https://api.github.com/repos/electron/electron/deployments","created_at":"2013-04-12T01:47:36Z","updated_at":"2016-05-26T19:15:58Z","pushed_at":"2016-05-26T18:52:29Z","git_url":"git://github.com/electron/electron.git","ssh_url":"git@github.com:electron/electron.git","clone_url":"https://github.com/electron/electron.git","svn_url":"https://github.com/electron/electron","homepage":"http://electron.atom.io","size":23495,"stargazers_count":30389,"watchers_count":30389,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3161,"mirror_url":null,"open_issues_count":275,"forks":3161,"open_issues":275,"watchers":30389,"default_branch":"master"}},"base":{"label":"electron:master","ref":"master","sha":"c1272743b922d8f2f2990977a863c5776c4c36cf","user":{"login":"electron","id":13409222,"avatar_url":"https://avatars.githubusercontent.com/u/13409222?v=3","gravatar_id":"","url":"https://api.github.com/users/electron","html_url":"https://github.com/electron","followers_url":"https://api.github.com/users/electron/followers","following_url":"https://api.github.com/users/electron/following{/other_user}","gists_url":"https://api.github.com/users/electron/gists{/gist_id}","starred_url":"https://api.github.com/users/electron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electron/subscriptions","organizations_url":"https://api.github.com/users/electron/orgs","repos_url":"https://api.github.com/users/electron/repos","events_url":"https://api.github.com/users/electron/events{/privacy}","received_events_url":"https://api.github.com/users/electron/received_events","type":"Organization","site_admin":false},"repo":{"id":9384267,"name":"electron","full_name":"electron/electron","owner":{"login":"electron","id":13409222,"avatar_url":"https://avatars.githubusercontent.com/u/13409222?v=3","gravatar_id":"","url":"https://api.github.com/users/electron","html_url":"https://github.com/electron","followers_url":"https://api.github.com/users/electron/followers","following_url":"https://api.github.com/users/electron/following{/other_user}","gists_url":"https://api.github.com/users/electron/gists{/gist_id}","starred_url":"https://api.github.com/users/electron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electron/subscriptions","organizations_url":"https://api.github.com/users/electron/orgs","repos_url":"https://api.github.com/users/electron/repos","events_url":"https://api.github.com/users/electron/events{/privacy}","received_events_url":"https://api.github.com/users/electron/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/electron/electron","description":"Build cross platform desktop apps with JavaScript, HTML, and CSS","fork":false,"url":"https://api.github.com/repos/electron/electron","forks_url":"https://api.github.com/repos/electron/electron/forks","keys_url":"https://api.github.com/repos/electron/electron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/electron/electron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/electron/electron/teams","hooks_url":"https://api.github.com/repos/electron/electron/hooks","issue_events_url":"https://api.github.com/repos/electron/electron/issues/events{/number}","events_url":"https://api.github.com/repos/electron/electron/events","assignees_url":"https://api.github.com/repos/electron/electron/assignees{/user}","branches_url":"https://api.github.com/repos/electron/electron/branches{/branch}","tags_url":"https://api.github.com/repos/electron/electron/tags","blobs_url":"https://api.github.com/repos/electron/electron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/electron/electron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/electron/electron/git/refs{/sha}","trees_url":"https://api.github.com/repos/electron/electron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/electron/electron/statuses/{sha}","languages_url":"https://api.github.com/repos/electron/electron/languages","stargazers_url":"https://api.github.com/repos/electron/electron/stargazers","contributors_url":"https://api.github.com/repos/electron/electron/contributors","subscribers_url":"https://api.github.com/repos/electron/electron/subscribers","subscription_url":"https://api.github.com/repos/electron/electron/subscription","commits_url":"https://api.github.com/repos/electron/electron/commits{/sha}","git_commits_url":"https://api.github.com/repos/electron/electron/git/commits{/sha}","comments_url":"https://api.github.com/repos/electron/electron/comments{/number}","issue_comment_url":"https://api.github.com/repos/electron/electron/issues/comments{/number}","contents_url":"https://api.github.com/repos/electron/electron/contents/{+path}","compare_url":"https://api.github.com/repos/electron/electron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/electron/electron/merges","archive_url":"https://api.github.com/repos/electron/electron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/electron/electron/downloads","issues_url":"https://api.github.com/repos/electron/electron/issues{/number}","pulls_url":"https://api.github.com/repos/electron/electron/pulls{/number}","milestones_url":"https://api.github.com/repos/electron/electron/milestones{/number}","notifications_url":"https://api.github.com/repos/electron/electron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/electron/electron/labels{/name}","releases_url":"https://api.github.com/repos/electron/electron/releases{/id}","deployments_url":"https://api.github.com/repos/electron/electron/deployments","created_at":"2013-04-12T01:47:36Z","updated_at":"2016-05-26T19:15:58Z","pushed_at":"2016-05-26T18:52:29Z","git_url":"git://github.com/electron/electron.git","ssh_url":"git@github.com:electron/electron.git","clone_url":"https://github.com/electron/electron.git","svn_url":"https://github.com/electron/electron","homepage":"http://electron.atom.io","size":23495,"stargazers_count":30389,"watchers_count":30389,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3161,"mirror_url":null,"open_issues_count":275,"forks":3161,"open_issues":275,"watchers":30389,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/electron/electron/pulls/5711"},"html":{"href":"https://github.com/electron/electron/pull/5711"},"issue":{"href":"https://api.github.com/repos/electron/electron/issues/5711"},"comments":{"href":"https://api.github.com/repos/electron/electron/issues/5711/comments"},"review_comments":{"href":"https://api.github.com/repos/electron/electron/pulls/5711/comments"},"review_comment":{"href":"https://api.github.com/repos/electron/electron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/electron/electron/pulls/5711/commits"},"statuses":{"href":"https://api.github.com/repos/electron/electron/statuses/cdfbe876a57f298cb1b2ce57cc41b942130ddf72"}}}}
{"actor":{"display_login":"kevinsawicki"}}