Compare commits

...

1 Commits

Author SHA1 Message Date
Rob Garrison
a01645daf0 Fix error message when saving an empty usercss. Closes #795 2019-11-02 10:28:25 -05:00
2 changed files with 7 additions and 0 deletions

View File

@ -1161,6 +1161,10 @@
"message": "Restore removed section", "message": "Restore removed section",
"description": "Label for the button to restore a removed section" "description": "Label for the button to restore a removed section"
}, },
"sectionEmpty": {
"message": "Not saved due to lack of usercss sections.\n\nAdd at least one @-moz-document domain(\"example.com\") {} section",
"description": "Error shown when the user tries to save an empty usercss style"
},
"shortcuts": { "shortcuts": {
"message": "Shortcuts", "message": "Shortcuts",
"description": "Go to shortcut configuration" "description": "Go to shortcut configuration"

View File

@ -71,6 +71,9 @@ const usercss = (() => {
.then(({sections, errors}) => { .then(({sections, errors}) => {
if (!errors.length) errors = false; if (!errors.length) errors = false;
if (!sections.length || errors && !allowErrors) { if (!sections.length || errors && !allowErrors) {
if (!errors) {
errors = chrome.i18n.getMessage('sectionEmpty');
}
throw errors; throw errors;
} }
style.sections = sections; style.sections = sections;