From dd8e32e7c40011de95e6c81211e2b434be2fde78 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 4 Sep 2020 18:19:43 -0400 Subject: [PATCH] Fix template renderer sandbox compatibility (#770) * Use Object.prototype.hasOwnProperty.call instead of hasOwn * Disable WebExtension and core.js APIs for template-renderer.js --- .eslintrc.json | 10 ++++++++-- ext/bg/js/template-renderer.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 558fd928..7f52702c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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", diff --git a/ext/bg/js/template-renderer.js b/ext/bg/js/template-renderer.js index 1f68e3e0..5dd33814 100644 --- a/ext/bg/js/template-renderer.js +++ b/ext/bg/js/template-renderer.js @@ -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;