{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments/86338100","pull_request_review_id":6997627,"id":86338100,"diff_hunk":"@@ -0,0 +1,96 @@\n+/**\n+ * @license\n+ * Copyright 2016 Google Inc. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+'use strict';\n+\n+const Gatherer = require('../gatherer');\n+\n+/* global document,window */\n+\n+/* istanbul ignore next */\n+function getBlockFirstPaintLink() {\n+// filtered match stylesheet/import\n+// ref)\n+// https://www.igvita.com/2012/06/14/debunking-responsive-css-performance-myths/\n+// https://www.w3.org/TR/html-imports/#dfn-import-async-attribute\n+  const linkList = [... document.querySelectorAll('head link')].filter(link => {\n+    const asyncAttr = link.getAttribute('async');\n+    return (link.rel === 'stylesheet' && window.matchMedia(link.media).matches) ||\n+           (link.rel === 'import' && (asyncAttr === '' || asyncAttr));\n+  }).map(link => link.href);\n+\n+  return Promise.resolve(linkList);\n+}\n+\n+class LinkInHead extends Gatherer {\n+\n+  _filteredLink(tracingData) {\n+    return tracingData.networkRecords.reduce((prev, record) => {\n+      // stylesheet of mimeType is text/css.\n+      // import of mimeType is text/html.\n+      if (/(css|html)/.test(record._mimeType)) {\n+        prev[record._url] = {\n+          transferSize: record._transferSize,\n+          startTime: record._startTime,\n+          endTime: record._endTime\n+        };\n+      }\n+      return prev;\n+    }, {});\n+  }\n+\n+  _formatMS(info) {\n+    return Math.round((info.endTime - info.startTime) * 100) / 100;\n+  }\n+\n+  afterPass(options, tracingData) {\n+    const linkInfo = this._filteredLink(tracingData);\n+    const driver = options.driver;\n+    this.artifact = {};\n+    return driver.evaluateAsync(`(${getBlockFirstPaintLink.toString()}())`)\n+      .then(result => {\n+        let totalTransferSize = 0;\n+        let totalSpendTime = 0;\n+        const filteredData = result.reduce((prev, url) => {\n+          if (linkInfo[url]) {\n+            const data = {};\n+            data.url = url;\n+            data.transferSize = linkInfo[url].transferSize;\n+            totalTransferSize += data.transferSize;\n+            data.spendTime = this._formatMS(linkInfo[url]);\n+            totalSpendTime += data.spendTime;\n+            prev.push(data);\n+          }\n+          return prev;\n+        }, []);\n+        this.artifact = {\n+          each: filteredData,","path":"lighthouse-core/gather/gatherers/dobetterweb/link-in-head.js","position":80,"original_position":80,"commit_id":"4db8c7cca152dc08be107e5b8927235e4fbb6e9d","original_commit_id":"4db8c7cca152dc08be107e5b8927235e4fbb6e9d","user":{"login":"mixed","id":22300,"avatar_url":"https://avatars.githubusercontent.com/u/22300?v=3","gravatar_id":"","url":"https://api.github.com/users/mixed","html_url":"https://github.com/mixed","followers_url":"https://api.github.com/users/mixed/followers","following_url":"https://api.github.com/users/mixed/following{/other_user}","gists_url":"https://api.github.com/users/mixed/gists{/gist_id}","starred_url":"https://api.github.com/users/mixed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixed/subscriptions","organizations_url":"https://api.github.com/users/mixed/orgs","repos_url":"https://api.github.com/users/mixed/repos","events_url":"https://api.github.com/users/mixed/events{/privacy}","received_events_url":"https://api.github.com/users/mixed/received_events","type":"User","site_admin":false},"body":"OK. IMO `items` is good. ","created_at":"2016-11-03T13:12:01Z","updated_at":"2016-11-03T13:24:08Z","html_url":"https://github.com/GoogleChrome/lighthouse/pull/892#discussion_r86338100","pull_request_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892","_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments/86338100"},"html":{"href":"https://github.com/GoogleChrome/lighthouse/pull/892#discussion_r86338100"},"pull_request":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892","id":91976851,"html_url":"https://github.com/GoogleChrome/lighthouse/pull/892","diff_url":"https://github.com/GoogleChrome/lighthouse/pull/892.diff","patch_url":"https://github.com/GoogleChrome/lighthouse/pull/892.patch","issue_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/892","number":892,"state":"open","locked":false,"title":"DBW: <link rel=stylesheet> in head will block first paint ","user":{"login":"mixed","id":22300,"avatar_url":"https://avatars.githubusercontent.com/u/22300?v=3","gravatar_id":"","url":"https://api.github.com/users/mixed","html_url":"https://github.com/mixed","followers_url":"https://api.github.com/users/mixed/followers","following_url":"https://api.github.com/users/mixed/following{/other_user}","gists_url":"https://api.github.com/users/mixed/gists{/gist_id}","starred_url":"https://api.github.com/users/mixed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixed/subscriptions","organizations_url":"https://api.github.com/users/mixed/orgs","repos_url":"https://api.github.com/users/mixed/repos","events_url":"https://api.github.com/users/mixed/events{/privacy}","received_events_url":"https://api.github.com/users/mixed/received_events","type":"User","site_admin":false},"body":"#838\r\n![image](https://cloud.githubusercontent.com/assets/22300/19933067/876d467c-a155-11e6-9881-4e1f48771164.png)\r\n","created_at":"2016-11-02T14:11:55Z","updated_at":"2016-11-03T13:24:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dfae6be9583f24a9cdb2c5881a905f26055fa124","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892/commits","review_comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892/comments","review_comment_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/892/comments","statuses_url":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/4db8c7cca152dc08be107e5b8927235e4fbb6e9d","head":{"label":"mixed:blockFirstPaint","ref":"blockFirstPaint","sha":"4db8c7cca152dc08be107e5b8927235e4fbb6e9d","user":{"login":"mixed","id":22300,"avatar_url":"https://avatars.githubusercontent.com/u/22300?v=3","gravatar_id":"","url":"https://api.github.com/users/mixed","html_url":"https://github.com/mixed","followers_url":"https://api.github.com/users/mixed/followers","following_url":"https://api.github.com/users/mixed/following{/other_user}","gists_url":"https://api.github.com/users/mixed/gists{/gist_id}","starred_url":"https://api.github.com/users/mixed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixed/subscriptions","organizations_url":"https://api.github.com/users/mixed/orgs","repos_url":"https://api.github.com/users/mixed/repos","events_url":"https://api.github.com/users/mixed/events{/privacy}","received_events_url":"https://api.github.com/users/mixed/received_events","type":"User","site_admin":false},"repo":{"id":68934790,"name":"lighthouse","full_name":"mixed/lighthouse","owner":{"login":"mixed","id":22300,"avatar_url":"https://avatars.githubusercontent.com/u/22300?v=3","gravatar_id":"","url":"https://api.github.com/users/mixed","html_url":"https://github.com/mixed","followers_url":"https://api.github.com/users/mixed/followers","following_url":"https://api.github.com/users/mixed/following{/other_user}","gists_url":"https://api.github.com/users/mixed/gists{/gist_id}","starred_url":"https://api.github.com/users/mixed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixed/subscriptions","organizations_url":"https://api.github.com/users/mixed/orgs","repos_url":"https://api.github.com/users/mixed/repos","events_url":"https://api.github.com/users/mixed/events{/privacy}","received_events_url":"https://api.github.com/users/mixed/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mixed/lighthouse","description":"auditing and performance metrics for Progressive Web Apps","fork":true,"url":"https://api.github.com/repos/mixed/lighthouse","forks_url":"https://api.github.com/repos/mixed/lighthouse/forks","keys_url":"https://api.github.com/repos/mixed/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mixed/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mixed/lighthouse/teams","hooks_url":"https://api.github.com/repos/mixed/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/mixed/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/mixed/lighthouse/events","assignees_url":"https://api.github.com/repos/mixed/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/mixed/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/mixed/lighthouse/tags","blobs_url":"https://api.github.com/repos/mixed/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mixed/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mixed/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/mixed/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mixed/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/mixed/lighthouse/languages","stargazers_url":"https://api.github.com/repos/mixed/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/mixed/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/mixed/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/mixed/lighthouse/subscription","commits_url":"https://api.github.com/repos/mixed/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/mixed/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/mixed/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/mixed/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/mixed/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/mixed/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mixed/lighthouse/merges","archive_url":"https://api.github.com/repos/mixed/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mixed/lighthouse/downloads","issues_url":"https://api.github.com/repos/mixed/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/mixed/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/mixed/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/mixed/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mixed/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/mixed/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/mixed/lighthouse/deployments","created_at":"2016-09-22T15:25:55Z","updated_at":"2016-09-22T15:25:57Z","pushed_at":"2016-11-03T12:17:32Z","git_url":"git://github.com/mixed/lighthouse.git","ssh_url":"git@github.com:mixed/lighthouse.git","clone_url":"https://github.com/mixed/lighthouse.git","svn_url":"https://github.com/mixed/lighthouse","homepage":"","size":8216,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleChrome:master","ref":"master","sha":"056c2b108e53dfa7bb9702a1081311b4943bea5f","user":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"repo":{"id":53370988,"name":"lighthouse","full_name":"GoogleChrome/lighthouse","owner":{"login":"GoogleChrome","id":1778935,"avatar_url":"https://avatars.githubusercontent.com/u/1778935?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleChrome","html_url":"https://github.com/GoogleChrome","followers_url":"https://api.github.com/users/GoogleChrome/followers","following_url":"https://api.github.com/users/GoogleChrome/following{/other_user}","gists_url":"https://api.github.com/users/GoogleChrome/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleChrome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleChrome/subscriptions","organizations_url":"https://api.github.com/users/GoogleChrome/orgs","repos_url":"https://api.github.com/users/GoogleChrome/repos","events_url":"https://api.github.com/users/GoogleChrome/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleChrome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleChrome/lighthouse","description":"auditing and performance metrics for Progressive Web Apps","fork":false,"url":"https://api.github.com/repos/GoogleChrome/lighthouse","forks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/forks","keys_url":"https://api.github.com/repos/GoogleChrome/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleChrome/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleChrome/lighthouse/teams","hooks_url":"https://api.github.com/repos/GoogleChrome/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleChrome/lighthouse/events","assignees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleChrome/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/tags","blobs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleChrome/lighthouse/languages","stargazers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/GoogleChrome/lighthouse/subscription","commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleChrome/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleChrome/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleChrome/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleChrome/lighthouse/merges","archive_url":"https://api.github.com/repos/GoogleChrome/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleChrome/lighthouse/downloads","issues_url":"https://api.github.com/repos/GoogleChrome/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleChrome/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleChrome/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleChrome/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/GoogleChrome/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleChrome/lighthouse/deployments","created_at":"2016-03-08T01:03:11Z","updated_at":"2016-11-03T13:22:19Z","pushed_at":"2016-11-03T12:17:32Z","git_url":"git://github.com/GoogleChrome/lighthouse.git","ssh_url":"git@github.com:GoogleChrome/lighthouse.git","clone_url":"https://github.com/GoogleChrome/lighthouse.git","svn_url":"https://github.com/GoogleChrome/lighthouse","homepage":"","size":10405,"stargazers_count":3874,"watchers_count":3874,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":141,"mirror_url":null,"open_issues_count":117,"forks":141,"open_issues":117,"watchers":3874,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892"},"html":{"href":"https://github.com/GoogleChrome/lighthouse/pull/892"},"issue":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/892"},"comments":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/issues/892/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/pulls/892/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleChrome/lighthouse/statuses/4db8c7cca152dc08be107e5b8927235e4fbb6e9d"}}}}
{"actor":{"display_login":"mixed"}}