diff --git a/core/misc/ajax.js b/core/misc/ajax.js index b56392e..e65b2d8 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -110,22 +110,22 @@ * * @augments Error * - * @param {jqXHR} xmlhttp + * @param {jqXHR} jqXHR * jqXHR object used for the failed request. * @param {string} uri * The URI where the error occurred. * @param {string} customMessage * The custom message. */ - Drupal.AjaxError = function (xmlhttp, uri, customMessage) { + Drupal.AjaxError = function (jqXHR, uri, customMessage) { var statusCode; var statusText; var pathText; var responseText; var readyStateText; - if (xmlhttp.status) { - statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', {'!status': xmlhttp.status}); + if (jqXHR.status) { + statusCode = '\n' + Drupal.t('An AJAX HTTP error occurred.') + '\n' + Drupal.t('HTTP Result Code: !status', {'!status': jqXHR.status}); } else { statusCode = '\n' + Drupal.t('An AJAX HTTP request terminated abnormally.'); @@ -133,12 +133,12 @@ statusCode += '\n' + Drupal.t('Debugging information follows.'); pathText = '\n' + Drupal.t('Path: !uri', {'!uri': uri}); statusText = ''; - // In some cases, when statusCode === 0, xmlhttp.statusText may not be + // In some cases, when statusCode === 0, jqXHR.statusText may not be // defined. Unfortunately, testing for it with typeof, etc, doesn't seem to // catch that and the test causes an exception. So we need to catch the // exception here. try { - statusText = '\n' + Drupal.t('StatusText: !statusText', {'!statusText': $.trim(xmlhttp.statusText)}); + statusText = '\n' + Drupal.t('StatusText: !statusText', {'!statusText': $.trim(jqXHR.statusText)}); } catch (e) { // Empty. @@ -146,9 +146,9 @@ responseText = ''; // Again, we don't have a way to know for sure whether accessing - // xmlhttp.responseText is going to throw an exception. So we'll catch it. + // jqXHR.responseText is going to throw an exception. So we'll catch it. try { - responseText = '\n' + Drupal.t('ResponseText: !responseText', {'!responseText': $.trim(xmlhttp.responseText)}); + responseText = '\n' + Drupal.t('ResponseText: !responseText', {'!responseText': $.trim(jqXHR.responseText)}); } catch (e) { // Empty. @@ -159,7 +159,7 @@ responseText = responseText.replace(/[\n]+\s+/g, '\n'); // We don't need readyState except for status == 0. - readyStateText = xmlhttp.status === 0 ? ('\n' + Drupal.t('ReadyState: !readyState', {'!readyState': xmlhttp.readyState})) : ''; + readyStateText = jqXHR.status === 0 ? ('\n' + Drupal.t('ReadyState: !readyState', {'!readyState': jqXHR.readyState})) : ''; customMessage = customMessage ? ('\n' + Drupal.t('CustomMessage: !customMessage', {'!customMessage': customMessage})) : ''; @@ -296,7 +296,7 @@ * Speed with which to apply the effect. * @prop {string} [method] * Name of the jQuery method used to insert new content in the targeted - * element. + * element.jqXHR, options * @prop {object} [progress] * Settings for the display of a user-friendly loader. * @prop {string} [progress.type='throbber'] @@ -421,7 +421,7 @@ * Processed Ajax URL. * * @type {string} - */ + */jqXHR, options this.url = this.url.replace(/\/nojs(\/|$|\?|#)/g, '/ajax$1'); // If the 'nojs' version of the URL is trusted, also trust the 'ajax' // version. @@ -746,7 +746,7 @@ * Prepare the Ajax request before it is sent. * * @param {jqXHR} jqXHR - * Native Ajax object. + * Javascript XHR object. * @param {object} options * jQuery.ajax options. */ @@ -939,7 +939,7 @@ * Handler for the form redirection error. * * @param {object} jqXHR - * Native jqXHR object. + * Javascript XHR object. * @param {string} uri * Ajax Request URI. * @param {string} [customMessage]