fix(popup): get current tab correctly
The popup would sometimes appear blank. This CL fixes this by specifying
that we only want tabs in the last focused window (which will be the
current window in fact) as mentioned in the chrome.tabs docs.\[1]
\[1]: https://developer.chrome.com/docs/extensions/reference/api/tabs#get_the_current_tab
Change-Id: I99964409a9ff9bfb4cc61585f50d992005a2f77d
diff --git a/src/js/popup.js b/src/js/popup.js
index 5eeb471..5fa4f97 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -74,6 +74,7 @@
var isScriptLoad = false;
chrome.tabs.query({
active: true,
+ lastFocusedWindow: true,
}, function(tabs) {
if (tabs.length < 1) {
console.error('Expected 1 tab');
@@ -121,6 +122,7 @@
if (isScriptLoad == false) {
chrome.tabs.query({
active: true,
+ lastFocusedWindow: true,
}, function(tabs) {
if (tabs.length < 1) {
console.error('Expected 1 tab.');