Skip to content

Commit

Permalink
🐛 修复对GM.*函数的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Jan 10, 2022
1 parent 5ebf3aa commit d9ee5c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/apps/grant/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<any> {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit d9ee5c6

Please sign in to comment.