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" ;
4
4
5
5
export type RequestCallback = ( body : any ) => void
6
6
export type ErrorCallback = ( ) => void
@@ -131,16 +131,16 @@ export class HttpUtils {
131
131
let info = < RequestInfo > data . info ;
132
132
if ( Application . App . IsBackend ) {
133
133
info . success = ( body ) => {
134
- client . Send ( { body : body , code : 0 } )
134
+ client . Send ( { body : body , code : 0 } )
135
135
} ;
136
136
info . error = ( ) => {
137
- client . Send ( { code : - 1 } )
137
+ client . Send ( { code : - 1 } )
138
138
} ;
139
139
HttpUtils . Request ( info )
140
140
} else {
141
141
// content 做转发
142
142
let extClient = Application . App . Client ;
143
- extClient . Send ( { type : "GM_xmlhttpRequest" , info : info } ) ;
143
+ extClient . Send ( { type : "GM_xmlhttpRequest" , info : info } ) ;
144
144
extClient . Recv ( ( data ) => {
145
145
client . Send ( data )
146
146
} )
@@ -419,18 +419,18 @@ export function boolToString(val: boolean): string {
419
419
}
420
420
421
421
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
+ }
427
427
return el . dispatchEvent ( untrusted ) ;
428
428
}
429
429
430
430
export function Sleep ( timeout ?: number ) : Promise < any > {
431
431
return new Promise < any > ( resolve => {
432
432
setTimeout ( function ( ) {
433
- resolve ( ) ;
433
+ resolve ( undefined ) ;
434
434
} , timeout ) ;
435
435
} ) ;
436
436
}
0 commit comments