Skip to content

Commit d9ee5c6

Browse files
committed
🐛 修复对GM.*函数的支持
1 parent 5ebf3aa commit d9ee5c6

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/apps/grant/background.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ export class BackgroundGrant {
220220
}
221221
App.Log.Debug('script', 'call function: ' + propertyName, script.name);
222222
const metaGrant = script.metadata['grant'] || [];
223-
// TODO: 优化效率
223+
// TODO: 使用map优化效率
224224
if (!permission.default) {
225225
let flag = false;
226+
console.log(metaGrant);
227+
console.log(propertyName);
226228
for (let i = 0; i < metaGrant.length; i++) {
227-
if (metaGrant[i] == propertyName) {
229+
if (metaGrant[i] == propertyName || metaGrant[i].replace('.', '_') == propertyName) {
228230
flag = true;
229231
break;
230232
}
@@ -502,7 +504,7 @@ export class BackgroundGrant {
502504
resolve(ret);
503505
});
504506
},
505-
alias: ['GM.fetch', 'GM.xmlHttpRequest'],
507+
alias: ['GM.xmlHttpRequest'],
506508
})
507509
protected GM_xmlhttpRequest(grant: Grant, post: IPostMessage): Promise<any> {
508510
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)