You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/pythonmonkey/builtin_modules/XMLHttpRequest.js
+42-5Lines changed: 42 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -176,13 +176,27 @@ class XMLHttpRequest extends XMLHttpRequestEventTarget
176
176
*/
177
177
timeout=0;
178
178
179
+
/**
180
+
* A boolean value that indicates whether or not cross-site `Access-Control` requests should be made using credentials such as cookies, authorization headers or TLS client certificates.
181
+
* Setting withCredentials has no effect on same-origin requests.
if(this.#receivedLength ===0)// response’s body is null
558
+
returnnull;
559
+
// step 8.3
560
+
letjsonObject=null;
561
+
try
562
+
{
563
+
// TODO: use proper TextDecoder API
564
+
conststr=decodeStr(this.#mergeReceivedBytes(),'utf-8');// only supports utf-8, see https://infra.spec.whatwg.org/#parse-json-bytes-to-a-javascript-value
565
+
jsonObject=JSON.parse(str);
566
+
}
567
+
catch(exception)
568
+
{
569
+
returnnull;
570
+
}
571
+
// step 8.4
572
+
this.#responseObject =jsonObject;
573
+
}
539
574
575
+
// step 6 and step 7 ("blob" or "document") are not supported
0 commit comments