Catrope has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/111667

Change subject: Fix crashes in onLoadError()
......................................................................

Fix crashes in onLoadError()

The jqXHR parameter is optional, so handle the case where it's null
gracefully.

Also fix the documentation for this method, it was full of lies.

Change-Id: I6ab799846a4d4b0d10cc5fd4d8c47264b1845bdf
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/67/111667/1

diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 5559a66..7ba03a3 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -245,14 +245,18 @@
  * Handle failed DOM load event.
  *
  * @method
- * @param {Object} response HTTP Response object
+ * @param {jqXHR|null} jqXHR jQuery XHR object
  * @param {string} status Text status message
- * @param {Mixed} error Thrown exception or HTTP error string
+ * @param {Mixed|null} error Thrown exception or HTTP error string
  */
-ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( response, status 
) {
+ve.init.mw.ViewPageTarget.prototype.onLoadError = function ( jqXHR, status ) {
        // Don't show an error if the load was manually aborted
        // The response.status check here is to catch aborts triggered by 
navigation away from the page
-       if ( status !== 'abort' && response.status !== 0 && confirm( ve.msg( 
'visualeditor-loadwarning', status ) ) ) {
+       if (
+               status !== 'abort' &&
+               ( !jqXHR || jqXHR.status !== 0 ) &&
+               confirm( ve.msg( 'visualeditor-loadwarning', status ) )
+       ) {
                this.load();
        } else {
                this.activating = false;

-- 
To view, visit https://gerrit.wikimedia.org/r/111667
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ab799846a4d4b0d10cc5fd4d8c47264b1845bdf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to