Closed
      
        Bug 1220417
      
      
        Opened 10 years ago
          Closed 9 years ago
      
        
    
  
Crash when using clients.openWindow  
    Categories
(Core :: DOM: Service Workers, defect)
        Core
          
        
        
      
        
    
        DOM: Service Workers
          
        
        
      
        
    Tracking
()
        RESOLVED
        FIXED
        
    
  
| Tracking | Status | |
|---|---|---|
| firefox45 | --- | affected | 
People
(Reporter: marco, Unassigned)
References
Details
(Keywords: crash)
I have the following code in my service worker:
self.addEventListener('notificationclick', function(event) {
  event.waitUntil(clients.matchAll().then(function(clientList) {
    if (clientList.length > 0) {
      return clientList[0].focus();
    } else {
      return clients.openWindow('index.html');
    }
  }));
});
If a client tab is opened and I click on the notification, the client tab is successfully focused.
If there's no client tab open and I click on the notification, the content process crashes.
| Reporter | ||
| Comment 1•10 years ago
           | ||
| Comment 3•9 years ago
           | ||
Yes, this was introduced in bug 1191724. I fixed the crash when I relanded patch 3 from 1172870, but it wasn't merged to m-c yet.
https://hg.mozilla.org/integration/mozilla-inbound/rev/89c9c63c7654
Flags: needinfo?(catalin.badea392)
| Reporter | ||
| Comment 4•9 years ago
           | ||
Thanks, it's working now.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•