Bug 1155898 - Use fetch instead of XHR for IdP. r=jib

This commit is contained in:
Martin Thomson 2015-05-20 14:26:32 -07:00
parent 23c9fa9162
commit f0aa6a94a7
2 changed files with 3 additions and 7 deletions

View File

@ -207,7 +207,7 @@ IdpSandbox.prototype = {
wantGlobalProperties: [
'indexedDB', 'XMLHttpRequest', 'TextEncoder', 'TextDecoder',
'URL', 'URLSearchParams', 'atob', 'btoa', 'Blob', 'crypto',
'rtcIdentityProvider'
'rtcIdentityProvider', 'fetch'
]
});
let registrar = this.sandbox.rtcIdentityProvider;

View File

@ -21,12 +21,8 @@
IDPJS.prototype = {
getLogin: function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://example.com/.well-known/idp-proxy/idp.sjs?' + this.id);
return new Promise(resolve => {
xhr.onload = e => resolve(xhr.status === 200);
xhr.send();
});
return fetch('https://example.com/.well-known/idp-proxy/idp.sjs?' + this.id)
.then(response => response.status === 200);
},
checkLogin: function(result) {
return this.getLogin()