From 17ced451f4179ba6b985cc10c7987e3e1bddb197 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 17 Dec 2016 01:58:37 +0000 Subject: [PATCH] MWSaveDialogAction: Don't break on strange accesskey messages Quietly return instead. Bug: T153472 Change-Id: I7c325624734f122c9fd939aee1192187c63d9247 --- modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js b/modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js index 5f0650fb05..a491d190a8 100644 --- a/modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js +++ b/modules/ve-mw/ui/actions/ve.ui.MWSaveDialogAction.js @@ -147,9 +147,14 @@ ve.ui.commandRegistry.register( shortcuts.forEach( function ( shortcut ) { var accessKey = ve.msg( shortcut.accessKey ); if ( accessKey !== '-' && accessKey !== '' ) { - ve.ui.triggerRegistry.register( - shortcut.command, new ve.ui.Trigger( accessKeyPrefix + accessKey ) - ); + try { + ve.ui.triggerRegistry.register( + shortcut.command, new ve.ui.Trigger( accessKeyPrefix + accessKey ) + ); + } catch ( e ) { + mw.log.warn( 'Invalid accesskey data? Failed to register ' + accessKeyPrefix + accessKey ); + return; + } ve.ui.commandHelpRegistry.register( 'other', shortcut.command, { trigger: shortcut.command, label: shortcut.label @@ -157,5 +162,4 @@ ve.ui.commandRegistry.register( ve.ui.MWCommandHelpDialog.static.commandGroups.other.demote.push( shortcut.command ); } } ); - }() );