Closed Bug 1159274 Opened 10 years ago Closed 10 years ago

[ServiceWorkers] Cannot perform cors request from a SW in B2G

Categories

(Core :: DOM: Workers, defect)

40 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox40 --- affected

People

(Reporter: arcturus, Unassigned)

References

Details

In a serviceworker when doing fetch to a domain that has CORS enabled, we are not able to get the response in B2G. We do get the response in FF Nightly. An example to illustrate this: https://github.com/lodr/v3-app/tree/nightly
ni ferjm since he wanted to take a look.
Flags: needinfo?(ferjmoreno)
Could you be more specific about the requests that are failing?
Per comment2 setting ni to Francisco. Thanks!
Flags: needinfo?(francisco)
(In reply to Josh Matthews [:jdm] from comment #2) > Could you be more specific about the requests that are failing? Hi Josh, Here is an example that runs in a SW when attending a fetch event: var cors = 'http://crossorigin.me/'; return fetch(cors + 'http://example.com'); In this case 'crossorigin.me' is a service that proxy an url allowing cors for any request. When doing that operation on the sw we can see in the console: [JavaScript Warning: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://crossorigin.me/http://example.com (Reason: CORS request failed)."]
Flags: needinfo?(francisco)
Josh, see comment 4.
Flags: needinfo?(josh)
I gave this a try and fetch calls are working fine on the service worker execution context (fetch event handler) even when using the CORS proxy. On the other hand XHR requests on the client context get the warning at comment 4. To see this working on b2g use the secure CORS proxy at 'https://crossorigin.me/'.
Flags: needinfo?(francisco)
Flags: needinfo?(ferjmoreno)
Retested following comments :jaoo provided and closing as worksforme. Thanks folks.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(francisco)
Resolution: --- → WORKSFORME
Flags: needinfo?(josh)
You need to log in before you can comment on or make changes to this bug.