Merge "Clear cache key when deactivating target"

This commit is contained in:
jenkins-bot 2013-12-03 18:24:28 +00:00 committed by Gerrit Code Review
commit 9c3610afb3
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.clearState();
this.docToSave = null;
this.deactivating = false;
mw.hook( 've.deactivationComplete' ).fire();
}

View file

@ -60,20 +60,7 @@ ve.init.mw.Target = function VeInitMwTarget( $container, pageName, revisionId )
this.pluginCallbacks = [];
this.modulesReady = $.Deferred();
this.preparedCacheKeyPromise = null;
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.editNotices = null;
this.$checkboxes = null;
this.remoteNotices = [];
this.localNoticeMessages = [];
this.sanityCheckFinished = false;
this.sanityCheckVerified = false;
this.clearState();
this.isMobileDevice = (
'ontouchstart' in window ||
( window.DocumentTouch && document instanceof window.DocumentTouch )
@ -744,6 +731,28 @@ ve.init.mw.Target.prototype.load = function ( additionalModules ) {
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.
*