Closed Bug 1201999 Opened 10 years ago Closed 10 years ago

Image from different origin isn't loaded when using the event.respondWith() method

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE
Tracking Status
firefox43 --- affected

People

(Reporter: marco, Unassigned)

Details

Attachments

(2 files)

The cache is empty, I'm not adding anything to the cache. If I fetch the image without checking the cache first, the image is loaded correctly. If I check the cache and then fetch the image, the image isn't loaded. In both cases the promise returned by fetch is resolved (the console.log in the testcase I'm about to attach is called).
Attached file index.html
Attached file service-worker.js
The attached page works correctly with the attached version of service-worker.js. If you uncomment the code I commented out, it doesn't work anymore.
Blocks: WADI
If you right-click on the image and select "View Image Info", the image has the correct size in both cases (~40 kB) but wrong dimensions in the not-working case (0 × 0px instead of 300px × 450px).
(N.B.: When you uncomment the code you also need to remove a semicolon, otherwise the service worker will fail to load)
Summary: Image from different origin isn't loaded in some conditions → Image from different origin isn't loaded if fetched after checking the cache
The status code of the response is 200 for correctly loaded images, 0 for the others.
Here's an even simpler testcase. This works: self.addEventListener("fetch", function(event) { return fetch(event.request); }); This doesn't: self.addEventListener("fetch", function(event) { event.respondWith(fetch(event.request)); });
Summary: Image from different origin isn't loaded if fetched after checking the cache → Image from different origin isn't loaded when using the event.respondWith() method
So, basically the issue is that the non-normative section http://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cross-origin-resources isn't being followed. I'll file a new, clearer, bug.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INCOMPLETE
No longer blocks: WADI
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: