@@ -84,39 +84,42 @@ export async function check(sr, done) {
84
84
} ) ;
85
85
const page = await browser . newPage ( ) ;
86
86
const docPath = sr . url . replace ( / \/ [ ^ / ] + $ / , '/' ) . replace ( / ^ h t t p s ? : / , '' ) ;
87
+ const origin = new URL ( sr . url ) . origin ;
87
88
88
89
page . on ( 'response' , response => {
89
90
const url = simplifyURL ( response . url ( ) ) ;
90
91
const { referer } = response . request ( ) . headers ( ) ;
91
92
92
- // check if resource is in same folder as base document
93
- if (
94
- ! url . replace ( / ^ h t t p s ? : / , '' ) . startsWith ( docPath ) &&
95
- ! ( includedByReg ( url ) || includedByReg ( referer ) ) &&
96
- url !== sr . url
97
- ) {
98
- sr . error ( compound , 'not-same-folder' , { base : docPath , url } ) ;
99
- }
93
+ if ( url !== `${ origin } /favicon.ico` ) {
94
+ // check if resource is in same folder as base document
95
+ if (
96
+ ! url . replace ( / ^ h t t p s ? : / , '' ) . startsWith ( docPath ) &&
97
+ ! ( includedByReg ( url ) || includedByReg ( referer ) ) &&
98
+ url !== sr . url
99
+ ) {
100
+ sr . error ( compound , 'not-same-folder' , { base : docPath , url } ) ;
101
+ }
100
102
101
- // check if every resource's status code is ok, ignore 3xx
102
- if ( response . status ( ) >= 400 && ! noRespondAllowList . includes ( url ) ) {
103
- const chain = response . request ( ) . redirectChain ( ) ;
104
- // If an url is redirected from another, chain shall exist
105
- if ( chain . length ) {
106
- sr . error ( compound , 'response-error-with-redirect' , {
107
- url,
108
- originUrl : chain [ 0 ] . url ( ) ,
109
- status : response . status ( ) ,
110
- text : response . statusText ( ) ,
111
- referer,
112
- } ) ;
113
- } else {
114
- sr . error ( compound , 'response-error' , {
115
- url,
116
- status : response . status ( ) ,
117
- text : response . statusText ( ) ,
118
- referer,
119
- } ) ;
103
+ // check if every resource's status code is ok, ignore 3xx
104
+ if ( response . status ( ) >= 400 && ! noRespondAllowList . includes ( url ) ) {
105
+ const chain = response . request ( ) . redirectChain ( ) ;
106
+ // If an url is redirected from another, chain shall exist
107
+ if ( chain . length ) {
108
+ sr . error ( compound , 'response-error-with-redirect' , {
109
+ url,
110
+ originUrl : chain [ 0 ] . url ( ) ,
111
+ status : response . status ( ) ,
112
+ text : response . statusText ( ) ,
113
+ referer,
114
+ } ) ;
115
+ } else {
116
+ sr . error ( compound , 'response-error' , {
117
+ url,
118
+ status : response . status ( ) ,
119
+ text : response . statusText ( ) ,
120
+ referer,
121
+ } ) ;
122
+ }
120
123
}
121
124
}
122
125
} ) ;
0 commit comments