Closed Bug 768804 Opened 13 years ago Closed 11 years ago

Cross-Origin XHR fails with HTTPs

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: jmcf, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.4 Safari/537.1 Steps to reproduce: var imgSrc = 'https://graph.facebook.com/picture/100001127136581?type=square'; var xhr = new XMLHttpRequest({mozSystem: true}); xhr.open('GET', imgSrc, true); xhr.responseType = 'blob'; xhr.timeout = 6000; xhr.onload = function(e) { window.console.log('Success CB invoked for img uid',uid); if (xhr.status === 200 || xhr.status === 0) { window.console.log('200 ok for uid',uid); var mblob = e.target.response; var reader = new FileReader(); reader.onload = function(e) { cb(e.target.result); } reader.readAsDataURL(mblob); } } xhr.ontimeout = function(e) { window.console.log('Timeout!!! while retrieving img for uid',uid); } xhr.onerror = function(e) { window.console.error(e); cb(''); } xhr.send(); } Actual results: Error callback is invoked Expected results: onload callback with success
Blocks: 692677
(In reply to Jose M. Cantera from comment #0) > User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.1 > (KHTML, like Gecko) Chrome/21.0.1180.4 Safari/537.1 > > Steps to reproduce: > > var imgSrc = > 'https://graph.facebook.com/picture/100001127136581?type=square'; var imgSrc = 'https://graph.facebook.com/100001127136581/picture?type=square'; > > var xhr = new XMLHttpRequest({mozSystem: true}); > xhr.open('GET', imgSrc, true); > xhr.responseType = 'blob'; > xhr.timeout = 6000; > xhr.onload = function(e) { > window.console.log('Success CB invoked for img uid',uid); > if (xhr.status === 200 || xhr.status === 0) { > window.console.log('200 ok for uid',uid); > var mblob = e.target.response; > var reader = new FileReader(); > reader.onload = function(e) { > cb(e.target.result); > } > > reader.readAsDataURL(mblob); > } > } > > xhr.ontimeout = function(e) { > window.console.log('Timeout!!! while retrieving img for uid',uid); > } > > xhr.onerror = function(e) { > window.console.error(e); > cb(''); > } > > xhr.send(); > } > > > Actual results: > > Error callback is invoked > > > Expected results: > > onload callback with success
The URL referenced is a HTTPS URL which actually performs a redirection ... just in case it helps to solve the bug
(In reply to Jose M. Cantera from comment #3) > The URL referenced is a HTTPS URL which actually performs a redirection ... > just in case it helps to solve the bug Are you sure HTTPS is the reason for the bug (as suggested in the bug summary) rather than the redirection?
> var xhr = new XMLHttpRequest({mozSystem: true}); Jose, is this running in an app with the "systemXHR" permission?
Flags: needinfo?(jmcf)
Yes, it was but this bug was open neary two years ago, I believe we can close it
Flags: needinfo?(jmcf)
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.