Mooeypoo has uploaded a new change for review.

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

Change subject: Restore the abortability of the inspector promise
......................................................................

Restore the abortability of the inspector promise

Make sure that the stored promise has xhr.abort from the get
request.

Change-Id: I005411dfb8acfa607e7002305e2a8f931a6abf08
---
M modules/ve.ui.CiteFromIdInspector.js
1 file changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Citoid 
refs/changes/60/197260/1

diff --git a/modules/ve.ui.CiteFromIdInspector.js 
b/modules/ve.ui.CiteFromIdInspector.js
index 84529a9..0c80e26 100644
--- a/modules/ve.ui.CiteFromIdInspector.js
+++ b/modules/ve.ui.CiteFromIdInspector.js
@@ -273,8 +273,8 @@
  * Send a request to the citoid service
  */
 ve.ui.CiteFromIdInspector.prototype.performLookup = function () {
-       var inspector = this,
-               xhr = inspector.service;
+       var xhr,
+               inspector = this;
 
        // TODO: Add caching for requested urls
        if ( this.lookupPromise ) {
@@ -286,11 +286,16 @@
        this.lookupButton.setDisabled( true );
        this.lookupInput.pushPending();
 
-       this.lookupPromise = xhr
+       // We have to first set up a get response so we can have
+       // a proper xhr object with "abort" method, so we can
+       // hand off this abort method to the jquery promise
+       xhr = this.service
                .get( {
-                       search: encodeURI( inspector.lookupInput.getValue() ),
+                       search: encodeURI( this.lookupInput.getValue() ),
                        format: ve.ui.CiteFromIdInspector.static.citoidFormat
-               } )
+               } );
+
+       this.lookupPromise = xhr
                .then(
                        // Success
                        function ( searchResults ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I005411dfb8acfa607e7002305e2a8f931a6abf08
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Citoid
Gerrit-Branch: wmf/1.25wmf21
Gerrit-Owner: Mooeypoo <mor...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to