jsf.js_next_gen 4.0.5-beta.5 → 4.0.5-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2836,7 +2836,7 @@ var Lang;
2836
2836
  * </code>
2837
2837
  *
2838
2838
  * @param resolverProducer a lambda which can produce the value
2839
- * @param defaultValue an optional default value if the producer failes to produce anything
2839
+ * @param defaultValue an optional default value if the producer fails to produce anything
2840
2840
  * @returns an Optional of the produced value
2841
2841
  */
2842
2842
  function saveResolve(resolverProducer, defaultValue = null) {
@@ -8362,30 +8362,35 @@ class XhrRequest extends AsyncRunnable_1.AsyncRunnable {
8362
8362
  }
8363
8363
  }
8364
8364
  processRequestErrors(resolve) {
8365
- var _a, _b, _c;
8365
+ var _a, _b, _c, _d, _e;
8366
8366
  const responseXML = new mona_dish_1.XMLQuery((_a = this.xhrObject) === null || _a === void 0 ? void 0 : _a.responseXML);
8367
- const responseCode = (_c = (_b = this.xhrObject) === null || _b === void 0 ? void 0 : _b.status) !== null && _c !== void 0 ? _c : -1;
8367
+ const responseText = (_c = (_b = this.xhrObject) === null || _b === void 0 ? void 0 : _b.responseText) !== null && _c !== void 0 ? _c : "";
8368
+ const responseCode = (_e = (_d = this.xhrObject) === null || _d === void 0 ? void 0 : _d.status) !== null && _e !== void 0 ? _e : -1;
8368
8369
  if (responseXML.isXMLParserError()) {
8369
- // invalid response
8370
+ // Firefox: malformed XML produces a Document with <parsererror>
8371
+ const errorName = "Invalid Response";
8372
+ const errorMessage = "The response xml is invalid";
8373
+ this.handleGenericResponseError(errorName, errorMessage, Const_1.MALFORMEDXML, resolve);
8374
+ return true;
8375
+ }
8376
+ else if (responseXML.isAbsent() && responseText.trim().length > 0) {
8377
+ // Chrome: responseXML is null for unparseable XML, but responseText has content
8370
8378
  const errorName = "Invalid Response";
8371
8379
  const errorMessage = "The response xml is invalid";
8372
8380
  this.handleGenericResponseError(errorName, errorMessage, Const_1.MALFORMEDXML, resolve);
8373
8381
  return true;
8374
8382
  }
8375
8383
  else if (responseXML.isAbsent()) {
8376
- // empty response
8384
+ // Truly empty response
8377
8385
  const errorName = "Empty Response";
8378
8386
  const errorMessage = "The response has provided no data";
8379
8387
  this.handleGenericResponseError(errorName, errorMessage, Const_1.EMPTY_RESPONSE, resolve);
8380
8388
  return true;
8381
8389
  }
8382
8390
  else if (responseCode >= 300 || responseCode < 200) {
8383
- // other server errors
8384
- // all errors from the server are resolved without interfering in the queue
8385
8391
  this.handleHttpError(resolve);
8386
8392
  return true;
8387
8393
  }
8388
- //additional errors are application errors and must be handled within the response
8389
8394
  return false;
8390
8395
  }
8391
8396
  handleGenericResponseError(errorName, errorMessage, responseStatus, resolve) {