Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/browser-rows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ jobs:
# The harness builds Rivet itself, with the test flags that keep sync and sign-in off.
./scripts/tests/windows-features.ps1 -Browsers $name `
-Executable "${{ steps.build.outputs.executable }}" -OutDir $features
./tools/chrome-builds.exe gate (Join-Path $features "results.json") $name
# A check of a feature the row turns off for this build is not required; the row ships with
# that feature off, and the gate prints a note for it.
./tools/chrome-builds.exe gate (Join-Path $features "results.json") $name "$temp/row.json"
if ($LASTEXITCODE -ne 0) { throw "a feature check failed or could not run; results.json lists which" }
Set-Content (Join-Path $temp "session/features-passed") "${{ matrix.build.version }}"

Expand Down Expand Up @@ -538,6 +540,10 @@ jobs:
$body += "The symbol server had no PDB for this build, so the row was made from the fingerprints of the $($report.prior_version) row: $($report.fingerprinted.Count) of $($report.addresses) addresses matched exactly one place. When the PDB appears, the row job makes the row again from it and compares the two.`n`n"
}
$body += (($report.review | ForEach-Object { "- $_" }) -join "`n")
if ($report.switched_off.Count -gt 0) {
$body += "`n`nThese features are off in this row, because a value they need could not be read from this build:`n`n"
$body += (($report.switched_off | ForEach-Object { "- $_" }) -join "`n")
}
gh pr create --draft --base develop --head $branch --title "Feat: Propose a row for ${{ matrix.build.browser }} ${{ matrix.build.version }}" --body $body
gh workflow run test.yml --ref $branch

Expand Down
14 changes: 10 additions & 4 deletions rivet/platform/windows/src/bin/chrome-builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ fn main() -> ExitCode {
["pending", stable, beta, edge, brave, known] => {
pending(Path::new(stable), Path::new(beta), Path::new(edge), Path::new(brave), Path::new(known))
}
["gate", results, browser] => gate(Path::new(results), browser),
["gate", results, browser] => gate(Path::new(results), browser, None),
["gate", results, browser, row] => gate(Path::new(results), browser, Some(Path::new(row))),
["fingerprint", row, module, out] => fingerprint(Path::new(row), Path::new(module), Path::new(out)),
["release-sign", version, signed, files @ ..] => release_sign(version, Path::new(signed), files),
["release-check", signed, file] => release_check(Path::new(signed), Path::new(file)),
Expand All @@ -123,7 +124,7 @@ fn main() -> ExitCode {
["table-withdraw", published, signed, builds @ ..] if !builds.is_empty() => {
table_withdraw(Path::new(published), Path::new(signed), builds)
}
_ => Err("usage: chrome-builds pdb-key <module> | extract <module> <pdb-directory> <browser> <version> <table> [frame-class] | port <prior-row.json> <prior.pdb> <new.pdb> <new-module> <version> <row.json> <report.json> | find <prior-row.json> <prior.pdb> <prior-module|-> <new-module> <version> <channel> <download> <row.json> <report.json> | pdb-check <table.json> <browser> <version> <pdb-row.json> | pending <chrome-stable.json> <chrome-beta.json> <edge.json> <brave.json> <known.json> | gate <results.json> <browser> | fingerprint <row.json> <module> <row-out.json> | release-sign <version> <signed-file> <file>... | release-check <signed-file> <file> | table-key | table-add <table.json> <row.json> <module> | table-read <signed-file> <out.json> | table-merge <table.json> <part.json>... | table-sign <table.json> <signed-file> [published-file] | table-withdraw <published-file> <signed-file> <browser@version>...".into()),
_ => Err("usage: chrome-builds pdb-key <module> | extract <module> <pdb-directory> <browser> <version> <table> [frame-class] | port <prior-row.json> <prior.pdb> <new.pdb> <new-module> <version> <row.json> <report.json> | find <prior-row.json> <prior.pdb> <prior-module|-> <new-module> <version> <channel> <download> <row.json> <report.json> | pdb-check <table.json> <browser> <version> <pdb-row.json> | pending <chrome-stable.json> <chrome-beta.json> <edge.json> <brave.json> <known.json> | gate <results.json> <browser> [row.json] | fingerprint <row.json> <module> <row-out.json> | release-sign <version> <signed-file> <file>... | release-check <signed-file> <file> | table-key | table-add <table.json> <row.json> <module> | table-read <signed-file> <out.json> | table-merge <table.json> <part.json>... | table-sign <table.json> <signed-file> [published-file] | table-withdraw <published-file> <signed-file> <browser@version>...".into()),
};
match result {
Ok(()) => ExitCode::SUCCESS,
Expand Down Expand Up @@ -878,13 +879,18 @@ mod symbols {
}

/// Refuses a browser that did not pass every feature check, so it is never listed as supported.
fn gate(results: &Path, browser: &str) -> Result<(), String> {
/// The row is the one being published: a check of a feature it turns off is not required.
fn gate(results: &Path, browser: &str, row: Option<&Path>) -> Result<(), String> {
let row = match row {
Some(path) => json_file(path)?,
None => serde_json::Value::Null,
};
let text = String::from_utf8(read(results)?)
.map_err(|error| format!("the feature results are not text: {error}"))?;
// PowerShell writes UTF-8 with a byte order mark.
let results: serde_json::Value = serde_json::from_str(text.trim_start_matches('\u{feff}'))
.map_err(|error| format!("the feature results are not JSON: {error}"))?;
let notes = row_watch::publish_gate(&results, browser)
let notes = row_watch::publish_gate_for_row(&results, browser, &row)
.map_err(|reasons| format!("{browser} is not supported: {}", reasons.join("; ")))?;
for note in notes {
println!("note: {note}");
Expand Down
55 changes: 55 additions & 0 deletions rivet/platform/windows/src/command_ids.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//! Chromium's browser command ids that Rivet runs, per Chromium milestone.
//!
//! A browser window runs these ids from its own `WM_COMMAND`, as its own menu and keys do, so they
//! need no address or member of the build. They are defined in `chrome/app/chrome_command_ids.h`,
//! and each value below was read from that header at the milestone's branch on
//! chromium.googlesource.com (`refs/branch-heads/<branch>/chrome/app/chrome_command_ids.h`). They
//! are public and stable, so they are not values of a build row: the row generator and the
//! runtime both take them from here. A milestone without a read value has no id, and what needs it
//! stays off, because a wrong id runs another command.

/// `IDC_DEV_TOOLS_INSPECT` and `IDC_DEV_TOOLS_CONSOLE` per Chromium milestone, with the branch the
/// header was read at. They are the commands of the Ctrl+Shift+C and Ctrl+Shift+J keys.
pub const DEV_TOOLS: &[(u16, u16, u32, u32)] = &[
(150, 7871, 40023, 40005),
(151, 7922, 40023, 40005),
(152, 7977, 40023, 40005),
(153, 8010, 40023, 40005),
(154, 8037, 40023, 40005),
(155, 8059, 40023, 40005),
(156, 8078, 40023, 40005),
(157, 8103, 40023, 40005),
(158, 8127, 40023, 40005),
(159, 8154, 40023, 40005),
];

/// The paths of a row's values that are these command ids. A row generator never carries them:
/// it writes the value this table gives, or zero for a milestone it does not know.
pub const ROW_PATHS: &[&str] = &["toolbar.dev.inspect", "toolbar.dev.console"];

/// The inspect and console command ids of a Chromium milestone.
pub fn dev_tools(milestone: u16) -> Option<(u32, u32)> {
DEV_TOOLS
.iter()
.find(|(known, _, _, _)| *known == milestone)
.map(|(_, _, inspect, console)| (*inspect, *console))
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn fr11_developer_commands_come_from_chromium_command_ids() {
for milestone in 150..=159u16 {
assert_eq!(dev_tools(milestone), Some((40023, 40005)), "{milestone}");
}
// An unread milestone never borrows a neighbour's value.
assert_eq!(dev_tools(149), None);
assert_eq!(dev_tools(160), None);
// Each milestone appears once, in branch order.
assert!(DEV_TOOLS
.windows(2)
.all(|pair| pair[0].0 + 1 == pair[1].0 && pair[0].1 < pair[1].1));
}
}
2 changes: 2 additions & 0 deletions rivet/platform/windows/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

pub mod background;
pub mod chrome_build;
pub mod command_ids;
pub mod control;
pub mod focus;
pub mod hold;
pub mod row_features;
pub mod row_port;
pub mod row_recipe;
pub mod row_resolve;
Expand Down
Loading
Loading