Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/110652

Change subject: Don't throw JS errors when opening MWExtensionInspector on the 
wrong node type
......................................................................

Don't throw JS errors when opening MWExtensionInspector on the wrong node type

The setup method just assumed this.node was of the right type, and
would just crash if it wasn't. You could select an image, open the
gallery inspector, and it would happily try to inspect it until
crashing because there was no .mw.extsrc attribute.

Bug: 60502
Change-Id: Idf0e9cf7ccaa37e607374ced150db732926a19f8
(cherry picked from commit 12e4b416606210512f36dfda5671cc5d00c932fc)
---
M modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/52/110652/1

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
index 5d4bbeb..c426150 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
@@ -67,6 +67,10 @@
 
        // Initialization
        this.node = this.surface.getView().getFocusedNode();
+       // Make sure we're inspecting the right type of node
+       if ( !( this.node instanceof this.constructor.static.nodeView ) ) {
+               this.node = null;
+       }
        this.input.setValue( this.node ? this.node.getModel().getAttribute( 
'mw' ).body.extsrc : '' );
 
        // By default, the direction of the input element should be the same

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf0e9cf7ccaa37e607374ced150db732926a19f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.23wmf11
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to