Don't log errors due to missing edit buttons

There's nothing we can do about missing edit buttons - they are likely
being scrubbed by some script or gadget, so let's not report the error.

Bug: T314952
Change-Id: Icf778074026a24561c228cbf11e583062571d0cb
This commit is contained in:
Jon Robson 2022-11-02 15:34:57 -07:00 committed by Jdlrobson
parent 2972e744cc
commit 282d075e0c

View file

@ -1535,22 +1535,14 @@
'Your skin is incompatible with VisualEditor. ' +
'See https://www.mediawiki.org/wiki/Extension:VisualEditor/Skin_requirements for the requirements.'
);
// aid debugging for additional context.
var errorCode = [
init.isVisualAvailable,
init.isWikitextAvailable,
pageCanLoadEditor,
pageIsProbablyEditable,
$targetContainer.length,
$( '#mw-content-text' ).length,
numEditButtons
].map( function ( bool ) {
return Number( bool );
} ).join( '-' );
var err = new Error( 'Incompatible with VisualEditor: ' + errorCode );
err.name = 'VeIncompatibleSkinWarning';
mw.errorLogger.logError( err, 'error.visualeditor' );
// If the edit buttons are not there it's likely a browser extension or gadget for anonymous user
// has removed them. We're not interested in errors from this scenario so don't log.
// If they exist log the error so we can address the problem.
if ( numEditButtons > 0 ) {
var err = new Error( 'Incompatible with VisualEditor' );
err.name = 'VeIncompatibleSkinWarning';
mw.errorLogger.logError( err, 'error.visualeditor' );
}
} else if ( init.isAvailable ) {
var mode = getEditModeFromUri( uri );
if ( mode ) {