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
4 changes: 3 additions & 1 deletion rivet/platform/windows/src/bin/chrome-builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ fn find(
drop(old);
let bytes = read(module)?;
let pe = PeFile::parse(&bytes).ok_or("not a 64-bit PE image")?;
// A class table of a views class is also found again by the class name its symbol gives.
let classes = row_port::class_names(&named);
let (mut row, mut report) =
row_port::find_candidate(&prior, &prints, prior_pe.as_ref(), version, &pe);
row_port::find_candidate(&prior, &prints, prior_pe.as_ref(), &classes, version, &pe);
// No symbols name `screen_origin` here: a prior row without it gives a row without it.
row_port::seed_screen_origin(&mut row, &[], &pe, &mut report);
report.review.extend(row_port::hand_only_review(&prior));
Expand Down
45 changes: 45 additions & 0 deletions rivet/platform/windows/src/command_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ pub const DEV_TOOLS: &[(u16, u16, u32, u32)] = &[
(159, 8154, 40023, 40005),
];

/// `IDC_NEW_TAB` per Chromium milestone, with the branch the header was read at. It is the command
/// of Ctrl+T and of the browser's own new tab button. Milestone 143 is the base of Samsung
/// Internet 30.
pub const NEW_TAB: &[(u16, u16, usize)] = &[
(143, 7499, 34014),
(150, 7871, 34014),
(151, 7922, 34014),
(152, 7977, 34014),
(153, 8010, 34014),
(154, 8037, 34014),
(155, 8059, 34014),
(156, 8078, 34014),
(157, 8103, 34014),
(158, 8127, 34014),
(159, 8154, 34014),
];

/// The new tab command id of a Chromium milestone.
pub fn new_tab(milestone: u16) -> Option<usize> {
NEW_TAB
.iter()
.find(|(known, _, _)| *known == milestone)
.map(|(_, _, id)| *id)
}

/// 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"];
Expand Down Expand Up @@ -52,4 +77,24 @@ mod tests {
.windows(2)
.all(|pair| pair[0].0 + 1 == pair[1].0 && pair[0].1 < pair[1].1));
}

#[test]
fn nfr6_the_new_tab_command_comes_from_chromium_command_ids() {
for milestone in (150..=159u16).chain([143]) {
assert_eq!(new_tab(milestone), Some(34014), "{milestone}");
}
// An unread milestone never borrows a neighbour's value.
for milestone in [142, 144, 149, 160] {
assert_eq!(new_tab(milestone), None, "{milestone}");
}
assert!(NEW_TAB
.windows(2)
.all(|pair| pair[0].0 < pair[1].0 && pair[0].1 < pair[1].1));
// The same branches as the developer commands, which were read from the same headers.
for (milestone, branch, _) in NEW_TAB {
if let Some(dev) = DEV_TOOLS.iter().find(|dev| dev.0 == *milestone) {
assert_eq!(dev.1, *branch, "{milestone}");
}
}
}
}
1 change: 1 addition & 0 deletions rivet/platform/windows/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod command_ids;
pub mod control;
pub mod focus;
pub mod hold;
pub mod row_class;
pub mod row_features;
pub mod row_port;
pub mod row_recipe;
Expand Down
Loading
Loading