View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017156 | MMW 5 | Extensions framework | public | 2020-12-01 03:33 | 2020-12-06 15:38 |
Reporter | drakinite | Assigned To | |||
Priority | urgent | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Target Version | 5.0 | Fixed in Version | 5.0 | ||
Summary | 0017156: Invalid addon config scripts cause crash | ||||
Description | When an addon's config script does not create a window.configInfo object with load() and save() functions, it causes a crash from dlgAddonConfig.js. Ideally, dlgAddonConfig.js would catch the invalid code and display it to the user without a crash. Modified dlgAddonConfig attached. | ||||
Tags | No tags attached. | ||||
Attached Files | dlgAddonConfig.js (1,126 bytes)
/* '(C) Ventis Media, Licensed under the Ventis Limited Reciprocal License - see: license.txt for details' */ "use strict"; function init(params) { var wnd = this; wnd.resizeable = true; assert(params.addon, 'params.addon not defined'); var item = params.addon; wnd.title = _('Addon Configuration') + ' | ' + item.title; window.configInfo; requirejs(item.configFile); var panel = qid('pnlContent'); if (typeof window.configInfo === 'object' && typeof window.configInfo.load === 'function' && typeof window.configInfo.save === 'function') { window.configInfo.load(panel, item); window.localListen(qid('btnOK'), 'click', function () { window.configInfo.save(panel, item); closeWindow(); }); } else { messageDlg(_('Invalid addon configuration file.') + '</br></br>' + _('window.configInfo must be defined, and window.configInfo.load and window.configInfo.save must be functions.'), 'Error', ['btnOk'], {defaultButton: 'btnOk'}, () => { closeWindow(); }); } } | ||||
Fixed in build | 2278 | ||||
|
OK, I applied your changes -- just left the error message untranslated (i.e. removed the _() function in order to not get into our localization WebLate framework) => added in 2278 But note that generally we can hardly catch all errors in addons (it is not even possible as addon can modify any part of MM code), so addon developers should use the '[x] Developer mode' checkbox in Options > About to supress the script errors being submitted during development. And we will see the errors coming from users later to get the addon developer know that his script has a defect. |
|
Verified 2280 Works OK, no regressions. |