File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export const extractCss = async url => {
25
25
// Make sure that we only try to extract CSS from valid pages.
26
26
// Bail out if the response is an invalid request (400, 500)
27
27
if ( response . status ( ) >= 400 ) {
28
+ await browser . close ( )
28
29
return Promise . reject (
29
30
new Error (
30
31
`There was an error retrieving CSS from ${ url } .\n\tHTTP status code: ${ response . statusCode } (${ response . statusText } )`
@@ -38,14 +39,13 @@ export const extractCss = async url => {
38
39
39
40
if ( headers [ 'content-type' ] . includes ( 'text/css' ) ) {
40
41
const css = await response . text ( )
42
+ await browser . close ( )
41
43
42
- return Promise . resolve ( [
43
- {
44
- type : 'file' ,
45
- href : url ,
46
- css
47
- }
48
- ] )
44
+ return Promise . resolve ( [ {
45
+ type : 'file' ,
46
+ href : url ,
47
+ css
48
+ } ] )
49
49
}
50
50
51
51
// Coverage contains a lot of <style> and <link> CSS,
@@ -105,9 +105,11 @@ export const extractCss = async url => {
105
105
type : 'link-or-import'
106
106
} ) )
107
107
108
- const css = links
108
+ const resources = links
109
109
. concat ( styleSheetsApiCss )
110
110
. concat ( inlineCss )
111
111
112
- return Promise . resolve ( css )
112
+ await browser . close ( )
113
+
114
+ return Promise . resolve ( resources )
113
115
}
You can’t perform that action at this time.
0 commit comments