title: Notification.requestPermission is undefined from ServiceWorker execution file. Chrome
body: <p>I faced an issue where <code>Notification.requestPermission</code> doesn't fire from my <code>ServiceWorker</code> handler. </p>
  
  <p>Interesting thing, that if try to use <code>Notification.requestPermission</code> from browser console it works fine and I have see the notification request in top of the Chrome browser window.</p>
  
  <p>by: <code>Notification.requestPermission().then(res =&gt; console.log(res))</code> . But the same throw me an error during execution from <code>ServiceWorker</code> file, like:</p>
  
  <blockquote>
    <p>Uncaught TypeError: self.Notification.requestPermission is not a function</p>
  </blockquote>
  
  <p>So, anyone maybe know what is wrong? I have already seen these posts on SoW: </p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/questions/5040107/webkit-notifications-requestpermission-function-doesnt-work">Webkit notifications requestPermission function doesn&#39;t work</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/12421667/desktop-notifications-allowing-not-working-on-chrome">Desktop notifications allowing not working on chrome</a></p></li>
  </ol>
  
  <p>But they does not solve my problem...</p>
  
  <p>My SW <code>push</code> part of code where I use notifications:</p>
  
  <pre><code>  self.addEventListener('push', function(event) {
      console.log(self.Notification, Notification.requestPermission)
      self.Notification.requestPermission().then(res =&gt; console.log(res))
  
      if (Notification.permission === 'denied') {
        console.log('Permission wasn\'t granted. Allow a retry.');
       return;
      }
  
      if (Notification.permission === 'default') {
        console.log('The permission request was dismissed.');
        return;
      }
  
      console.log('The permission request is granted!');
  
      try {
        event.waitUntil(
          self.registration.showNotification(event &amp;&amp; event.data &amp;&amp; event.data.text() || 'Some Notification Here!')
        );
      } catch (e) {
        throw new Error(`Error in SW: ${e}`)
      }
    })
  </code></pre>