hartleybrody/buzzkill — pull request #1 by nalexiou (2014-12-13 16:26:40+00:00)
Title: Page action fix

Hi Hartley,

Thanks for the awesome blog post. It really clarified many unknowns that I had with Chrome extensions. While I was playing around with the code, I realized that it was not behaving as I was expecting.

So, I removed the following code:

// show the popup when the user clicks on the page action.
chrome.pageAction.onClicked.addListener(function(tab) {
chrome.pageAction.show(tab.id);
});

and also modified the onUpdate code block.

Here is my reasoning:

Since pageAction includes a popup html, this will not trigger based on Chrome documentation.
https://developer.chrome.com/extensions/pageAction#event-onClicked
Also, this code essential says this: when the page action (icon) is clicked, display the page action (icon).
So, if the page action is not displayed, you can't click on it to display it. When Buzzfeed was set to false (checkbox in popup unchecked) and page was refreshed, the page action would disappear and it would not show up until the extension was reloaded. The code to display page action was added/modified in the onUpdate code block.

If you merge these changes to your branch, I would also change the blog post to reflect this since I was confused with this part when I was reading it.