https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 4f05c011be2ef38886088a09748b90dd2476d40f authored by Mugdha Lakhani on 18 October 2018, 15:50:21 UTC
[Background Fetch] Support access to active fetches.
Tip revision: 4f05c01
sw.js
importScripts('/resources/testharness.js')

promise_test((test) => {
  return fetch('./sw.js').then((response) => {
    return new Promise((resolve, reject) => {
      step_timeout(() => {
        const entry = performance.getEntriesByName(response.url)[0]
        if (!entry) {
          reject('no entry: ' + response.url)
        }

        assert_not_equals(typeof entry.serverTiming,
          'undefined',
          'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute in the Service Worker context.')
        resolve()
      }, 250)
    })
  })
})
back to top