title: Closing popup window created by Google Chrome extension
body: <p>I'm trying to create a Chrome extension that is a replacement for the Delicious bookmarklet. I know there's already an extension that does it, but the problem with that extension is that after you bookmark a site, the popup window stays open (as opposed to using the bookmarklet, where the popup closes itself after submitting the form. I recreated the extension and ran into the same problem. </p>
  
  <p>Here's my code:</p>
  
  <p><strong>manifest.json:</strong></p>
  
  <pre><code>{
    "name": "Delicious",
    "version": "1.0",
    "description": "Bookmark a site on Delicious",
    "background_page": "background.html",
    "permissions": [ 
      "tabs" 
    ],
    "browser_action": {
      "default_icon": "delicious.png"
    },
    "content_scripts": [
      {
        "matches": ["http://www.delicious.com/save*"],
        "js": ["contentscript.js"]
      }
    ]
  }
  </code></pre>
  
  <p><strong>background.html:</strong></p>
  
  <pre><code>&lt;html&gt;&lt;script&gt;
  chrome.browserAction.onClicked.addListener(function(tab) {
    chrome.tabs.getSelected(null, function(tab) {
      w = window.open('http://delicious.com/save?url='+
            encodeURIComponent(tab.url)+
            '&amp;title='+encodeURIComponent(tab.title)+
            '&amp;v=5&amp;noui=1&amp;jump=close',
          'deliciousuiv5',
          'location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550');
    });
  });
  &lt;/script&gt;&lt;/html&gt;
  </code></pre>
  
  <p><strong>contentscript.js:</strong></p>
  
  <pre><code>if (document.URL == 'http://www.delicious.com/save')
  {
    alert('closing...');
    self.close();
    alert('should have closed by now');
  }
  </code></pre>
  
  <p>When I click the Delicious button, the popup comes up fine and I can save the bookmark but after I click "Save", the popup does not close. Both alerts show up, but <code>self.close()</code> doesn't seem to do anything. When I remove the URL check in contentscript.js, the popup comes up as normal, the first alert fires right away, and then the popup closes itself (as it should).</p>
  
  <p>Why doesn't this work? It doesn't seem like Chrome is preventing me from doing self.close(). Is Delicious doing something? Is it something else?</p>
  
  <p>The files are here if you want them: [link removed because drop.io went out of business]</p>