{"action":"created","comment":{"url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/comments/57205022","id":57205022,"diff_hunk":"@@ -1,23 +1,40 @@\n+function firstUnpinnedTab(tabs) {\n+  for (var tab of tabs) {\n+    if (!tab.pinned) {\n+      return tab.index;\n+    }\n+  }\n+}\n+\n document.addEventListener(\"click\", function(e) {\n   function callOnActiveTab(callback) {\n-    chrome.tabs.query({}, function(tabs) {\n+    chrome.tabs.query({windowId: chrome.windows.WINDOW_ID_CURRENT}, function(tabs) {","path":"tabs-tabs-tabs/tabs.js","position":12,"original_position":12,"commit_id":"ce8f0aac4099dc31c544235ae84a76b0268fa991","original_commit_id":"ce8f0aac4099dc31c544235ae84a76b0268fa991","user":{"login":"kmaglione","id":125842,"avatar_url":"https://avatars.githubusercontent.com/u/125842?v=3","gravatar_id":"","url":"https://api.github.com/users/kmaglione","html_url":"https://github.com/kmaglione","followers_url":"https://api.github.com/users/kmaglione/followers","following_url":"https://api.github.com/users/kmaglione/following{/other_user}","gists_url":"https://api.github.com/users/kmaglione/gists{/gist_id}","starred_url":"https://api.github.com/users/kmaglione/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmaglione/subscriptions","organizations_url":"https://api.github.com/users/kmaglione/orgs","repos_url":"https://api.github.com/users/kmaglione/repos","events_url":"https://api.github.com/users/kmaglione/events{/privacy}","received_events_url":"https://api.github.com/users/kmaglione/received_events","type":"User","site_admin":false},"body":"You'd be better off using `currentWindow: true`. Firefox only supports `WINDOW_ID_CURRENT` as of 48.","created_at":"2016-03-23T17:47:58Z","updated_at":"2016-03-23T17:47:58Z","html_url":"https://github.com/mdn/webextensions-examples/pull/49#discussion_r57205022","pull_request_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/comments/57205022"},"html":{"href":"https://github.com/mdn/webextensions-examples/pull/49#discussion_r57205022"},"pull_request":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49","id":63793051,"html_url":"https://github.com/mdn/webextensions-examples/pull/49","diff_url":"https://github.com/mdn/webextensions-examples/pull/49.diff","patch_url":"https://github.com/mdn/webextensions-examples/pull/49.patch","issue_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/49","number":49,"state":"open","locked":false,"title":"handle pinned tabs correctly","user":{"login":"wbamberg","id":432915,"avatar_url":"https://avatars.githubusercontent.com/u/432915?v=3","gravatar_id":"","url":"https://api.github.com/users/wbamberg","html_url":"https://github.com/wbamberg","followers_url":"https://api.github.com/users/wbamberg/followers","following_url":"https://api.github.com/users/wbamberg/following{/other_user}","gists_url":"https://api.github.com/users/wbamberg/gists{/gist_id}","starred_url":"https://api.github.com/users/wbamberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbamberg/subscriptions","organizations_url":"https://api.github.com/users/wbamberg/orgs","repos_url":"https://api.github.com/users/wbamberg/repos","events_url":"https://api.github.com/users/wbamberg/events{/privacy}","received_events_url":"https://api.github.com/users/wbamberg/received_events","type":"User","site_admin":false},"body":"tabs.move() seems to treat pinned and unpinned tabs groups independently: so you can't move an unpinned tab before a pinned tab, or a pinned tab after an unpinned tab.\r\n\r\nFor example:\r\n* if you have one pinned tab, then you can't move an unpinned tab to index 0\r\n* if you have one unpinned tab, then you can't move a pinned tab to index -1\r\n\r\nIf you try, you get a silent failure.\r\n\r\nThis patch is intended to respect that behavior:\r\n\r\n**Move active tab to the beginning of the window**:\r\n\r\n* if active tab is pinned, move to index 0\r\n* if active tab is unpinned, move to the first unpinned index\r\n\r\n**Move active tab to the end of the window**:\r\n\r\n* if active tab is pinned, move to the first unpinned index\r\n* if active tab is unpinned, move to -1","created_at":"2016-03-22T21:06:34Z","updated_at":"2016-03-23T17:47:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee62323ba7b3aa84722ce87efe2a06d78770233a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49/commits","review_comments_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49/comments","review_comment_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/49/comments","statuses_url":"https://api.github.com/repos/mdn/webextensions-examples/statuses/ce8f0aac4099dc31c544235ae84a76b0268fa991","head":{"label":"mdn:tabstabstabs-pinned","ref":"tabstabstabs-pinned","sha":"ce8f0aac4099dc31c544235ae84a76b0268fa991","user":{"login":"mdn","id":7565578,"avatar_url":"https://avatars.githubusercontent.com/u/7565578?v=3","gravatar_id":"","url":"https://api.github.com/users/mdn","html_url":"https://github.com/mdn","followers_url":"https://api.github.com/users/mdn/followers","following_url":"https://api.github.com/users/mdn/following{/other_user}","gists_url":"https://api.github.com/users/mdn/gists{/gist_id}","starred_url":"https://api.github.com/users/mdn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdn/subscriptions","organizations_url":"https://api.github.com/users/mdn/orgs","repos_url":"https://api.github.com/users/mdn/repos","events_url":"https://api.github.com/users/mdn/events{/privacy}","received_events_url":"https://api.github.com/users/mdn/received_events","type":"Organization","site_admin":false},"repo":{"id":40733543,"name":"webextensions-examples","full_name":"mdn/webextensions-examples","owner":{"login":"mdn","id":7565578,"avatar_url":"https://avatars.githubusercontent.com/u/7565578?v=3","gravatar_id":"","url":"https://api.github.com/users/mdn","html_url":"https://github.com/mdn","followers_url":"https://api.github.com/users/mdn/followers","following_url":"https://api.github.com/users/mdn/following{/other_user}","gists_url":"https://api.github.com/users/mdn/gists{/gist_id}","starred_url":"https://api.github.com/users/mdn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdn/subscriptions","organizations_url":"https://api.github.com/users/mdn/orgs","repos_url":"https://api.github.com/users/mdn/repos","events_url":"https://api.github.com/users/mdn/events{/privacy}","received_events_url":"https://api.github.com/users/mdn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdn/webextensions-examples","description":"Example Firefox add-ons created using the WebExtensions API","fork":false,"url":"https://api.github.com/repos/mdn/webextensions-examples","forks_url":"https://api.github.com/repos/mdn/webextensions-examples/forks","keys_url":"https://api.github.com/repos/mdn/webextensions-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdn/webextensions-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdn/webextensions-examples/teams","hooks_url":"https://api.github.com/repos/mdn/webextensions-examples/hooks","issue_events_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/events{/number}","events_url":"https://api.github.com/repos/mdn/webextensions-examples/events","assignees_url":"https://api.github.com/repos/mdn/webextensions-examples/assignees{/user}","branches_url":"https://api.github.com/repos/mdn/webextensions-examples/branches{/branch}","tags_url":"https://api.github.com/repos/mdn/webextensions-examples/tags","blobs_url":"https://api.github.com/repos/mdn/webextensions-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdn/webextensions-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdn/webextensions-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdn/webextensions-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdn/webextensions-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/mdn/webextensions-examples/languages","stargazers_url":"https://api.github.com/repos/mdn/webextensions-examples/stargazers","contributors_url":"https://api.github.com/repos/mdn/webextensions-examples/contributors","subscribers_url":"https://api.github.com/repos/mdn/webextensions-examples/subscribers","subscription_url":"https://api.github.com/repos/mdn/webextensions-examples/subscription","commits_url":"https://api.github.com/repos/mdn/webextensions-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdn/webextensions-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdn/webextensions-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdn/webextensions-examples/contents/{+path}","compare_url":"https://api.github.com/repos/mdn/webextensions-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdn/webextensions-examples/merges","archive_url":"https://api.github.com/repos/mdn/webextensions-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdn/webextensions-examples/downloads","issues_url":"https://api.github.com/repos/mdn/webextensions-examples/issues{/number}","pulls_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/mdn/webextensions-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/mdn/webextensions-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdn/webextensions-examples/labels{/name}","releases_url":"https://api.github.com/repos/mdn/webextensions-examples/releases{/id}","deployments_url":"https://api.github.com/repos/mdn/webextensions-examples/deployments","created_at":"2015-08-14T19:55:54Z","updated_at":"2016-03-18T01:59:23Z","pushed_at":"2016-03-22T23:15:14Z","git_url":"git://github.com/mdn/webextensions-examples.git","ssh_url":"git@github.com:mdn/webextensions-examples.git","clone_url":"https://github.com/mdn/webextensions-examples.git","svn_url":"https://github.com/mdn/webextensions-examples","homepage":null,"size":911,"stargazers_count":97,"watchers_count":97,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":58,"mirror_url":null,"open_issues_count":8,"forks":58,"open_issues":8,"watchers":97,"default_branch":"master"}},"base":{"label":"mdn:master","ref":"master","sha":"12ca9afa94575416b223946f3b9f2b61527516c9","user":{"login":"mdn","id":7565578,"avatar_url":"https://avatars.githubusercontent.com/u/7565578?v=3","gravatar_id":"","url":"https://api.github.com/users/mdn","html_url":"https://github.com/mdn","followers_url":"https://api.github.com/users/mdn/followers","following_url":"https://api.github.com/users/mdn/following{/other_user}","gists_url":"https://api.github.com/users/mdn/gists{/gist_id}","starred_url":"https://api.github.com/users/mdn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdn/subscriptions","organizations_url":"https://api.github.com/users/mdn/orgs","repos_url":"https://api.github.com/users/mdn/repos","events_url":"https://api.github.com/users/mdn/events{/privacy}","received_events_url":"https://api.github.com/users/mdn/received_events","type":"Organization","site_admin":false},"repo":{"id":40733543,"name":"webextensions-examples","full_name":"mdn/webextensions-examples","owner":{"login":"mdn","id":7565578,"avatar_url":"https://avatars.githubusercontent.com/u/7565578?v=3","gravatar_id":"","url":"https://api.github.com/users/mdn","html_url":"https://github.com/mdn","followers_url":"https://api.github.com/users/mdn/followers","following_url":"https://api.github.com/users/mdn/following{/other_user}","gists_url":"https://api.github.com/users/mdn/gists{/gist_id}","starred_url":"https://api.github.com/users/mdn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdn/subscriptions","organizations_url":"https://api.github.com/users/mdn/orgs","repos_url":"https://api.github.com/users/mdn/repos","events_url":"https://api.github.com/users/mdn/events{/privacy}","received_events_url":"https://api.github.com/users/mdn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mdn/webextensions-examples","description":"Example Firefox add-ons created using the WebExtensions API","fork":false,"url":"https://api.github.com/repos/mdn/webextensions-examples","forks_url":"https://api.github.com/repos/mdn/webextensions-examples/forks","keys_url":"https://api.github.com/repos/mdn/webextensions-examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mdn/webextensions-examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mdn/webextensions-examples/teams","hooks_url":"https://api.github.com/repos/mdn/webextensions-examples/hooks","issue_events_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/events{/number}","events_url":"https://api.github.com/repos/mdn/webextensions-examples/events","assignees_url":"https://api.github.com/repos/mdn/webextensions-examples/assignees{/user}","branches_url":"https://api.github.com/repos/mdn/webextensions-examples/branches{/branch}","tags_url":"https://api.github.com/repos/mdn/webextensions-examples/tags","blobs_url":"https://api.github.com/repos/mdn/webextensions-examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mdn/webextensions-examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mdn/webextensions-examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/mdn/webextensions-examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mdn/webextensions-examples/statuses/{sha}","languages_url":"https://api.github.com/repos/mdn/webextensions-examples/languages","stargazers_url":"https://api.github.com/repos/mdn/webextensions-examples/stargazers","contributors_url":"https://api.github.com/repos/mdn/webextensions-examples/contributors","subscribers_url":"https://api.github.com/repos/mdn/webextensions-examples/subscribers","subscription_url":"https://api.github.com/repos/mdn/webextensions-examples/subscription","commits_url":"https://api.github.com/repos/mdn/webextensions-examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/mdn/webextensions-examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/mdn/webextensions-examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/mdn/webextensions-examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/mdn/webextensions-examples/contents/{+path}","compare_url":"https://api.github.com/repos/mdn/webextensions-examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mdn/webextensions-examples/merges","archive_url":"https://api.github.com/repos/mdn/webextensions-examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mdn/webextensions-examples/downloads","issues_url":"https://api.github.com/repos/mdn/webextensions-examples/issues{/number}","pulls_url":"https://api.github.com/repos/mdn/webextensions-examples/pulls{/number}","milestones_url":"https://api.github.com/repos/mdn/webextensions-examples/milestones{/number}","notifications_url":"https://api.github.com/repos/mdn/webextensions-examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mdn/webextensions-examples/labels{/name}","releases_url":"https://api.github.com/repos/mdn/webextensions-examples/releases{/id}","deployments_url":"https://api.github.com/repos/mdn/webextensions-examples/deployments","created_at":"2015-08-14T19:55:54Z","updated_at":"2016-03-18T01:59:23Z","pushed_at":"2016-03-22T23:15:14Z","git_url":"git://github.com/mdn/webextensions-examples.git","ssh_url":"git@github.com:mdn/webextensions-examples.git","clone_url":"https://github.com/mdn/webextensions-examples.git","svn_url":"https://github.com/mdn/webextensions-examples","homepage":null,"size":911,"stargazers_count":97,"watchers_count":97,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":58,"mirror_url":null,"open_issues_count":8,"forks":58,"open_issues":8,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49"},"html":{"href":"https://github.com/mdn/webextensions-examples/pull/49"},"issue":{"href":"https://api.github.com/repos/mdn/webextensions-examples/issues/49"},"comments":{"href":"https://api.github.com/repos/mdn/webextensions-examples/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mdn/webextensions-examples/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/mdn/webextensions-examples/statuses/ce8f0aac4099dc31c544235ae84a76b0268fa991"}}}}