Skip to content

Commit

Permalink
core: update chrome-devtools-frontend to latest (#6101)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny authored Sep 24, 2018
1 parent f0e6dd9 commit 67302a0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 46 deletions.
2 changes: 1 addition & 1 deletion lighthouse-core/gather/gatherers/seo/font-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);

Expand Down
73 changes: 32 additions & 41 deletions lighthouse-core/lib/web-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,55 @@
'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<number>}
*/
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');
require('chrome-devtools-frontend/front_end/sdk/CSSProperty.js');
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;
})();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 67302a0

Please sign in to comment.