mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 15:12:10 +08:00
禁用 eval 方法
This commit is contained in:
parent
6bd7ca2ef3
commit
120fa66149
@ -61,7 +61,8 @@ globalThis.lx_setup = (key, id, name, description, version, author, homepage, ra
|
||||
const callbacks = new Map()
|
||||
let timeoutId = 0
|
||||
const _setTimeout = (callback, timeout = 0, ...params) => {
|
||||
if (typeof timeout !== 'number' || timeout < 0) throw new Error('timeout required number')
|
||||
if (typeof callback !== 'function') throw new Error('callback required a function')
|
||||
if (typeof timeout !== 'number' || timeout < 0) throw new Error('timeout required a number')
|
||||
if (timeoutId > 90000000000) throw new Error('max timeout')
|
||||
const id = timeoutId++
|
||||
callbacks.set(id, {
|
||||
@ -520,6 +521,10 @@ globalThis.lx_setup = (key, id, name, description, version, author, homepage, ra
|
||||
? _toString.apply(this)
|
||||
: `function ${this.name}() { [native code] }`
|
||||
}
|
||||
// eslint-disable-next-line no-eval
|
||||
globalThis.eval = function() {
|
||||
throw new Error('eval is not available')
|
||||
}
|
||||
|
||||
const excludes = [
|
||||
Function.prototype.toString,
|
||||
|
Loading…
x
Reference in New Issue
Block a user