jenkins-bot has submitted this change and it was merged.

Change subject: Remove the sanity check
......................................................................


Remove the sanity check

It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
---
M ApiVisualEditorEdit.php
M VisualEditor.hooks.php
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
6 files changed, 4 insertions(+), 114 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  Jforrester: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/ApiVisualEditorEdit.php b/ApiVisualEditorEdit.php
index c2595c6..b917ac8 100644
--- a/ApiVisualEditorEdit.php
+++ b/ApiVisualEditorEdit.php
@@ -113,12 +113,6 @@
                                        intval( $saveresult['edit']['newrevid'] 
),
                                        null
                                );
-                               if ( $params['needcheck'] ) {
-                                       ChangeTags::addTags( 
'visualeditor-needcheck', null,
-                                               intval( 
$saveresult['edit']['newrevid'] ),
-                                               null
-                                       );
-                               }
                        }
 
                        // Return result of parseWikitext instead of 
saveWikitext so that the
@@ -183,9 +177,6 @@
                        'wikitext' => null,
                        'basetimestamp' => null,
                        'starttimestamp' => null,
-                       'needcheck' => array(
-                               ApiBase::PARAM_TYPE => 'boolean'
-                       ),
                        'oldid' => null,
                        'minor' => null,
                        'watch' => null,
@@ -228,8 +219,6 @@
                        'starttimestamp' => 'When saving, set this to the 
timestamp of when the page was loaded.'
                                . ' Used to detect edit conflicts.',
                        'token' => 'Edit token',
-                       'needcheck' => 'When saving, set this parameter if the 
revision might have roundtrip'
-                               . ' problems. This will result in the edit 
being tagged.',
                        'captchaid' => 'Captcha ID (when saving with a captcha 
response).',
                        'captchaword' => 'Answer to the captcha (when saving 
with a captcha response).',
                        'cachekey' => 'Use the result of a previous 
serializeforcache request with this key.'
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index b1ceae8..60834e9 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -392,7 +392,7 @@
         */
        public static function onListDefinedTags( &$tags ) {
                $tags[] = 'visualeditor';
-               $tags[] = 'visualeditor-needcheck';
+               $tags[] = 'visualeditor-needcheck'; // No longer in active use
                $tags[] = 'visualeditor-switched';
                return true;
        }
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
index 7866f47..73d0f37 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css
@@ -62,8 +62,3 @@
        margin-right: 0.25em;
        margin-top: 0.2em;
 }
-
-/* Needs to override .oo-ui.widget.oo-ui-widget-disabled */
-.ve-init-mw-viewPageTarget-waiting.oo-ui-widget.oo-ui-widget-disabled {
-       cursor: progress;
-}
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 926ed57..f71fd4c 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -96,8 +96,7 @@
                showChanges: 'onShowChanges',
                showChangesError: 'onShowChangesError',
                noChanges: 'onNoChanges',
-               serializeError: 'onSerializeError',
-               sanityCheckComplete: 'updateToolbarSaveButtonState'
+               serializeError: 'onSerializeError'
        } );
 
        if ( history.replaceState ) {
@@ -873,10 +872,9 @@
        var isDisabled;
 
        this.edited = this.getSurface().getModel().hasBeenModified();
-       // Disable the save button if we have no history or if the sanity check 
is not finished
-       isDisabled = ( !this.edited && !this.restoring ) || 
!this.sanityCheckFinished;
+       // Disable the save button if we have no history
+       isDisabled = !this.edited && !this.restoring;
        this.toolbarSaveButton.setDisabled( isDisabled );
-       this.toolbarSaveButton.$element.toggleClass( 
've-init-mw-viewPageTarget-waiting', !this.sanityCheckFinished );
        mw.hook( 've.toolbarSaveButton.stateChanged' ).fire( isDisabled );
 };
 
@@ -887,9 +885,6 @@
  * @fires saveReview
  */
 ve.init.mw.ViewPageTarget.prototype.onSaveDialogReview = function () {
-       this.sanityCheckVerified = true;
-       this.saveDialog.setSanityCheck( this.sanityCheckVerified );
-
        if ( !this.saveDialog.$reviewViewer.find( 'table, pre' ).length ) {
                this.emit( 'saveReview' );
                this.saveDialog.getActions().setAbilities( { approve: false } );
@@ -1043,10 +1038,6 @@
                        options[fieldMap[key]] = options[key];
                        delete options[key];
                }
-       }
-
-       if ( this.sanityCheckPromise.state() === 'rejected' ) {
-               options.needcheck = 1;
        }
 
        return options;
@@ -1217,7 +1208,6 @@
                        target.saveDialog.setupCheckboxes( target.$checkboxes );
                }
 
-               target.saveDialog.setSanityCheck( target.sanityCheckVerified );
                target.getSurface().getDialogs().openWindow(
                        target.saveDialog,
                        { dir: 
target.getSurface().getModel().getDocument().getLang() }
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 715e477..df9f5fa 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -39,11 +39,6 @@
                .extend( { action: 'submit' } );
        this.events = new ve.init.mw.TargetEvents( this );
 
-       /**
-        * @property {jQuery.Promise|null}
-        */
-       this.sanityCheckPromise = null;
-
        this.modules = [
                'ext.visualEditor.mwcore',
                'ext.visualEditor.mwlink',
@@ -177,10 +172,6 @@
 /**
  * @event serializeComplete
  * Fired when serialization is complete
- */
-
-/**
- * @event sanityCheckComplete
  */
 
 /* Static Properties */
@@ -539,7 +530,6 @@
        this.setupSurface( this.doc, function () {
                // onLoad() may have called setAssumeExistence( true );
                ve.init.platform.linkCache.setAssumeExistence( false );
-               target.startSanityCheck();
                target.emit( 'surfaceReady' );
        } );
 };
@@ -1086,8 +1076,6 @@
        this.$checkboxes = null;
        this.remoteNotices = [];
        this.localNoticeMessages = [];
-       this.sanityCheckFinished = false;
-       this.sanityCheckVerified = false;
 };
 
 /**
@@ -1439,65 +1427,6 @@
                        } );
                } );
        } );
-};
-
-/**
- * Fire off the sanity check. Must be called before the surface is activated.
- *
- * To access the result, check whether #sanityCheckPromise has been resolved 
or rejected
- * (it's asynchronous, so it may still be pending when you check).
- *
- * @method
- * @fires sanityCheckComplete
- */
-ve.init.mw.Target.prototype.startSanityCheck = function () {
-       // We have to get a copy of the data now, before we unlock the surface 
and let the user edit,
-       // but we can defer the actual conversion and comparison
-       var target = this,
-               doc = this.getSurface().getModel().getDocument(),
-               data = new ve.dm.FlatLinearData( doc.getStore().clone(), 
ve.copy( doc.getFullData() ) ),
-               oldDom = this.doc,
-               d = $.Deferred();
-
-       // Reset
-       this.sanityCheckFinished = false;
-       this.sanityCheckVerified = false;
-
-       setTimeout( function () {
-               // We can't compare oldDom.body and newDom.body directly, 
because the attributes on the
-               // <body> were ignored in the conversion. So compare each child 
separately.
-               var i,
-                       len = oldDom.body.childNodes.length,
-                       newDoc = new ve.dm.Document( data, oldDom, undefined, 
doc.getInternalList(), doc.getInnerWhitespace(), doc.getLang(), doc.getDir() ),
-                       newDom = ve.dm.converter.getDomFromModel( newDoc );
-
-               // Explicitly unlink our full copy of the original version of 
the document data
-               data = undefined;
-
-               if ( len !== newDom.body.childNodes.length ) {
-                       // Different number of children, so they're definitely 
different
-                       d.reject();
-                       return;
-               }
-               for ( i = 0; i < len; i++ ) {
-                       if ( !oldDom.body.childNodes[i].isEqualNode( 
newDom.body.childNodes[i] ) ) {
-                               d.reject();
-                               return;
-                       }
-               }
-               d.resolve();
-       } );
-
-       this.sanityCheckPromise = d.promise()
-               .done( function () {
-                       // If we detect no roundtrip errors,
-                       // don't emphasize "review changes" to the user.
-                       target.sanityCheckVerified = true;
-               } )
-               .always( function () {
-                       target.sanityCheckFinished = true;
-                       target.emit( 'sanityCheckComplete' );
-               } );
 };
 
 /**
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 551813b..ec5f46c 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -22,7 +22,6 @@
        ve.ui.MWSaveDialog.super.call( this, config );
 
        // Properties
-       this.sanityCheckVerified = false;
        this.editSummaryByteLimit = 255;
        this.restoring = false;
        this.messages = {};
@@ -137,15 +136,6 @@
 };
 
 /**
- * Set sanity check flag
- *
- * @param {boolean} verified Status of sanity check
- */
-ve.ui.MWSaveDialog.prototype.setSanityCheck = function ( verified ) {
-       this.sanityCheckVerified = !!verified;
-};
-
-/**
  * Swap state in the save dialog.
  *
  * @param {string} panel One of 'save', 'review', 'conflict' or 'nochanges'
@@ -176,9 +166,6 @@
 
        switch ( panel ) {
                case 'save':
-                       if ( !this.sanityCheckVerified ) {
-                               this.showMessage( 'dirtywarning', mw.msg( 
'visualeditor-savedialog-warning-dirty' ) );
-                       }
                        this.actions.setMode( 'save' );
                        // HACK: FF needs *another* defer
                        setTimeout( function () {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to