title: Chrome extension setTimeout not working properly
body: <p>My first post here =].</p>
  
  <p>I'm building a chrome extension and I'm using a setTimeout recursively. I noticed that if I set it to up to 13secs, it works, but if I set it to 14secs+ it won't work.</p>
  
  <p>This is an example which is on my background.js</p>
  
  <pre><code>function start() {
  
      var timeout = setTimeout( function() { start(); }, 1000*15);
      alert('test');
  }
  
  chrome.webNavigation.onCompleted.addListener(function(o) {
  
      start();
  
      }, {
        url: [
          {urlContains: 'http://www.example.com/in.php'},
          {urlContains: 'http://www.example.com/out.php'}
        ]
      }
  );
  </code></pre>
  
  <p>If you reduce that timeout to 1000*13, it works.</p>
  
  <p>This is my manifest.json</p>
  
  <pre><code>{
    "name": "Extension",
    "version": "0.0.7",
    "manifest_version": 2,
    "description": "Keeps proxy session alive",
    "homepage_url": "http://www.example.com",
    "icons": {
      "16": "icons/icon16-on.png",
      "48": "icons/icon48-on.png",
      "128": "icons/icon128-on.png"
    },
    "default_locale": "en",
    "background": {
      "scripts": [
        "src/bg/background.js"
      ],
      "persistent": false
    },
    "browser_action": {
      "default_icon": "icons/icon19.png",
      "default_title": "Example - Off",
      "default_popup": ""
    },
   "permissions": [
      "webNavigation", 
      "*://*/*",
      "https://*/*"
    ]
  }
  </code></pre>
  
  <p>Any idea on what could be causing this oddness? I'm testing this on developer mode, BTW.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Code fixed:</p>
  
  <p><em>manifest.json</em></p>
  
  <p>I added "alarms" to the permissions</p>
  
  <p><em>background.js</em></p>
  
  <p>Added this event to listen to the alarms.create:</p>
  
  <pre><code>chrome.alarms.onAlarm.addListener(function(alarm){
      start();
  });
  </code></pre>
  
  <p>Replaced the setTimeout function with the below line</p>
  
  <pre><code>chrome.alarms.create("Start", {periodInMinutes:1});
  </code></pre>
  
  <p>Hope this helps!</p>