Skip to content

Commit

Permalink
Latest review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Sep 22, 2016
1 parent a58fef2 commit 41e390d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion lighthouse-core/gather/drivers/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ class Driver {

let swHasMoreThanOneClient = false;
registrations
.filter(reg => !reg.isDeleted)
.filter(reg => {
const parsedURL = parseURL(reg.scopeURL);
const swOrigin = `${parsedURL.protocol}//${parsedURL.hostname}` +
Expand Down
14 changes: 12 additions & 2 deletions lighthouse-core/gather/gather-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class GatherRunner {
});
}

static disposeDriver(driver) {
log.log('status', 'Disconnecting from browser...');
driver.disconnect();
}

/**
* Navigates to about:blank and calls beforePass() on gatherers before tracing
* has started and before navigation to the target page.
Expand Down Expand Up @@ -255,8 +260,7 @@ class GatherRunner {
// We dont need to hold up the reporting for the reload/disconnect,
// so we will not return a promise in here.
driver.reloadForCleanStateIfNeeded(options).then(_ => {
log.log('status', 'Disconnecting from browser...');
driver.disconnect();
GatherRunner.disposeDriver(driver);
});
})
.then(_ => {
Expand All @@ -274,6 +278,12 @@ class GatherRunner {
});
});
return artifacts;
})
// cleanup on error
.catch(err => {
GatherRunner.disposeDriver(driver);

throw err;
});
}

Expand Down

0 comments on commit 41e390d

Please sign in to comment.