Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chrome/test/data/push_messaging/service_worker.js

Issue 1622553004: PartitionAlloc: Increase the number of pages per bucket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The "onpush" event currently understands two values as message payload 5 // The "onpush" event currently understands two values as message payload
6 // data coming from the test. Any other input is passed through to the 6 // data coming from the test. Any other input is passed through to the
7 // document unchanged. 7 // document unchanged.
8 // 8 //
9 // "shownotification" - Display a Web Notification with event.waitUntil(). 9 // "shownotification" - Display a Web Notification with event.waitUntil().
10 // "shownotification-without-waituntil" 10 // "shownotification-without-waituntil"
11 // - Display a Web Notification without using event.waitUntil(). 11 // - Display a Web Notification without using event.waitUntil().
12 this.onpush = function(event) { 12 this.onpush = function(event) {
13 if (event.data === null) {
14 sendMessageToClients('push', '[NULL]');
15 return;
16 }
17
13 var data = event.data.text(); 18 var data = event.data.text();
14 if (!data.startsWith('shownotification')) { 19 if (!data.startsWith('shownotification')) {
15 sendMessageToClients('push', data); 20 sendMessageToClients('push', data);
16 return; 21 return;
17 } 22 }
18 23
19 var result = registration.showNotification('Push test title', { 24 var result = registration.showNotification('Push test title', {
20 body: 'Push test body', 25 body: 'Push test body',
21 tag: 'push_test_tag' 26 tag: 'push_test_tag'
22 }); 27 });
(...skipping 16 matching lines...) Expand all
39 'data': data 44 'data': data
40 }); 45 });
41 clients.matchAll().then(function(clients) { 46 clients.matchAll().then(function(clients) {
42 clients.forEach(function(client) { 47 clients.forEach(function(client) {
43 client.postMessage(message); 48 client.postMessage(message);
44 }); 49 });
45 }, function(error) { 50 }, function(error) {
46 console.log(error); 51 console.log(error);
47 }); 52 });
48 } 53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698