Skip to content

Commit

Permalink
Set xhr.withCredentials after xhr.open called.
Browse files Browse the repository at this point in the history
Fixes "Error: INVALID_STATE_ERR: DOM Exception 11".
See: https://code.google.com/p/v8/issues/detail?id=789
  • Loading branch information
chromakode committed Apr 2, 2015
1 parent 654c94f commit a847967
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@

return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest()
if (self.credentials === 'cors') {
xhr.withCredentials = true;
}

function responseURL() {
if ('responseURL' in xhr) {
Expand Down Expand Up @@ -300,6 +297,10 @@

xhr.open(self.method, self.url, true)

if (self.credentials === 'cors') {
xhr.withCredentials = true;
}

if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
Expand Down

0 comments on commit a847967

Please sign in to comment.