import Actor from '../actor' /** * CSSUsage manages the collection of CSS usage data. * The core of a CSSUsage is a JSON-able data structure called _knownRules * which looks like this: * This records the CSSStyleRules and their usage. * The format is: * Map({ * ||: { * selectorText: , * test: , * cssText: , * isUsed: , * presentOn: Set([ , ... ]), * preLoadOn: Set([ , ... ]), * isError: , * } * }) * * For example: * this._knownRules = Map({ * "http://eg.com/styles1.css|15|0": { * selectorText: "p.quote:hover", * test: "p.quote", * cssText: "p.quote { color: red; }", * isUsed: true, * presentOn: Set([ "http://eg.com/page1.html", ... ]), * preLoadOn: Set([ "http://eg.com/page1.html" ]), * isError: false, * }, ... * }); */ export default class CSSUsage extends Actor { /** * Begin recording usage data * * @param {Boolean} [url=false] It's best if we start by reloading the current page * because that starts the test at a known point, but there could be reasons * why we don't want to do that (e.g. the page contains state that will be * lost across a reload) * @return {Promise.