2121if ( UA . isMozilla ) {
2222 let y = async ( url , originUrl = '' ) => await XSS . test ( { originUrl, url, method : "GET" } ) ;
2323 let n = async ( ...args ) => ! await y ( ...args ) ;
24- Promise . all ( [
24+ let xssTest = Promise . all ( [
2525 ( ) => y ( "https://noscript.net/<script" ) ,
2626 ( ) => n ( "https://noscript.net/<script" , "https://noscript.net/" ) ,
2727 ( ) => y ( "https://vulnerabledoma.in/char_test?body=%80%3Cscript%3Ealert(1)%3C/script%3E" ) ,
@@ -32,25 +32,25 @@ if (UA.isMozilla) {
3232 ( ) => y ( "https://vulnerabledoma.in/xss_link?url=javascript%26colo%00n%3Balert%u00281%29" ) ,
3333 ( ) => y ( "https://vulnerabledoma.in/xss_link?url=javascript:\\u{%0A6e}ame" ) ,
3434 ] . map ( t => Test . run ( t ) )
35- ) . then ( ( ) => Test . report ( ) ) ;
35+ ) ;
3636
3737 let invalidCharsTest = async ( ) => {
3838
3939 await include ( "xss/InjectionChecker.js" ) ;
4040 let IC = await XSS . InjectionChecker ;
4141 let rx = new IC ( ) . invalidCharsRx ;
42-
42+ console . log ( "Testing invalidCharsRx" , rx ) ;
4343 let x = n => '\\u' + ( "0000" + n . toString ( 16 ) ) . slice ( - 4 ) ;
4444 function check ( ch ) {
45- eval ( `{ let _${ ch } _} `) ;
45+ Function ( ` let _${ ch } _`) ;
4646 }
4747 let cur = 0x7e ;
4848 let fail = false ;
49- while ( cur ++ < 0xffff ) {
49+ while ( cur ++ < 0xffff && ! fail ) {
5050 let ch = String . fromCharCode ( cur ) ;
5151 try {
5252 check ( ch ) ;
53- if ( tx . test ( ch ) ) {
53+ if ( rx . test ( ch ) ) {
5454 console . error ( x ( cur ) + " should not test invalid!" ) ;
5555 fail = true ;
5656 }
@@ -64,6 +64,10 @@ if (UA.isMozilla) {
6464 }
6565 return ! fail ;
6666 } ;
67-
68- Test . run ( invalidCharsTest , "InjectionChecker.invalidCharsRx" ) . then ( Test . report ( ) ) ;
67+ ( async ( ) => {
68+ await xssTest ;
69+ Test . report ( ) ;
70+ await Test . run ( invalidCharsTest , "InjectionChecker.invalidCharsRx" ) ;
71+ Test . report ( ) ;
72+ } ) ( ) ;
6973}
0 commit comments