jenkins-bot has submitted this change and it was merged.
Change subject: Fix issues with iframe transport
......................................................................
Fix issues with iframe transport
Bug: T93206
Change-Id: I6f2b31655028c5d4d1c14a9cef302b2d2f9895c5
---
M resources/handlers/mw.ApiUploadHandler.js
M resources/transports/mw.IframeTransport.js
2 files changed, 10 insertions(+), 12 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/handlers/mw.ApiUploadHandler.js
b/resources/handlers/mw.ApiUploadHandler.js
index d53cd87..6244d5a 100644
--- a/resources/handlers/mw.ApiUploadHandler.js
+++ b/resources/handlers/mw.ApiUploadHandler.js
@@ -16,20 +16,12 @@
mw.ApiUploadHandler = function ( upload, api ) {
// the Iframe transport is hardcoded for now because it works
everywhere
// can also use Xhr Binary depending on browser
- var handler = this;
-
this.upload = upload;
this.api = api;
this.$form = $( this.upload.ui.form );
this.configureForm();
- this.transport = new mw.IframeTransport(
- this.$form
- ).on( 'progress', function ( fraction ) {
- handler.upload.setTransportProgress( fraction );
- } ).on( 'transported', function ( result ) {
- handler.upload.setTransported( result );
- } );
+ this.transport = new mw.IframeTransport( this.$form );
};
mw.ApiUploadHandler.prototype = {
@@ -108,7 +100,13 @@
handler.upload.ui.setStatus(
'mwe-upwiz-transport-started' );
handler.upload.ui.showTransportProgress();
- return handler.transport.upload();
+ return handler.transport.upload()
+ .progress( function ( fraction
) {
+
handler.upload.setTransportProgress( fraction );
+ } )
+ .then( function ( result ) {
+
handler.upload.setTransported( result );
+ } );
}, function ( code, info ) {
handler.upload.setError( code, info );
} );
diff --git a/resources/transports/mw.IframeTransport.js
b/resources/transports/mw.IframeTransport.js
index 66a11cf..7b570b6 100644
--- a/resources/transports/mw.IframeTransport.js
+++ b/resources/transports/mw.IframeTransport.js
@@ -121,7 +121,7 @@
var deferred = $.Deferred();
// Set the form target to the iframe
- transport.$form.prop( 'target', this.iframeId );
+ transport.$form.prop( 'target', transport.iframeId );
// attach an additional handler to the form, so, when
submitted, it starts showing the progress
// XXX this is lame .. there should be a generic way to
indicate busy status...
@@ -131,7 +131,7 @@
transport.$iframe.on( 'load', function () {
deferred.notify( 1.0 );
- deferred.resolve(
transport.processIframeResult() );
+ deferred.resolve(
transport.processIframeResult( this ) );
} );
transport.$form.submit();
--
To view, visit https://gerrit.wikimedia.org/r/197913
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6f2b31655028c5d4d1c14a9cef302b2d2f9895c5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits