chromium/third_party/blink/web_tests/wpt_internal/service-worker/static-router/resources/static-router-sw.sub.js

let requests = [];
let errors = [];

const recordRequest = req => {
  requests.push({url: req.url, mode: req.mode, destination: req.destination});
};

const recordError = (error) => {
  errors.push(error);
};

const getRecords = () => {
  return {
    requests,
    errors
  };
}

const resetRecords = () => {
  requests = [];
  errors = [];
}

export {
  recordRequest,
  recordError,
  getRecords,
  resetRecords
};