From d9ee5c6643cc3f2146c99703b58d786ca7e708da Mon Sep 17 00:00:00 2001 From: CodFrm Date: Mon, 10 Jan 2022 23:51:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=AF=B9GM.*?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/grant/background.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/apps/grant/background.ts b/src/apps/grant/background.ts index c74b975e..28fc364a 100644 --- a/src/apps/grant/background.ts +++ b/src/apps/grant/background.ts @@ -220,11 +220,13 @@ export class BackgroundGrant { } App.Log.Debug('script', 'call function: ' + propertyName, script.name); const metaGrant = script.metadata['grant'] || []; - // TODO: 优化效率 + // TODO: 使用map优化效率 if (!permission.default) { let flag = false; + console.log(metaGrant); + console.log(propertyName); for (let i = 0; i < metaGrant.length; i++) { - if (metaGrant[i] == propertyName) { + if (metaGrant[i] == propertyName || metaGrant[i].replace('.', '_') == propertyName) { flag = true; break; } @@ -502,7 +504,7 @@ export class BackgroundGrant { resolve(ret); }); }, - alias: ['GM.fetch', 'GM.xmlHttpRequest'], + alias: ['GM.xmlHttpRequest'], }) protected GM_xmlhttpRequest(grant: Grant, post: IPostMessage): Promise { return new Promise((resolve, reject) => {