If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Cross-Origin XHR fails with HTTPs

RESOLVED INVALID

Status

Firefox OS
General
RESOLVED INVALID
5 years ago
3 years ago

People

(Reporter: Jose Manuel Cantera, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
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
(Reporter)

Updated

5 years ago
Blocks: 692677
(Reporter)

Comment 1

5 years ago
(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

Updated

5 years ago
Duplicate of this bug: 768803
(Reporter)

Comment 3

5 years ago
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)
(Reporter)

Comment 6

4 years ago
Yes, it was but this bug was open neary two years ago, I believe we can close it
Flags: needinfo?(jmcf)
(Reporter)

Updated

3 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.