pub struct FrameGraph {
pub nodes: Vec<FrameNode>,
}Expand description
The full graph for a page snapshot.
Children are indexed via FrameGraph::children which scans
the nodes Vec — fine for the typical <50-node frame trees we
see in the wild; would warrant a parent→children index for
1000+-frame pages (which don’t exist in practice).
Fields§
§nodes: Vec<FrameNode>Implementations§
Source§impl FrameGraph
impl FrameGraph
Sourcepub async fn snapshot(page: &Page) -> Result<Self>
pub async fn snapshot(page: &Page) -> Result<Self>
Build a graph from the current state of page.
Calls page.frames() once + per-frame title/URL evals.
The captcha-marker scan runs the same selector list as
[crate::solver::oracle::take_snapshot] uses for outcome
classification, so the two stay in sync by reading the
same predicates.
Sourcepub fn any_captcha_marker(&self) -> bool
pub fn any_captcha_marker(&self) -> bool
True iff the graph has any node with has_captcha_marker.
Cheap pre-check before more expensive walks.
Sourcepub fn children(&self, parent_idx: usize) -> Vec<usize>
pub fn children(&self, parent_idx: usize) -> Vec<usize>
Indices of all child nodes of parent_idx.
Linear scan; acceptable for typical tree sizes (<50 nodes). If we ever ship a graph with hundreds of nodes, replace with a precomputed parent→children index.
Sourcepub fn bfs(&self) -> Vec<usize>
pub fn bfs(&self) -> Vec<usize>
BFS from the root, returning node indices in visit order.
Handy for “do this thing in every frame, top-down” without open-coding the queue management at every call site.
Sourcepub fn deepest_captcha(&self) -> Option<usize>
pub fn deepest_captcha(&self) -> Option<usize>
Find the deepest node that has a captcha marker. Returns
None when no node carries one.
Useful for “walk OUTWARD from the captcha to find the nearest enclosing token field” — once you have the captcha node, traverse parent links upward until the token shows up.
Sourcepub fn ancestors_inclusive(&self, node_idx: usize) -> Vec<usize>
pub fn ancestors_inclusive(&self, node_idx: usize) -> Vec<usize>
All node indices on the path from node_idx up to the root,
inclusive of both endpoints. Empty when node_idx is OOB.
Use this when a captcha solve produces a token in a deeply-
nested iframe and you need to relay it up the tree via
postMessage — the path is the relay route.
Trait Implementations§
Source§impl Clone for FrameGraph
impl Clone for FrameGraph
Source§fn clone(&self) -> FrameGraph
fn clone(&self) -> FrameGraph
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FrameGraph
impl Debug for FrameGraph
Source§impl Default for FrameGraph
impl Default for FrameGraph
Source§fn default() -> FrameGraph
fn default() -> FrameGraph
Auto Trait Implementations§
impl Freeze for FrameGraph
impl RefUnwindSafe for FrameGraph
impl Send for FrameGraph
impl Sync for FrameGraph
impl Unpin for FrameGraph
impl UnsafeUnpin for FrameGraph
impl UnwindSafe for FrameGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more