Skip to content

Commit

Permalink
fix(csscoverage): don't prematurely disable the CSS domain (#3418)
Browse files Browse the repository at this point in the history
CSS stylesheets can still be parsed and added events emitted during the CSS.stopRuleUsageTracking call. It needs to be awaited before calling CSS.disable, otherwise the text content of those style sheets will be unavailable.
  • Loading branch information
JoelEinbinder authored and aslushnikov committed Oct 16, 2018
1 parent a4cebd8 commit d025d1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Coverage.js
Expand Up @@ -224,8 +224,8 @@ class CSSCoverage {
async stop() {
assert(this._enabled, 'CSSCoverage is not enabled');
this._enabled = false;
const [ruleTrackingResponse] = await Promise.all([
this._client.send('CSS.stopRuleUsageTracking'),
const ruleTrackingResponse = await this._client.send('CSS.stopRuleUsageTracking');
await Promise.all([
this._client.send('CSS.disable'),
this._client.send('DOM.disable'),
]);
Expand Down
2 changes: 1 addition & 1 deletion test/coverage.spec.js
Expand Up @@ -189,7 +189,7 @@ module.exports.addTests = function({testRunner, expect}) {
expect(coverage.length).toBe(0);
});
});
xit('should work with a recently loaded stylesheet', async function({page, server}) {
it('should work with a recently loaded stylesheet', async function({page, server}) {
await page.coverage.startCSSCoverage();
await page.evaluate(async url => {
document.body.textContent = 'hello, world';
Expand Down

0 comments on commit d025d1f

Please sign in to comment.