title: Promise not resolving and not returning expected value:
body: <p>I'm trying to adapt IndexedDB to a promise, but the function checkUrlLink doesn't return any value. How can I fix this promise?</p>
  
  <p>This is my code:</p>
  
  <pre><code>var promise = new Promise(function(resolve) {
          return checkUrlLink(send_to_url, event);
      }).then(function(url_link) {
          console.log('URL LINK in promisse' + url_link);
          return clients.openWindow(url_link);
      });
  
  
  function checkUrlLink(send_to_url, event) {
  
    return new Promise((resolve,reject) =&gt;  {
  
      var request = indexedDB.open('db', 1);
      var original_event = event;
  
      request.onsuccess = function (event) {
        //db = event.target.result;
        var url_link = "url_link";
        var store = request.result.transaction("uid", "readwrite").objectStore("uid");
        var getRequest = store.get(url_link);
  
        getRequest.onsuccess = function () {
          var result = getRequest.result;
          if (result) {
            url_link = result;
            //send_to_url(original_event,url_link);
            resolve(url_link);
          } else {
            url_link_value = self.registration.scope;
            store.add(url_link_value, url_link);
            //send_to_url(original_event, url_link_value);
            resolve(url_link_value);
          }
        };
      };
  
      request.onupgradeneeded = function (event) {
        var db = event.target.result;
        var store = db.createObjectStore('url_link');
      };
  
  
  
    });
  
  
  
  }
  </code></pre>
  
  <p>I'm executing this inside a service worker.</p>