pub enum ServoEvent {
Show 13 variants
Console {
target_id: String,
level: ConsoleLevel,
text: String,
url: Option<String>,
line: Option<u32>,
column: Option<u32>,
},
PageError {
target_id: String,
text: String,
url: Option<String>,
line: Option<u32>,
column: Option<u32>,
stack: Option<String>,
},
NetworkRequest {
target_id: String,
request_id: String,
url: String,
method: String,
headers: HashMap<String, String>,
post_data: Option<Vec<u8>>,
resource_type: String,
frame_id: String,
},
NetworkResponse {
target_id: String,
request_id: String,
url: String,
status: u16,
status_text: String,
headers: HashMap<String, String>,
mime_type: String,
remote_ip: Option<String>,
},
NetworkLoadingFinish {
target_id: String,
request_id: String,
encoded_data_length: u64,
},
NetworkLoadingFail {
target_id: String,
request_id: String,
error_text: String,
canceled: bool,
},
DomAttributeModified {
target_id: String,
node_id: i64,
name: String,
value: String,
},
DomCharacterDataModified {
target_id: String,
node_id: i64,
old_value: String,
new_value: String,
},
ScriptParsed {
target_id: String,
script_id: String,
url: String,
start_line: u32,
start_column: u32,
end_line: u32,
end_column: u32,
source_map_url: Option<String>,
},
FrameNavigated {
target_id: String,
frame_id: String,
url: String,
name: Option<String>,
},
FrameStartedLoading {
target_id: String,
frame_id: String,
},
FrameStoppedLoading {
target_id: String,
frame_id: String,
},
TimelineMarker {
target_id: String,
name: String,
start_time: f64,
end_time: f64,
},
}Expand description
servo 推送给 CDP client 的所有事件类型(REQ-BAO-API-003 的 7 类)。
由 EventSubscriber 在 servo delegate 回调中构造,push 到 mpsc channel,
由 InMemoryTransport::recv_event 调用 translate 转换为 CdpEvent。
§字段命名规范
所有字段名与 CDP 协议规范(https://chromedevtools.github.io/devtools-protocol/)
中的对应字段 camelCase 对齐,便于 translate 函数直接序列化。
@trace REQ-BAO-API-003 [level:library]
Variants§
Console
servo console.{log,info,warn,error,debug,trace} 消息。
→ Log.entryAdded
@trace REQ-BAO-API-003 [event:Console]
Fields
level: ConsoleLevelPageError
servo 页面错误(包括 JS 异常、CSS 解析错误、控制台 error)。
→ Runtime.exceptionThrown
@trace REQ-BAO-API-003 [event:PageError]
Fields
NetworkRequest
网络请求开始。
→ Network.requestWillBeSent
@trace REQ-BAO-API-003 [event:NetworkEvent]
Fields
NetworkResponse
网络响应到达。
→ Network.responseReceived
@trace REQ-BAO-API-003 [event:NetworkEvent]
Fields
NetworkLoadingFinish
网络请求完成(成功)。
→ Network.loadingFinished
@trace REQ-BAO-API-003 [event:NetworkEvent]
NetworkLoadingFail
网络请求失败。
→ Network.loadingFailed
@trace REQ-BAO-API-003 [event:NetworkEvent]
DomAttributeModified
DOM 属性变更。
→ DOM.attributeModified
@trace REQ-BAO-API-003 [event:DomMutation]
DomCharacterDataModified
DOM character data 变更。
→ DOM.characterDataModified
@trace REQ-BAO-API-003 [event:DomMutation]
ScriptParsed
脚本编译完成(servo ScriptThread 解析出新 script element 或 inline script)。
→ Debugger.scriptParsed
@trace REQ-BAO-API-003 [event:SourceInfo]
Fields
frame 导航完成。
→ Page.frameNavigated
@trace REQ-BAO-API-003 [event:FrameInfo]
FrameStartedLoading
frame 开始加载。
→ Page.frameStartedLoading
@trace REQ-BAO-API-003 [event:FrameInfo]
FrameStoppedLoading
frame 停止加载。
→ Page.frameStoppedLoading
@trace REQ-BAO-API-003 [event:FrameInfo]
TimelineMarker
servo 性能 timeline 标记。
→ Performance.metrics
@trace REQ-BAO-API-003 [event:TimelineMarker]
Implementations§
Trait Implementations§
Source§impl Clone for ServoEvent
impl Clone for ServoEvent
Source§fn clone(&self) -> ServoEvent
fn clone(&self) -> ServoEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ServoEvent
impl RefUnwindSafe for ServoEvent
impl Send for ServoEvent
impl Sync for ServoEvent
impl Unpin for ServoEvent
impl UnsafeUnpin for ServoEvent
impl UnwindSafe for ServoEvent
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.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,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
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