Fix template renderer sandbox compatibility (#770)

* Use Object.prototype.hasOwnProperty.call instead of hasOwn

* Disable WebExtension and core.js APIs for template-renderer.js
This commit is contained in:
toasted-nutbread 2020-09-04 18:19:43 -04:00 committed by GitHub
parent 1cc9f4b1a4
commit dd8e32e7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -84,14 +84,20 @@
},
"overrides": [
{
"files": ["ext/mixed/js/core.js"],
"files": [
"ext/mixed/js/core.js",
"ext/bg/js/template-renderer.js"
],
"env": {
"webextensions": false
}
},
{
"files": ["ext/**/*.js"],
"excludedFiles": ["ext/mixed/js/core.js"],
"excludedFiles": [
"ext/mixed/js/core.js",
"ext/bg/js/template-renderer.js"
],
"globals": {
"errorToJson": "readonly",
"jsonToError": "readonly",

View File

@ -43,7 +43,7 @@ class TemplateRenderer {
}
const markerPre = data.marker;
const markerPreHas = hasOwn(data, 'marker');
const markerPreHas = Object.prototype.hasOwnProperty.call(data, 'marker');
try {
this._stateStack = [new Map()];
data.marker = marker;