Clear cache key when deactivating target

And other state too, while we're at it.

Bug: 57905
Change-Id: Ifd2744c841f302764cf57c13f4a760cbe80fa2e0
This commit is contained in:
Roan Kattouw 2013-12-02 18:29:11 -08:00
parent 9dc891f4cb
commit 75449ea597
2 changed files with 26 additions and 14 deletions

View file

@ -215,6 +215,9 @@ ve.init.mw.ViewPageTarget.prototype.deactivate = function ( override ) {
this.loading.abort(); this.loading.abort();
} }
this.clearState();
this.docToSave = null;
this.deactivating = false; this.deactivating = false;
mw.hook( 've.deactivationComplete' ).fire(); mw.hook( 've.deactivationComplete' ).fire();
} }

View file

@ -60,20 +60,7 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
this.pluginCallbacks = []; this.pluginCallbacks = [];
this.modulesReady = $.Deferred(); this.modulesReady = $.Deferred();
this.preparedCacheKeyPromise = null; this.preparedCacheKeyPromise = null;
this.loading = false; this.clearState();
this.saving = false;
this.diffing = false;
this.serializing = false;
this.submitting = false;
this.baseTimeStamp = null;
this.startTimeStamp = null;
this.doc = null;
this.editNotices = null;
this.$checkboxes = null;
this.remoteNotices = [];
this.localNoticeMessages = [];
this.sanityCheckFinished = false;
this.sanityCheckVerified = false;
this.isMobileDevice = ( this.isMobileDevice = (
'ontouchstart' in window || 'ontouchstart' in window ||
( window.DocumentTouch && document instanceof window.DocumentTouch ) ( window.DocumentTouch && document instanceof window.DocumentTouch )
@ -744,6 +731,28 @@ ve.init.mw.Target.prototype.load = function ( additionalModules ) {
return true; return true;
}; };
/**
* Clear the state of this target, preparing it to be reactivated later.
*/
ve.init.mw.Target.prototype.clearState = function () {
this.clearPreparedCacheKey();
this.loading = false;
this.saving = false;
this.diffing = false;
this.serializing = false;
this.submitting = false;
this.baseTimeStamp = null;
this.startTimeStamp = null;
this.doc = null;
this.originalHtml = null;
this.editNotices = null;
this.$checkboxes = null;
this.remoteNotices = [];
this.localNoticeMessages = [];
this.sanityCheckFinished = false;
this.sanityCheckVerified = false;
};
/** /**
* Serialize the current document and store the result in the serialization cache on the server. * Serialize the current document and store the result in the serialization cache on the server.
* *