diff --git a/lighthouse-core/gather/gatherers/seo/font-size.js b/lighthouse-core/gather/gatherers/seo/font-size.js index a12c4fb6c5f7..8947a6de2ebf 100644 --- a/lighthouse-core/gather/gatherers/seo/font-size.js +++ b/lighthouse-core/gather/gatherers/seo/font-size.js @@ -91,7 +91,7 @@ function getEffectiveRule(property, node, { const matchingRule = nodeStyles .find(style => // the applicable property will be the only one that isn't in the "overloaded" state. - style.allProperties.some(item => item.name === property && + style.allProperties().some(item => item.name === property && matchedStyles.propertyState(item) !== CSSMatchedStyles.PropertyState.Overloaded) ); diff --git a/lighthouse-core/lib/web-inspector.js b/lighthouse-core/lib/web-inspector.js index b9817cf58c79..294c1c060b34 100644 --- a/lighthouse-core/lib/web-inspector.js +++ b/lighthouse-core/lib/web-inspector.js @@ -7,48 +7,49 @@ 'use strict'; /** - * Stubbery to allow portions of the DevTools frontend to be used in lighthouse. `WebInspector` + * Stubbery to allow portions of the DevTools frontend to be used in lighthouse. `SDK` * technically lives on the global object but should be accessed through a normal `require` call. */ module.exports = (function() { - if (global.WebInspector) { - return global.WebInspector; - } - - // Global pollution. - // Check below is to make it worker-friendly where global is worker's self. - if (global.self !== global) { - global.self = global; + if (global.SDK) { + return global.SDK; } + // Dependencies for effective CSS rule calculation. Global pollution! + global.SDK = {}; + global.TextUtils = {}; global.Node = { ELEMENT_NODE: 1, TEXT_NODE: 3, }; - - global.CSSAgent = {}; - global.CSSAgent.StyleSheetOrigin = { - Injected: 'injected', - UserAgent: 'user-agent', - Inspector: 'inspector', - Regular: 'regular', + global.Protocol = { + CSS: { + StyleSheetOrigin: { + Injected: 'injected', + UserAgent: 'user-agent', + Inspector: 'inspector', + Regular: 'regular', + }, + }, }; - global.CSS = {}; - global.CSS.supports = () => true; - - // Stash the real one so we can reinstall after DT incorrectly polyfills. - // See https://github.com/GoogleChrome/lighthouse/issues/73 - const _setImmediate = global.setImmediate; - - global.WebInspector = {}; - const WebInspector = global.WebInspector; - - // Shared Dependencies - require('chrome-devtools-frontend/front_end/platform/utilities.js'); + /** + * The single prototype augmentation needed from 'chrome-devtools-frontend/front_end/platform/utilities.js'. + * @return {Array} + */ + String.prototype.computeLineEndings = function() { // eslint-disable-line no-extend-native + const endings = []; + for (let i = 0; i < this.length; i++) { + if (this.charAt(i) === '\n') { + endings.push(i); + } + } + endings.push(this.length); + return endings; + }; - // Dependencies for effective CSS rule calculation. - require('chrome-devtools-frontend/front_end/common/TextRange.js'); + require('chrome-devtools-frontend/front_end/text_utils/Text.js'); + require('chrome-devtools-frontend/front_end/text_utils/TextRange.js'); require('chrome-devtools-frontend/front_end/sdk/CSSMatchedStyles.js'); require('chrome-devtools-frontend/front_end/sdk/CSSMedia.js'); require('chrome-devtools-frontend/front_end/sdk/CSSMetadata.js'); @@ -56,15 +57,5 @@ module.exports = (function() { require('chrome-devtools-frontend/front_end/sdk/CSSRule.js'); require('chrome-devtools-frontend/front_end/sdk/CSSStyleDeclaration.js'); - WebInspector.CSSMetadata._generatedProperties = [ - { - name: 'font-size', - inherited: true, - }, - ]; - - // Restore setImmediate, see comment at top. - global.setImmediate = _setImmediate; - - return WebInspector; + return global.SDK; })(); diff --git a/package.json b/package.json index 76574c69cd05..2f6046e9096f 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ }, "dependencies": { "axe-core": "3.0.0-beta.2", - "chrome-devtools-frontend": "1.0.422034", + "chrome-devtools-frontend": "1.0.593291", "chrome-launcher": "^0.10.4", "configstore": "^3.1.1", "cssstyle": "1.1.1", diff --git a/yarn.lock b/yarn.lock index 836946eac601..815d7cc94433 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1029,9 +1029,9 @@ chrome-devtools-frontend@1.0.401423: version "1.0.401423" resolved "https://registry.yarnpkg.com/chrome-devtools-frontend/-/chrome-devtools-frontend-1.0.401423.tgz#32a89b8d04e378a494be3c8d63271703be1c04ea" -chrome-devtools-frontend@1.0.422034: - version "1.0.422034" - resolved "https://registry.yarnpkg.com/chrome-devtools-frontend/-/chrome-devtools-frontend-1.0.422034.tgz#071c8ce14466b7653032fcd1ad1a4a68d5e3cbd9" +chrome-devtools-frontend@1.0.593291: + version "1.0.593291" + resolved "https://registry.yarnpkg.com/chrome-devtools-frontend/-/chrome-devtools-frontend-1.0.593291.tgz#72ed2e488e4ab8c5df9f35a5ce6bb128eb3c5e74" chrome-launcher@^0.10.4: version "0.10.4"