Skip to content

Commit 0594f4e

Browse files
Mugdha Lakhanichromium-wpt-export-bot
authored andcommitted
[BackgroundFetch] Part 1: Remove BackgroundFetchSettledFetches.
This removes BackgroundFetchSettledFetches from blink, idl files, and the WPT tests. In a follow up CL I'll remove it from all the event dispatcher code on the browser side. This fix also makes cache_query_params optional in MatchRequests() in mojo. This is required because otherwise the mojo bindings logic crashes the renderer when we try to pass in a nullptr for cache_query_params from blink. Bug: 869918, 863016 Change-Id: Ifa933451f98f82902d8455ba5401c629c8c24811 Reviewed-on: https://chromium-review.googlesource.com/1186735 Commit-Queue: Mugdha Lakhani <[email protected]> Reviewed-by: Peter Beverloo <[email protected]> Reviewed-by: Rayan Kanso <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Reviewed-by: Tom Sepez <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Cr-Commit-Position: refs/heads/master@{#585847}
1 parent 37a3218 commit 0594f4e

File tree

1 file changed

+8
-7
lines changed
  • background-fetch/service_workers

1 file changed

+8
-7
lines changed
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11

22
importScripts('sw-helpers.js');
33

4-
async function getFetchResult(settledFetch) {
5-
if (!settledFetch.response)
4+
async function getFetchResult(record) {
5+
response = await record.responseReady;
6+
if (!response)
67
return Promise.resolve(null);
78

89
return {
9-
url: settledFetch.response.url,
10-
status: settledFetch.response.status,
11-
text: await settledFetch.response.text(),
10+
url: response.url,
11+
status: response.status,
12+
text: await response.text(),
1213
};
1314
}
1415

1516
self.addEventListener('backgroundfetchsuccess', event => {
1617
event.waitUntil(
17-
event.fetches.values()
18-
.then(fetches => Promise.all(fetches.map(fetch => getFetchResult(fetch))))
18+
event.registration.matchAll()
19+
.then(records => Promise.all(records.map(record => getFetchResult(record))))
1920
.then(results => sendMessageToDocument({ type: event.type, results })));
2021
});

0 commit comments

Comments
 (0)