From 120fa66149d96abf2a01280c19af605a78b0fe59 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 16 Nov 2023 15:23:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E7=94=A8=20eval=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/src/main/assets/script/user-api-preload.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/assets/script/user-api-preload.js b/android/app/src/main/assets/script/user-api-preload.js index ac2f5d0..a2784db 100644 --- a/android/app/src/main/assets/script/user-api-preload.js +++ b/android/app/src/main/assets/script/user-api-preload.js @@ -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,