anthumchris / fetch-progress-indicators

Progress indicators/bars using Streams, Service Workers, and Fetch APIs
https://fetch-progress.anthum.com/
MIT License
360 stars 36 forks source link

sw-basic image doesn't display in Firefox 59.0+ #9

Closed anthumchris closed 6 years ago

anthumchris commented 6 years ago

As reported by @chrisdavidmills, image does not display in Firefox 59+, yet the image loads in the Service Worker as indicated in the progress bar.

firefox-59 0b14
anthumchris commented 6 years ago

Reproduced and isolated in FF 59. All tests below work with FF 58. Could be a browser bug resulting from returning a new Response constructed from a Service Worker. Will review Response() constructor and file a bug if needed.

Succeeds:

event.respondWith(
  return fetch(event.request)
}

Fails when new Response is introduced:

event.respondWith(
  return fetch(event.request)
  .then(response => response.blob())
  .then(body => new Response(body, {headers: {'content-type': 'image/jpeg'}}))
}

Still fails when specifying content-type:

event.respondWith(
  return fetch(event.request)
  .then(response => response.blob())
  .then(body => new Response(body, {headers: {'content-type': 'image/jpeg'}}))
}
anthumchris commented 6 years ago

@chrisdavidmills This is fixed and is caused by a FF 59+ bug when URLs contain a fragment value (e.g. image.svg#value) and Service Workers respondWith() using a newly-constructed Response object.

Test page reproduces this bug: https://fetch-progress.anthum.com/test/sw-response-with-url-fragments/

Bug filed: https://bugzilla.mozilla.org/show_bug.cgi?id=1443850