aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-27 19:40:19 -0400
committerGitHub <noreply@github.com>2020-10-27 19:40:19 -0400
commit9e57509e25a7d750e7113b1d41f1d3af732ff934 (patch)
tree58ec90a367411bed5cb441424025acd7a47049ef /ext/bg
parent75734de7eba831c52cd27738a7c7df92be61b976 (diff)
Json schema default value improvement (#964)
* Ensure value has property before using its value * Add tests
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/json-schema.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/bg/js/json-schema.js b/ext/bg/js/json-schema.js
index adb71fa3..ea1531ab 100644
--- a/ext/bg/js/json-schema.js
+++ b/ext/bg/js/json-schema.js
@@ -637,7 +637,8 @@ class JsonSchemaValidator {
if (propertySchema === null) { continue; }
info.valuePush(property, value);
info.schemaPush(property, propertySchema);
- value[property] = this._getValidValueOrDefault(propertySchema, value[property], info);
+ const hasValue = Object.prototype.hasOwnProperty.call(value, property);
+ value[property] = this._getValidValueOrDefault(propertySchema, hasValue ? value[property] : void 0, info);
info.schemaPop();
info.valuePop();
}