Do not use `bind` as a way to access native calls

This commit is contained in:
Raymond Hill 2023-10-29 10:22:54 -04:00
parent 3c4932e1a6
commit 5244ad5baf
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 2 deletions

View File

@ -60,8 +60,11 @@ function safeSelf() {
'addEventListener': self.EventTarget.prototype.addEventListener, 'addEventListener': self.EventTarget.prototype.addEventListener,
'removeEventListener': self.EventTarget.prototype.removeEventListener, 'removeEventListener': self.EventTarget.prototype.removeEventListener,
'fetch': self.fetch, 'fetch': self.fetch,
'JSON_parse': self.JSON.parse.bind(self.JSON), 'JSON': self.JSON,
'JSON_stringify': self.JSON.stringify.bind(self.JSON), 'JSON_parseFn': self.JSON.parse,
'JSON_stringifyFn': self.JSON.stringify,
'JSON_parse': (...args) => safe.JSON_parseFn.call(safe.JSON, ...args),
'JSON_stringify': (...args) => safe.JSON_stringifyFn.call(safe.JSON, ...args),
'log': console.log.bind(console), 'log': console.log.bind(console),
uboLog(...args) { uboLog(...args) {
if ( scriptletGlobals.has('canDebug') === false ) { return; } if ( scriptletGlobals.has('canDebug') === false ) { return; }