
This is a reland of commit 49d3a5a2bc
This reland fixes the compile errors on casto builds.
See patchset 1..2 for diff.
Original change's description:
> Add CrashReporterClient::GetProductInfo(ProductInfo*)
>
> This method unifies the other two existing GetProductNameAndVersion()
> functions, simplifying the CrashReporterClient interface.
>
> This is a step towards providing an interface for accessing product info
> through crash_export_thunks, which will be used in JS Error reporting on
> Windows.
>
> Bug: 40149439, 374696525
> Low-Coverage-Reason: TESTS_IN_SEPARATE_CL, the new interface will be used in future CLs.
> Change-Id: Ic198b69764721b7d03cf71fb9f79a8392fe3d8d1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6012865
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Reviewed-by: Nate Fischer <ntfschr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1382090}
Bug: 40149439, 374696525
Change-Id: I4b1ad56c84081736e1df5051706bbd9695727c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6012631
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Vigen Issahhanjan <vigeni@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1383219}
Headless Chromium
Headless Chromium allows running Chromium in a headless/server environment. Expected use cases include loading web pages, extracting metadata (e.g., the DOM) and generating bitmaps from page contents -- using all the modern web platform features provided by Chromium and Blink.
As of M118, precompiled headless_shell
binaries are available for download
under the name chrome-headless-shell
via Chrome for Testing
infrastructure.
There are two ways to use Headless Chromium:
Usage via the DevTools remote debugging protocol
- Start a normal Chrome binary with the
--headless=old
command line flag:
$ chrome --headless=old --remote-debugging-port=9222 https://chromium.org/
- Navigate to
chrome://inspect/
in another instance of Chrome.
Usage from Node.js
For example, the chrome-remote-interface Node.js package can be used to extract a page's DOM like this:
const CDP = require('chrome-remote-interface');
(async () => {
let client;
try {
// Connect to browser
client = await CDP();
// Extract used DevTools domains.
const {Page, Runtime} = client;
// Enable events on domains we are interested in.
await Page.enable();
await Page.navigate({url: 'https://example.com'});
await Page.loadEventFired();
// Evaluate outerHTML after page has loaded.
const expression = {expression: 'document.body.outerHTML'};
const { result } = await Runtime.evaluate(expression);
console.log(result.value);
} catch (err) {
console.error('Cannot connect to browser:', err);
} finally {
if (client) {
await client.close();
}
}
})();
Alternatvely, the Puppeteer Node.js package can be used to communicate with headless, for example:
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch({headless: 'shell'});
const page = await browser.newPage();
await page.goto('https://example.com');
const title = await page.evaluate(() => document.title);
console.log(title);
await browser.close();
})();
Resources and Documentation
Mailing list: headless-dev@chromium.org
Bug tracker: Internals>Headless
File a new bug (bit.ly/2pP6SBb)
- Runtime headless mode on Windows OS
- BeginFrame sequence numbers + acknowledgements
- Deterministic page loading for Blink
- Crash dumps for Headless Chrome
- Runtime headless mode for Chrome
- Virtual Time in Blink
- Headless Chrome architecture (Design Doc)
- Session isolation in Headless Chrome
- Headless Chrome mojo service
- Controlling BeginFrame through DevTools
- Viewport bounds and scale for screenshots
- BlinkOn 6 presentation slides