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)
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
Reporter | ||
Comment 1•10 years ago
|
||
ni ferjm since he wanted to take a look.
Flags: needinfo?(ferjmoreno)
Updated•10 years ago
|
Blocks: ServiceWorkers-v1
Reporter | ||
Updated•10 years ago
|
Blocks: nga-toolkit-service-workers
Comment 2•10 years ago
|
||
Could you be more specific about the requests that are failing?
Reporter | ||
Comment 4•10 years ago
|
||
(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)
Comment 6•10 years ago
|
||
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)
Updated•10 years ago
|
Flags: needinfo?(ferjmoreno)
Reporter | ||
Comment 7•10 years ago
|
||
Retested following comments :jaoo provided and closing as worksforme.
Thanks folks.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(francisco)
Resolution: --- → WORKSFORME
Updated•10 years ago
|
Flags: needinfo?(josh)
You need to log in
before you can comment on or make changes to this bug.
Description
•