OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |