{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/43387107","id":43387107,"diff_hunk":"@@ -0,0 +1,53 @@\n+/**\n+ * Returns true or false based on whether doNotTack is enabled. It also takes into account the\n+ * anomalies, such as !bugzilla 887703, which effect versions of Fx 31 and lower. It also handles\n+ * IE versions on Windows 7, 8 and 8.1, where the DNT implementation does not honor the spec.\n+ * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1217896 for more details\n+ * @params {string} [dnt] - An optional mock doNotTrack string to ease unit testing.\n+ * @params {string} [ua] - An optional mock userAgent string to ease unit testing.\n+ * @returns {boolean} true if enabled else false\n+ */\n+function _dntEnabled(dnt, ua) {\n+\n+    'use strict';\n+\n+    // for old version of IE we need to use the msDoNotTrack property of navigator\n+    // on newer versions, and newer platforms, this is doNotTrack but, on the window object\n+    // Safari also exposes the property on the window object.\n+    var dntStatus = dnt || navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;\n+    var ua = ua || navigator.userAgent;\n+\n+    // List of Windows versions known to not implement DNT according to the standard.\n+    var anomalousWinVersions = ['Windows NT 6.1', 'Windows NT 6.2', 'Windows NT 6.3'];\n+\n+    var fxMatch = ua.match(/Firefox\\/(\\d+)/);\n+    // Matches from Windows up to the first occurance of ; un-greedily\n+    // http://www.regexr.com/3c2el\n+    var platformRegEx = /Windows.+?(?=;)/g;\n+    var ieRegEx = /MSIE|Trident/i;\n+    var isIE = ieRegEx.test(ua);\n+    var platform = '';\n+\n+    if (isIE) {\n+        // We are only concerned with the platform if this is IE\n+        platform = platformRegEx.exec(ua);\n+        // With old versions of IE, DNT did not exist so we simply return false;\n+        if (typeof Array.prototype.indexOf !== 'function') {\n+            return false;","path":"media/js/base/dnt-helper.js","position":36,"original_position":36,"commit_id":"92911390bd0bf259b8196a9c0b089723b52e916d","original_commit_id":"92911390bd0bf259b8196a9c0b089723b52e916d","user":{"login":"alexgibson","id":400117,"avatar_url":"https://avatars.githubusercontent.com/u/400117?v=3","gravatar_id":"","url":"https://api.github.com/users/alexgibson","html_url":"https://github.com/alexgibson","followers_url":"https://api.github.com/users/alexgibson/followers","following_url":"https://api.github.com/users/alexgibson/following{/other_user}","gists_url":"https://api.github.com/users/alexgibson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexgibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexgibson/subscriptions","organizations_url":"https://api.github.com/users/alexgibson/orgs","repos_url":"https://api.github.com/users/alexgibson/repos","events_url":"https://api.github.com/users/alexgibson/events{/privacy}","received_events_url":"https://api.github.com/users/alexgibson/received_events","type":"User","site_admin":false},"body":"Would it be worthwhile moving this conditional return to the same block as the rest of the statements at the end of the function? Might make things slightly simpler to follow? e.g.\r\n\r\n    if (isIE && typeof Array.prototype.indexOf !== 'function') {\r\n        return false;\r\n    else if {\r\n        //etc...\r\n    }","created_at":"2015-10-29T13:59:00Z","updated_at":"2015-10-29T13:59:00Z","html_url":"https://github.com/mozilla/bedrock/pull/3478#discussion_r43387107","pull_request_url":"https://api.github.com/repos/mozilla/bedrock/pulls/3478","_links":{"self":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/43387107"},"html":{"href":"https://github.com/mozilla/bedrock/pull/3478#discussion_r43387107"},"pull_request":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/3478"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/bedrock/pulls/3478","id":48867893,"html_url":"https://github.com/mozilla/bedrock/pull/3478","diff_url":"https://github.com/mozilla/bedrock/pull/3478.diff","patch_url":"https://github.com/mozilla/bedrock/pull/3478.patch","issue_url":"https://api.github.com/repos/mozilla/bedrock/issues/3478","number":3478,"state":"open","locked":false,"title":"Fix Bug 1217896, wrap GA in DNT conditional","user":{"login":"schalkneethling","id":10350960,"avatar_url":"https://avatars.githubusercontent.com/u/10350960?v=3","gravatar_id":"","url":"https://api.github.com/users/schalkneethling","html_url":"https://github.com/schalkneethling","followers_url":"https://api.github.com/users/schalkneethling/followers","following_url":"https://api.github.com/users/schalkneethling/following{/other_user}","gists_url":"https://api.github.com/users/schalkneethling/gists{/gist_id}","starred_url":"https://api.github.com/users/schalkneethling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schalkneethling/subscriptions","organizations_url":"https://api.github.com/users/schalkneethling/orgs","repos_url":"https://api.github.com/users/schalkneethling/repos","events_url":"https://api.github.com/users/schalkneethling/events{/privacy}","received_events_url":"https://api.github.com/users/schalkneethling/received_events","type":"User","site_admin":false},"body":"@alexgibson @jpetto r?","created_at":"2015-10-27T13:10:16Z","updated_at":"2015-10-29T13:59:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4227ac4e0fc09941a6ed01948014c6d61627e5a2","assignee":{"login":"alexgibson","id":400117,"avatar_url":"https://avatars.githubusercontent.com/u/400117?v=3","gravatar_id":"","url":"https://api.github.com/users/alexgibson","html_url":"https://github.com/alexgibson","followers_url":"https://api.github.com/users/alexgibson/followers","following_url":"https://api.github.com/users/alexgibson/following{/other_user}","gists_url":"https://api.github.com/users/alexgibson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexgibson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexgibson/subscriptions","organizations_url":"https://api.github.com/users/alexgibson/orgs","repos_url":"https://api.github.com/users/alexgibson/repos","events_url":"https://api.github.com/users/alexgibson/events{/privacy}","received_events_url":"https://api.github.com/users/alexgibson/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/bedrock/pulls/3478/commits","review_comments_url":"https://api.github.com/repos/mozilla/bedrock/pulls/3478/comments","review_comment_url":"https://api.github.com/repos/mozilla/bedrock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/bedrock/issues/3478/comments","statuses_url":"https://api.github.com/repos/mozilla/bedrock/statuses/92911390bd0bf259b8196a9c0b089723b52e916d","head":{"label":"schalkneethling:bug1217896-wrap-ga-in-dnt-conditional","ref":"bug1217896-wrap-ga-in-dnt-conditional","sha":"92911390bd0bf259b8196a9c0b089723b52e916d","user":{"login":"schalkneethling","id":10350960,"avatar_url":"https://avatars.githubusercontent.com/u/10350960?v=3","gravatar_id":"","url":"https://api.github.com/users/schalkneethling","html_url":"https://github.com/schalkneethling","followers_url":"https://api.github.com/users/schalkneethling/followers","following_url":"https://api.github.com/users/schalkneethling/following{/other_user}","gists_url":"https://api.github.com/users/schalkneethling/gists{/gist_id}","starred_url":"https://api.github.com/users/schalkneethling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schalkneethling/subscriptions","organizations_url":"https://api.github.com/users/schalkneethling/orgs","repos_url":"https://api.github.com/users/schalkneethling/repos","events_url":"https://api.github.com/users/schalkneethling/events{/privacy}","received_events_url":"https://api.github.com/users/schalkneethling/received_events","type":"User","site_admin":false},"repo":{"id":4284689,"name":"bedrock","full_name":"schalkneethling/bedrock","owner":{"login":"schalkneethling","id":10350960,"avatar_url":"https://avatars.githubusercontent.com/u/10350960?v=3","gravatar_id":"","url":"https://api.github.com/users/schalkneethling","html_url":"https://github.com/schalkneethling","followers_url":"https://api.github.com/users/schalkneethling/followers","following_url":"https://api.github.com/users/schalkneethling/following{/other_user}","gists_url":"https://api.github.com/users/schalkneethling/gists{/gist_id}","starred_url":"https://api.github.com/users/schalkneethling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schalkneethling/subscriptions","organizations_url":"https://api.github.com/users/schalkneethling/orgs","repos_url":"https://api.github.com/users/schalkneethling/repos","events_url":"https://api.github.com/users/schalkneethling/events{/privacy}","received_events_url":"https://api.github.com/users/schalkneethling/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/schalkneethling/bedrock","description":"Making mozilla.org awesome, one pebble at a time","fork":true,"url":"https://api.github.com/repos/schalkneethling/bedrock","forks_url":"https://api.github.com/repos/schalkneethling/bedrock/forks","keys_url":"https://api.github.com/repos/schalkneethling/bedrock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/schalkneethling/bedrock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/schalkneethling/bedrock/teams","hooks_url":"https://api.github.com/repos/schalkneethling/bedrock/hooks","issue_events_url":"https://api.github.com/repos/schalkneethling/bedrock/issues/events{/number}","events_url":"https://api.github.com/repos/schalkneethling/bedrock/events","assignees_url":"https://api.github.com/repos/schalkneethling/bedrock/assignees{/user}","branches_url":"https://api.github.com/repos/schalkneethling/bedrock/branches{/branch}","tags_url":"https://api.github.com/repos/schalkneethling/bedrock/tags","blobs_url":"https://api.github.com/repos/schalkneethling/bedrock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/schalkneethling/bedrock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/schalkneethling/bedrock/git/refs{/sha}","trees_url":"https://api.github.com/repos/schalkneethling/bedrock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/schalkneethling/bedrock/statuses/{sha}","languages_url":"https://api.github.com/repos/schalkneethling/bedrock/languages","stargazers_url":"https://api.github.com/repos/schalkneethling/bedrock/stargazers","contributors_url":"https://api.github.com/repos/schalkneethling/bedrock/contributors","subscribers_url":"https://api.github.com/repos/schalkneethling/bedrock/subscribers","subscription_url":"https://api.github.com/repos/schalkneethling/bedrock/subscription","commits_url":"https://api.github.com/repos/schalkneethling/bedrock/commits{/sha}","git_commits_url":"https://api.github.com/repos/schalkneethling/bedrock/git/commits{/sha}","comments_url":"https://api.github.com/repos/schalkneethling/bedrock/comments{/number}","issue_comment_url":"https://api.github.com/repos/schalkneethling/bedrock/issues/comments{/number}","contents_url":"https://api.github.com/repos/schalkneethling/bedrock/contents/{+path}","compare_url":"https://api.github.com/repos/schalkneethling/bedrock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/schalkneethling/bedrock/merges","archive_url":"https://api.github.com/repos/schalkneethling/bedrock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/schalkneethling/bedrock/downloads","issues_url":"https://api.github.com/repos/schalkneethling/bedrock/issues{/number}","pulls_url":"https://api.github.com/repos/schalkneethling/bedrock/pulls{/number}","milestones_url":"https://api.github.com/repos/schalkneethling/bedrock/milestones{/number}","notifications_url":"https://api.github.com/repos/schalkneethling/bedrock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/schalkneethling/bedrock/labels{/name}","releases_url":"https://api.github.com/repos/schalkneethling/bedrock/releases{/id}","created_at":"2012-05-10T13:21:55Z","updated_at":"2015-05-04T12:53:53Z","pushed_at":"2015-10-29T12:15:55Z","git_url":"git://github.com/schalkneethling/bedrock.git","ssh_url":"git@github.com:schalkneethling/bedrock.git","clone_url":"https://github.com/schalkneethling/bedrock.git","svn_url":"https://github.com/schalkneethling/bedrock","homepage":"http://mozilla.org","size":343509,"stargazers_count":1,"watchers_count":1,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"d6d55240ea01921d692f8e55d991e7f70f6d1c2e","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1616665,"name":"bedrock","full_name":"mozilla/bedrock","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/bedrock","description":"Making mozilla.org awesome, one pebble at a time","fork":false,"url":"https://api.github.com/repos/mozilla/bedrock","forks_url":"https://api.github.com/repos/mozilla/bedrock/forks","keys_url":"https://api.github.com/repos/mozilla/bedrock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/bedrock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/bedrock/teams","hooks_url":"https://api.github.com/repos/mozilla/bedrock/hooks","issue_events_url":"https://api.github.com/repos/mozilla/bedrock/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/bedrock/events","assignees_url":"https://api.github.com/repos/mozilla/bedrock/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/bedrock/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/bedrock/tags","blobs_url":"https://api.github.com/repos/mozilla/bedrock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/bedrock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/bedrock/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/bedrock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/bedrock/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/bedrock/languages","stargazers_url":"https://api.github.com/repos/mozilla/bedrock/stargazers","contributors_url":"https://api.github.com/repos/mozilla/bedrock/contributors","subscribers_url":"https://api.github.com/repos/mozilla/bedrock/subscribers","subscription_url":"https://api.github.com/repos/mozilla/bedrock/subscription","commits_url":"https://api.github.com/repos/mozilla/bedrock/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/bedrock/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/bedrock/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/bedrock/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/bedrock/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/bedrock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/bedrock/merges","archive_url":"https://api.github.com/repos/mozilla/bedrock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/bedrock/downloads","issues_url":"https://api.github.com/repos/mozilla/bedrock/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/bedrock/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/bedrock/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/bedrock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/bedrock/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/bedrock/releases{/id}","created_at":"2011-04-14T22:57:57Z","updated_at":"2015-10-28T06:57:06Z","pushed_at":"2015-10-29T13:39:33Z","git_url":"git://github.com/mozilla/bedrock.git","ssh_url":"git@github.com:mozilla/bedrock.git","clone_url":"https://github.com/mozilla/bedrock.git","svn_url":"https://github.com/mozilla/bedrock","homepage":"https://www.mozilla.org","size":390061,"stargazers_count":263,"watchers_count":263,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":372,"mirror_url":null,"open_issues_count":30,"forks":372,"open_issues":30,"watchers":263,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/3478"},"html":{"href":"https://github.com/mozilla/bedrock/pull/3478"},"issue":{"href":"https://api.github.com/repos/mozilla/bedrock/issues/3478"},"comments":{"href":"https://api.github.com/repos/mozilla/bedrock/issues/3478/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/3478/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/3478/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/bedrock/statuses/92911390bd0bf259b8196a9c0b089723b52e916d"}}}}