Skip to content

Commit

Permalink
4.3.1 (#8750)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored and paulirish committed May 2, 2019
1 parent 01b217b commit 5c48bb8
Show file tree
Hide file tree
Showing 23 changed files with 2,609 additions and 112 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ sudo: required
language: node_js
branches:
only:
- master
- v4
matrix:
include:
- node_js: "8"
- node_js: "10"
if: head_branch IS blank AND branch = master
if: head_branch IS blank AND branch = v4
- node_js: "11"
if: head_branch IS blank AND branch = master
if: head_branch IS blank AND branch = v4
dist: trusty
cache:
yarn: true
Expand All @@ -28,6 +28,8 @@ before_script:
# see comment above about puppeteer
- export CHROME_PATH="$(which google-chrome-stable)"
- sh -e /etc/init.d/xvfb start
# Print out the Chrome version so we know what we're working with
- google-chrome-stable --version
- yarn build-all
script:
- yarn bundlesize
Expand Down
21 changes: 21 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
<a name="4.3.1"></a>
# 4.3.1 (2019-04-30)
[Full Changelog](https://github.com/googlechrome/lighthouse/compare/v4.3.0...v4.3.1)

## Core

* support traces missing TracingStartedInBrowser ([#7122](https://github.com/googlechrome/lighthouse/pull/7122))
* driver: only fail security state if scheme is not cryptographic ([#8338](https://github.com/googlechrome/lighthouse/pull/8338))

## Clients

* extension: remove github link in favor of copy to clipboard ([#8294](https://github.com/googlechrome/lighthouse/pull/8294))

## Deps

* snyk: update snyk snapshot ([#8354](https://github.com/googlechrome/lighthouse/pull/8354))

## Misc

* add releasing scripts ([#8387](https://github.com/googlechrome/lighthouse/pull/8387))

<a name="4.3.0"></a>
# 4.3.0 (2019-04-08)
[Full Changelog](https://github.com/googlechrome/lighthouse/compare/4.2.0...4.3.0)
Expand Down
2 changes: 1 addition & 1 deletion clients/extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_appName__",
"version": "4.3.0",
"version": "4.3.1",
"minimum_chrome_version": "66",
"manifest_version": 2,
"description": "__MSG_appDescription__",
Expand Down
61 changes: 35 additions & 26 deletions clients/extension/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@
'use strict';

/** @typedef {typeof import('./extension-entry.js') & {console: typeof console}} BackgroundPage */
/** @typedef {import('../../../lighthouse-core/lib/lh-error.js')} LighthouseError */

/**
* Error strings that indicate a problem in how Lighthouse was run, not in
* Lighthouse itself, mapped to more useful strings to report to the user.
*/
const NON_BUG_ERROR_MESSAGES = {
'Another debugger': 'You probably have DevTools open. Close DevTools to use Lighthouse',
// The user tries to review an error page or has network issues
'ERRORED_DOCUMENT_REQUEST': 'Unable to load the page. Please verify the url you ' +
'are trying to review.',
'FAILED_DOCUMENT_REQUEST': 'Unable to load the page. Please verify the url you ' +
'are trying to review.',
'DNS_FAILURE': 'DNS servers could not resolve the provided domain.',
'INSECURE_DOCUMENT_REQUEST': 'The URL you have provided does not have a valid' +
' SSL certificate.',
'INVALID_URL': 'Lighthouse can only audit URLs that start' +
' with http:// or https://.',

// chrome extension API errors
'multiple tabs': 'You probably have multiple tabs open to the same origin. ' +
'Close the other tabs to use Lighthouse.',
// The extension debugger API is forbidden from attaching to the web store.
Expand All @@ -21,19 +33,10 @@ const NON_BUG_ERROR_MESSAGES = {
'Chrome Web Store. If necessary, use the Lighthouse CLI to do so.',
'Cannot access a chrome': 'The Lighthouse extension cannot audit ' +
'Chrome-specific urls. If necessary, use the Lighthouse CLI to do so.',
// The user tries to review an error page or has network issues
'Unable to load the page': 'Unable to load the page. Please verify the url you ' +
'are trying to review.',
'Cannot access contents of the page': 'Lighthouse can only audit URLs that start' +
' with http:// or https://.',
'INSECURE_DOCUMENT_REQUEST': 'The URL you have provided does not have valid' +
' security credentials.',
'INVALID_URL': 'Lighthouse can only audit URLs that start' +
' with http:// or https://.',
};

const MAX_ISSUE_ERROR_LENGTH = 60;

const subpageVisibleClass = 'subpage--visible';

/** @type {?URL} */
Expand Down Expand Up @@ -79,35 +82,40 @@ function find(query, context = document) {
}

/**
* @param {string} message
* @param {Error} err
* @return {HTMLAnchorElement}
* @return {HTMLButtonElement}
*/
function buildReportErrorLink(err) {
function buildErrorCopyButton(message, err) {
const issueBody = `
**Lighthouse Version**: ${getLighthouseVersion()}
**Lighthouse Commit**: ${getLighthouseCommitHash()}
**Chrome Version**: ${getChromeVersion()}
**Initial URL**: ${siteURL}
**Error Message**: ${err.message}
**Error Message**: ${message}
**Stack Trace**:
\`\`\`
${err.stack}
\`\`\`
`;

const url = new URL('https://github.com/GoogleChrome/lighthouse/issues/new');
const errorButtonDefaultText = 'Copy details to clipboard 📋';
const errorButtonEl = document.createElement('button');
errorButtonEl.className = 'button button--report-error';
errorButtonEl.textContent = errorButtonDefaultText;

const errorTitle = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH);
url.searchParams.append('title', `Extension Error: ${errorTitle}`);
url.searchParams.append('body', issueBody.trim());
errorButtonEl.addEventListener('click', async () => {
// @ts-ignore - tsc doesn't include `clipboard` on `navigator`
await navigator.clipboard.writeText(issueBody);
errorButtonEl.textContent = 'Copied to clipboard 📋';

const reportErrorEl = document.createElement('a');
reportErrorEl.className = 'button button--report-error';
reportErrorEl.href = url.href;
reportErrorEl.textContent = 'Report Error';
reportErrorEl.target = '_blank';
// Return button to inviting state after timeout.
setTimeout(() => {
errorButtonEl.textContent = errorButtonDefaultText;
}, 1000);
});

return reportErrorEl;
return errorButtonEl;
}

/**
Expand Down Expand Up @@ -176,13 +184,14 @@ async function onGenerateReportButtonClick(background, settings) {
// Close popup once report is opened in a new tab
window.close();
} catch (err) {
let message = err.message;
let message = err.friendlyMessage || err.message;
let includeReportLink = true;

// Check for errors in how the user ran Lighthouse and replace with a more
// helpful message (and remove 'Report Error' link).
for (const [test, replacement] of Object.entries(NON_BUG_ERROR_MESSAGES)) {
if (message.includes(test)) {
if (err.message.includes(test) ||
(err.friendlyMessage && err.friendlyMessage.includes(test))) {
message = replacement;
includeReportLink = false;
break;
Expand All @@ -193,7 +202,7 @@ async function onGenerateReportButtonClick(background, settings) {

if (includeReportLink) {
feedbackEl.className = 'feedback feedback-error';
feedbackEl.appendChild(buildReportErrorLink(err));
feedbackEl.appendChild(buildErrorCopyButton(message, err));
}

hideRunningSubpage();
Expand Down
4 changes: 2 additions & 2 deletions clients/extension/styles/lighthouse.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ html, body {
padding: 3px 5px;
font-size: .8em;
text-align: center;
display: inline;
margin-left: 5px;
display: block;
margin-top: 5px;
}

.subpage {
Expand Down
90 changes: 19 additions & 71 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,73 +31,22 @@ We follow [semver](https://semver.org/) versioning semantics (`vMajor.Minor.Patc
## Release Process

```sh
# use a custom lighthouse-pristine checkout to make sure your dev files aren't involved.

# * Install the latest.*
yarn

# * Bump it *
yarn version --no-git-tag-version
# manually bump extension v in clients/extension/manifest.json
yarn update:sample-json

# * Build it. This also builds the cli, extension, and viewer. *
yarn build-all

# * Test err'thing *
echo "Test the CLI."
yarn start "https://example.com" --view
yarn smoke

echo "Test the extension"
# ...

echo "Test a fresh local install"
# (starting from lighthouse-pristine root...)
npm pack
cd ..; rm -rf tmp; mkdir tmp; cd tmp
npm init -y
npm install ../lighthouse-pristine/lighthouse-*.tgz
npm explore lighthouse -- npm run smoke
npm explore lighthouse -- npm run chrome # try the manual launcher
npm explore lighthouse -- npm run fast -- http://example.com
cd ..; rm -rf ./tmp;

cd ../lighthouse-pristine; command rm -f lighthouse-*.tgz

echo "Test the lighthouse-viewer build"
# Manual test for now:
# Start a server in dist/viewer/ and open the page in a tab. You should see the viewer.
# Drop in a results.json or paste an existing gist url (e.g. https://gist.github.com/ebidel/b9fd478b5f40bf5fab174439dc18f83a).
# Check for errors!
cd dist/viewer ; python -m SimpleHTTPServer
# go to http://localhost:8000/

# * Update changelog *
git fetch --tags
yarn changelog
# add new contributors, e.g. from git shortlog -s -e -n v2.3.0..HEAD
# and https://github.com/GoogleChrome/lighthouse/graphs/contributors
echo "Edit the changelog for readability and brevity"

# * Put up the PR *
echo "Branch and commit the version bump."
git checkout -b bumpv240
git commit -am "2.4.0"
echo "Generate a PR and get it merged."

echo "Once it's merged, pull master and tag the (squashed) commit"
git tag -a v2.4.0 -m "v2.4.0"
git push --tags


# * Deploy-time *
echo "Rebuild extension and viewer to get the latest, tagged master commit"
yarn build-all;

# zip the extension files
# Run the tests
bash ./lighthouse-core/scripts/release/release-test.sh
# Prepare the commit, replace x.x.x with the desired version
bash ./lighthouse-core/scripts/release/release-prepare-commit.sh x.x.x

# Open the PR and await merge...
echo "It's been merged! 🎉"

# Run the tests again :)
bash ./lighthouse-core/scripts/release/release-test.sh
# Package everything for publishing
bash ./lighthouse-core/scripts/release/release-prepare-package.sh

# Upload the extension
node build/build-extension.js package; cd dist/extension-package/
echo "Go here: https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk "
open https://chrome.google.com/webstore/developer/edit/blipmdconlkpinefehnmjammfjpmpbjk
echo "Upload the package zip to CWS dev dashboard"
# Be in lighthouse-extension-owners group
# Open <https://chrome.google.com/webstore/developer/dashboard>
Expand All @@ -106,12 +55,11 @@ echo "Upload the package zip to CWS dev dashboard"
# Select `lighthouse-4.X.X.zip`
# _Publish_ at the bottom

echo "Verify the npm package won't include unncessary files"
npm pack --dry-run
npx pkgfiles

echo "ship it"
# Make sure you're in the Lighthouse pristine repo we just tested.
cd ../lighthouse-pristine
# Publish to NPM
npm publish
# Publish viewer
yarn deploy-viewer

# * Tell the world!!! *
Expand Down
6 changes: 6 additions & 0 deletions lighthouse-cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ async function begin() {
cliFlags.outputPath = 'stdout';
}

// @ts-ignore - deprecation message for removed disableDeviceEmulation; can remove warning in v6.
if (cliFlags.disableDeviceEmulation) {
log.warn('config', 'The "--disable-device-emulation" has been removed in v5.' +
' Please use "--emulated-form-factor=none" instead.');
}

if (cliFlags.extraHeaders) {
// TODO: LH.Flags.extraHeaders is actually a string at this point, but needs to be
// copied over to LH.Settings.extraHeaders, which is LH.Crdp.Network.Headers. Force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = [
'unused-javascript': {
score: '<1',
details: {
overallSavingsBytes: '>=25000',
overallSavingsBytes: '>=20000',
overallSavingsMs: '>300',
items: {
length: 2,
Expand Down
8 changes: 6 additions & 2 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,12 @@ class Driver {
/**
* @param {LH.Crdp.Security.SecurityStateChangedEvent} event
*/
const securityStateChangedListener = ({securityState, explanations}) => {
if (securityState === 'insecure') {
const securityStateChangedListener = ({
securityState,
explanations,
schemeIsCryptographic,
}) => {
if (securityState === 'insecure' && schemeIsCryptographic) {
cancel();
const insecureDescriptions = explanations
.filter(exp => exp.securityState === 'insecure')
Expand Down
23 changes: 23 additions & 0 deletions lighthouse-core/lib/traces/tracing-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,29 @@ class TraceProcessor {
}
}

// Support the case where everything else fails, see https://github.com/GoogleChrome/lighthouse/issues/7118.
// If we can't find either TracingStarted event, then we'll fallback to the first navStart that
// looks like it was loading the main frame with a real URL. Because the schema for this event
// has changed across Chrome versions, we'll be extra defensive about finding this case.
const navStartEvt = events.find(e => Boolean(e.name === 'navigationStart' && e.args &&
e.args.data && e.args.data.isLoadingMainFrame && e.args.data.documentLoaderURL));
// Find the first resource that was requested and make sure it agrees on the id.
const firstResourceSendEvt = events.find(e => e.name === 'ResourceSendRequest');
// We know that these properties exist if we found the events, but TSC doesn't.
if (navStartEvt && navStartEvt.args && navStartEvt.args.data &&
firstResourceSendEvt &&
firstResourceSendEvt.pid === navStartEvt.pid &&
firstResourceSendEvt.tid === navStartEvt.tid) {
const frameId = navStartEvt.args.frame;
if (frameId) {
return {
pid: navStartEvt.pid,
tid: navStartEvt.tid,
frameId,
};
}
}

throw new LHError(LHError.errors.NO_TRACING_STARTED);
}

Expand Down
17 changes: 17 additions & 0 deletions lighthouse-core/scripts/release/release-clean-pristine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

DIRNAME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LH_ROOT="$DIRNAME/../../.."
cd $LH_ROOT

set -euxo pipefail

# Setup a pristine git environment
cd ../lighthouse-pristine

if [[ -z "$(git status --porcelain)" ]]; then
echo "Pristine repo already clean!"
exit 0
fi

git clean -fx
Loading

0 comments on commit 5c48bb8

Please sign in to comment.