title: JavaScript in Chrome Extension returns "cannot read property 'XXX' of undefined
body: <p>I've been working on a simple Chrome Extension and I have the context menu showing properly, but I can't get the popup to open. I'm trying to get it to differentiate actions based on the selection.</p>
  
  <p>UPDATE</p>
  
  <p>After messing for hours, I think I'm closer, but now I'm getting a "Cannot read property 'linkUrl' of undefined" and I can't figure out where it's coming from. </p>
  
  <pre><code>function getEmail(info,tab) {
      chrome.windows.create({
          url: "https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;shva=1&amp;to="+info.linkUrl.substr(7), 
          width:640,
          height:700,
          focused:true,
          type:"popup",
      })
  }
  
  function sendEmail(info,tab) {
      chrome.windows.create({
          url: "https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;shva=1&amp;to=" +info.selectionText,
          width:640,
          height:700,
          focused:true,
          type:"popup",
      })
  }
  
  chrome.contextMenus.create({
      title: "Send a New Email",
      contexts:["link", "selection"],
      onclick: checkType(),
  });
  
  function checkType(info,tab) {
      if (typeof info.linkUrl === $('a[href^="mailto:"]')) {
          console.log("This should print first");
          // getEmail();
      }
      else { 
          console.log("This should print");
          // sendEmail();
      }
  }
  </code></pre>
  
  <p>manifest.json</p>
  
  <pre><code>{
     "background": {
        "scripts": [ "background.js" ]
     },
  
     "description": "Creates a context menu option which copies the selected address into a new Gmail compose window.",
  
     "manifest_version": 2,
     "name": "New Gmail Window",
     "permissions": [ "tabs", "contextMenus" ],
     "version": "0.1"
  }
  </code></pre>