expose a new script event that updates the is_online value stored in ScriptThread

Signed-off-by: TG <ebiritg@gmail.com>
This commit is contained in:
TG 2025-05-22 02:55:46 +01:00
parent f30c759c94
commit fbcd90797c
2 changed files with 3 additions and 0 deletions

View file

@ -92,6 +92,7 @@ impl MixedMessage {
ScriptThreadMessage::SetWebGPUPort(..) => None, ScriptThreadMessage::SetWebGPUPort(..) => None,
ScriptThreadMessage::SetScrollStates(id, ..) => Some(*id), ScriptThreadMessage::SetScrollStates(id, ..) => Some(*id),
ScriptThreadMessage::EvaluateJavaScript(id, _, _) => Some(*id), ScriptThreadMessage::EvaluateJavaScript(id, _, _) => Some(*id),
ScriptThreadMessage::SetNetWorkState(..) => None,
}, },
MixedMessage::FromScript(inner_msg) => match inner_msg { MixedMessage::FromScript(inner_msg) => match inner_msg {
MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, _, pipeline_id, _)) => { MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, _, pipeline_id, _)) => {

View file

@ -248,6 +248,8 @@ pub enum ScriptThreadMessage {
/// Evaluate the given JavaScript and return a result via a corresponding message /// Evaluate the given JavaScript and return a result via a corresponding message
/// to the Constellation. /// to the Constellation.
EvaluateJavaScript(PipelineId, JavaScriptEvaluationId, String), EvaluateJavaScript(PipelineId, JavaScriptEvaluationId, String),
/// Parameter indicates if online (true) or offline (false)
SetNetWorkState(bool),
} }
impl fmt::Debug for ScriptThreadMessage { impl fmt::Debug for ScriptThreadMessage {