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

Side by Side Diff: content/test/data/background_sync/service_worker.js

Issue 1471763003: [BackgroundSync] Only allow SyncManager.register to occur from main frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split
Patch Set: Address comments from PS6 Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "onsync" event currently understands commands (passed as 5 // The "onsync" event currently understands commands (passed as
6 // registration tags) coming from the test. Any other tag is 6 // registration tags) coming from the test. Any other tag is
7 // passed through to the document unchanged. 7 // passed through to the document unchanged.
8 // 8 //
9 // "delay" - Delays finishing the sync event with event.waitUntil. 9 // "delay" - Delays finishing the sync event with event.waitUntil.
10 // Send a postMessage of "completeDelayedOneShot" to finish the 10 // Send a postMessage of "completeDelayedOneShot" to finish the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 rejectCallback = reject; 98 rejectCallback = reject;
99 }); 99 });
100 event.waitUntil(syncPromise); 100 event.waitUntil(syncPromise);
101 return; 101 return;
102 } 102 }
103 103
104 sendMessageToClients('sync', tag + ' fired'); 104 sendMessageToClients('sync', tag + ' fired');
105 }; 105 };
106 106
107 function sendMessageToClients(type, data) { 107 function sendMessageToClients(type, data) {
108 clients.matchAll().then(function(clients) { 108 clients.matchAll({ includeUncontrolled: true }).then(function(clients) {
109 clients.forEach(function(client) { 109 clients.forEach(function(client) {
110 client.postMessage({type, data}); 110 client.postMessage({type, data});
111 }); 111 });
112 }, function(error) { 112 }, function(error) {
113 console.log(error); 113 console.log(error);
114 }); 114 });
115 } 115 }
116 116
117 function sendSyncErrorToClients(error) { 117 function sendSyncErrorToClients(error) {
118 sendMessageToClients('sync', error.name + ' - ' + error.message); 118 sendMessageToClients('sync', error.name + ' - ' + error.message);
119 } 119 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698