Skip to content
This repository was archived by the owner on Apr 25, 2022. It is now read-only.

Commit 7c71874

Browse files
committed
恢复UntrustedClick
1 parent 3fee148 commit 7c71874

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/internal/utils/utils.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {Client} from "./message";
2-
import {AppName, Application} from "../application";
3-
import {SystemConfig} from "@App/config";
1+
import { Client } from "./message";
2+
import { AppName, Application } from "../application";
3+
import { SystemConfig } from "@App/config";
44

55
export type RequestCallback = (body: any) => void
66
export type ErrorCallback = () => void
@@ -131,16 +131,16 @@ export class HttpUtils {
131131
let info = <RequestInfo>data.info;
132132
if (Application.App.IsBackend) {
133133
info.success = (body) => {
134-
client.Send({body: body, code: 0})
134+
client.Send({ body: body, code: 0 })
135135
};
136136
info.error = () => {
137-
client.Send({code: -1})
137+
client.Send({ code: -1 })
138138
};
139139
HttpUtils.Request(info)
140140
} else {
141141
// content 做转发
142142
let extClient = Application.App.Client;
143-
extClient.Send({type: "GM_xmlhttpRequest", info: info});
143+
extClient.Send({ type: "GM_xmlhttpRequest", info: info });
144144
extClient.Recv((data) => {
145145
client.Send(data)
146146
})
@@ -419,18 +419,18 @@ export function boolToString(val: boolean): string {
419419
}
420420

421421
export function UntrustedClick(el: Element): boolean {
422-
let untrusted = new MouseEvent("click", {});
423-
// if (!untrusted.isTrusted) {
424-
// Application.App.log.Warn("扩展执行错误");
425-
// return false;
426-
// }
422+
let untrusted = new MouseEvent("click", { "clientX": 10086 });
423+
if (!untrusted.isTrusted) {
424+
Application.App.log.Warn("扩展执行错误");
425+
return false;
426+
}
427427
return el.dispatchEvent(untrusted);
428428
}
429429

430430
export function Sleep(timeout?: number): Promise<any> {
431431
return new Promise<any>(resolve => {
432432
setTimeout(function () {
433-
resolve();
433+
resolve(undefined);
434434
}, timeout);
435435
});
436436
}

0 commit comments

Comments
 (0)