title: Chrome executeScript function not working
body: <p>So I have an extension I'm writing and I'm trying to execute a script when the user clicks on the pageAction icon. When the icon is clicked, the method calls chrome.tabs.executeScript(...). The problem is that the chrome.tabs.executeScript function is not executing and I can't tell why. I know that I'm getting to the code where it calls executeScript because I have an alert there that appears. Here is some of my code:</p>
  
  <p><strong>manifest.json</strong></p>
  
  <pre><code>{
    "manifest_version": 2,
    "name": "name here",
    "description": "description here",
    "version": "0.1",
    "permissions": [
      "&lt;all_urls&gt;",
      "tabs"
    ],
    "icons": {
      "16" : "images/icon16.png",
      "48" : "images/icon48.png",
      "128": "images/icon128.png" 
    },
    "background": {
      "scripts": ["js/check.js"]
    },
    "page_action": {
      "default_icon": {
        "19": "images/icon19.png",
        "38": "images/icon38.png"
      },
      "default_title": "default title here"
    }
  }
  </code></pre>
  
  <p><strong>js/check.js</strong></p>
  
  <pre><code>chrome.tabs.onUpdated.addListener(checkForValidUrl);
  
  function checkForValidUrl(tabId, changeInfo, tab) {
    if (tab.url.indexOf('g') &gt; -1) {
      chrome.pageAction.show(tabId);
    }
  };
  
  chrome.pageAction.onClicked.addListener(function(tab) {
    alert("hello world"); //this code is executed...
  
    //...this code is not 
    chrome.tabs.executeScript(tab.id, {file: "save.js"}, function() {
      if(chrome.runtime.lastError) {
        console.error(chrome.runtime.lastError.message);
      }
    });
  });
  </code></pre>
  
  <p><strong>js/save.js</strong></p>
  
  <pre><code>alert("hello world");
  </code></pre>
  
  <p>Like I say in the code, the hello world in my pageAction onClick function works. The executeScript method does not. Any idea about what is going on would be helpful.</p>