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

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/clients-matchall-worker.js

Issue 1286123004: Ensure that Service Worker clients are always returned in MRU order (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 self.onmessage = function(e) { 1 self.onmessage = function(e) {
2 var port = e.data.port; 2 var port = e.data.port;
3 var options = e.data.options; 3 var options = e.data.options;
4 var retainOriginalOrder = e.data.retainOriginalOrder;
4 5
5 self.clients.matchAll(options).then(function(clients) { 6 self.clients.matchAll(options).then(function(clients) {
6 var message = []; 7 var message = [];
7 clients.forEach(function(client) { 8 clients.forEach(function(client) {
8 message.push([client.visibilityState, 9 message.push([client.visibilityState,
9 client.focused, 10 client.focused,
10 client.url, 11 client.url,
11 client.frameType]); 12 client.frameType]);
12 }); 13 });
13 // Sort by url 14 // Sort by url
14 message.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; }); 15 if (!retainOriginalOrder)
16 message.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
falken 2015/08/17 07:10:19 This extra flag is kind of tricky, I'd just remove
15 port.postMessage(message); 17 port.postMessage(message);
16 }); 18 });
17 }; 19 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698