-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Originally mentioned by @rugk in #6 (comment). Users will get many of these erroneous warnings on extensions with several option groups, like the Awesome Emoji Picker, which is confusing for developers creating PRs (#6 (comment)).
This issue is the unfreezeObject() function:
AddonSettings/AddonSettings.js
Lines 33 to 47 in 7855b9d
| function unfreezeObject(value) { | |
| // always shallow-copy | |
| if (Array.isArray(value)) { | |
| value = value.slice(); | |
| } else if ((isPlainObject(value))) { | |
| value = Object.assign({}, value); | |
| } else { | |
| // return primitive value or similar ones | |
| return value; | |
| } | |
| // but warn if object was not even frozen, so deev can fix the default settings | |
| if (!Object.isFrozen(value)) { | |
| console.warn("The following defined default value of type", typeof value, "is not frozen. It is recommend that all default options are frozen.", value); | |
| } |
It checks if the objects are not frozen after doing the shallow-copy. They will of course never be frozen after the shallow-copy, which is why this warning always outputs every time the function is called with an object, regardless of whether the object was initially frozen or not...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working