Closed Bug 1247550 Opened 9 years ago Closed 9 years ago

Service Worker Window Clients Issue - 'includeUncontrolled' showing 'NotSupportedError'

Categories

(Core :: DOM: Service Workers, defect)

44 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1130685

People

(Reporter: dinodsja, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36 Steps to reproduce: I'm trying implement push notification for web. When trying to check weather web app is open, firefox throwing a strange error on service worker. And it works fine on chrome. "Service worker event waitUntil() was passed a promise that rejected with 'NotSupportedError: Operation is not supported'." if i set 'includeUncontrolled' to false, both firefox and chrome returns 'windowClients' a blank array. Not detecting the page. Here is my push event handler, 'clients.matchAll' is line 50. // Push Notification Event Handler self.addEventListener('push', function(event) { // Push Received event.waitUntil( // Check app page open self.clients.matchAll({ // Line 50 includeUncontrolled: true, // Error occuring when enabling this type: 'window' }) .then(function(windowClients) { // If no page instances show notification if (!windowClients.length) { // Get subscription key to call api return self.registration .pushManager .getSubscription() .then(function(subscription) { if (subscription) { // Get push message data var token = encodeURIComponent(String(subscription.endpoint).split('/').pop()); var url = 'api/push/data?token=' + token + '&type=' + getPushDeviceType(); return self.fetch(url, {credentials: 'include'}) .then(function(response) { if (response.status === 200) { return response.json() .then(function(data) { if (data) { // Display notification return self.registration .showNotification('App Notifications', { 'body': data.msg, 'icon': data.img, 'tag': 'app' }); } else { return; } }); } else { return; } }); } else { return; } }); } else { return; } }) ); });
Product: Firefox → Core
Component: Untriaged → DOM: Service Workers
Coud you attach a testcase showing the issue, please.
Flags: needinfo?(dinodsja)
When i'm sending the put request to the endpoint url, I got push receive event in the handler. I want to show the notification only, when my webapp is not open, so i added a checking in the push handler event.waitUntil( self.clients.matchAll({ // Error occuring in this line (See attachment) includeUncontrolled: true, // Error occuring when enabling this type: 'window' }).then(function(windowClients) { // When 'includeUncontrolled' is false, windowClients.length is 0; // When 'includeUncontrolled' is true, Getting the above mentioed error if(!windowClients.length) { // Do my further things... } }) );
Flags: needinfo?(dinodsja)
i am using 44.0.1
Unfortunately we don't implement includeUncontrolled yet.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: