remove some unnecessary deepCopy calls

This commit is contained in:
tophf 2018-01-05 13:26:11 +03:00
parent 45219a88c1
commit bced23052c
3 changed files with 4 additions and 10 deletions

View File

@ -23,12 +23,7 @@ function createSourceEditor(style) {
});
// normalize style
if (!style.id) {
setupNewStyle(style);
} else {
// style might be an object reference to background page
style = deepCopy(style);
}
if (!style.id) setupNewStyle(style);
const cm = CodeMirror($('.single-editor'), {value: style.sourceCode});
editors.push(cm);
@ -195,7 +190,7 @@ function createSourceEditor(style) {
history.replaceState({}, '', `?id=${newStyle.id}`);
}
sessionStorage.justEditedStyleId = newStyle.id;
style = deepCopy(newStyle);
style = newStyle;
updateMeta();
}
}
@ -222,7 +217,6 @@ function createSourceEditor(style) {
sourceCode: code,
}))
.then(replaceStyle)
.then(() => cm.setOption('mode', cm.doc.mode))
.catch(err => {
if (err.message === t('styleMissingMeta', 'name')) {
messageBox.confirm(t('usercssReplaceTemplateConfirmation')).then(ok => ok &&

View File

@ -283,7 +283,7 @@
]))
).then(ok => ok &&
API.saveUsercss(Object.assign(style, dup && {reason: 'update'}))
.then(r => install(r instanceof Object ? r : deepCopy(r)))
.then(install)
.catch(err => messageBox.alert(t('styleInstallFailed', err)))
);
};

View File

@ -366,7 +366,7 @@ Object.assign(handleEvent, {
if (styleIsUsercss) {
API.getStyles({id: styleId}).then(([style]) => {
hotkeys.setState(false);
configDialog(deepCopy(style)).then(() => {
configDialog(style).then(() => {
hotkeys.setState(true);
});
});