Skip to content
Permalink
Browse files

Fix: Ensure we are clossing subprocesses in jsdom

If the resource being analyzed is not an HTML or if there is an error
downloading it `this._window` could not be initialized and thus
preventing from reaching `this.killAllSubprocesses();`.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix webhintio/online-service#195
Close #2223
  • Loading branch information...
sarvaje authored and molant committed Apr 12, 2019
1 parent 7b44f65 commit 1c19155f563806c554fc12c8b1c7f67ac1bed433
Showing with 3 additions and 3 deletions.
  1. +3 −3 packages/connector-jsdom/src/connector.ts
@@ -288,9 +288,6 @@ export default class JSDOMConnector implements IConnector {
public close() {
try {
this._window.close();

// Kill any subprocess that is still alive.
this.killAllSubprocesses();
} catch (e) {
/*
* We could have some pending network requests and this could fail.
@@ -299,6 +296,9 @@ export default class JSDOMConnector implements IConnector {
*/
debug(`Exception ignored while closing JSDOM connector (most likely pending network requests)`);
debug(e);
} finally {
// Kill any subprocess that are still alive.
this.killAllSubprocesses();
}

return Promise.resolve();

0 comments on commit 1c19155

Please sign in to comment.
You can’t perform that action at this time.