原文链接 https://mogoweb.net/307-2/
WebCore使用许多对象来表示内存中的web页面,本文描述了其中的一些主要对象以及它们之间的关系。betway官网首页 在某些情况下,对象之间的连接会断开,导致空指针引用。因此在遍历这些指针时,代码必须仔细的考虑”分离”(detached)的情形,并优雅的处理空指针。
+---------+ | Chrome | +----+----+ | +---+---+ +----------+ | Page +---->| Settings | +---+---+ +----------+ | +-------------------------- ... other Frame objects | +---+---+ +-------------+ +-------------------+ | Frame +---+ FrameLoader + | JSDOMWindowShell | +---+---+ +-------------+ +---------+---------+ / | / / Re-used after navigation / | .../....|...............................................|.......... / | / Replaced after navigation / | / | | /<------|<-- Ptrs to Frame are null after navigation[1] | | | | | +-----+-----+ +-------------+ | | | DOMWindow |<--impl--+ JSDOMWindow |<------window----+ | +-----+-----+ +-------------+ | | | |<-- Can be null for Documents created by XMLHttpRequest | | | +-----+-----+ +-------------+ +-+ Document |<--impl--+ JSDocument | +-----+-----+ +-------------+ | |<-- Can be null for DocumentType objects | +---+---+ +--------+ | Node |<---impl---| JSNode | +-------+ +--------+
[1] 导航到一个新的页面后,betway官网首页 老的DomWindow和Document指向一个空的Frame,betway官网首页 而Frame指向一个新的DomWindow和Document.