mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
constellation: Eliminate long-standing inactive code path for WebDriverData
(#38221)
Cleaning up some dead code which has been here for 9 years. They are never detected by Lint because we still initialize them as `None` but never change afterwards. Testing: No regression. --------- Signed-off-by: Euclid Ye <euclid.ye@huawei.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
7f6d4825cf
commit
d2e5137201
5 changed files with 13 additions and 53 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1467,7 +1467,6 @@ dependencies = [
|
|||
"servo_config",
|
||||
"servo_rand",
|
||||
"servo_url",
|
||||
"stylo_traits",
|
||||
"tracing",
|
||||
"webgpu",
|
||||
"webgpu_traits",
|
||||
|
|
|
@ -47,7 +47,6 @@ serde = { workspace = true }
|
|||
servo_config = { path = "../config" }
|
||||
servo_rand = { path = "../rand" }
|
||||
servo_url = { path = "../url" }
|
||||
stylo_traits = { workspace = true }
|
||||
tracing = { workspace = true, optional = true }
|
||||
webgpu = { path = "../webgpu" }
|
||||
webgpu_traits = { workspace = true }
|
||||
|
|
|
@ -133,7 +133,7 @@ use embedder_traits::{
|
|||
FocusSequenceNumber, InputEvent, JSValue, JavaScriptEvaluationError, JavaScriptEvaluationId,
|
||||
KeyboardEvent, MediaSessionActionType, MediaSessionEvent, MediaSessionPlaybackState,
|
||||
MouseButton, MouseButtonAction, MouseButtonEvent, Theme, ViewportDetails, WebDriverCommandMsg,
|
||||
WebDriverCommandResponse, WebDriverLoadStatus,
|
||||
WebDriverCommandResponse,
|
||||
};
|
||||
use euclid::Size2D;
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
|
@ -159,7 +159,6 @@ use serde::{Deserialize, Serialize};
|
|||
use servo_config::{opts, pref};
|
||||
use servo_rand::{Rng, ServoRng, SliceRandom, random};
|
||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||
use style_traits::CSSPixel;
|
||||
#[cfg(feature = "webgpu")]
|
||||
use webgpu::swapchain::WGPUImageMap;
|
||||
#[cfg(feature = "webgpu")]
|
||||
|
@ -397,8 +396,8 @@ pub struct Constellation<STF, SWF> {
|
|||
/// and the namespaces are allocated by the constellation.
|
||||
next_pipeline_namespace_id: PipelineNamespaceId,
|
||||
|
||||
/// Bits of state used to interact with the webdriver implementation
|
||||
webdriver: WebDriverData,
|
||||
/// An [`IpcSender`] to forward responses from the `ScriptThread` to the WebDriver server.
|
||||
webdriver_input_command_reponse_sender: Option<IpcSender<WebDriverCommandResponse>>,
|
||||
|
||||
/// Document states for loaded pipelines (used only when writing screenshots).
|
||||
document_states: HashMap<PipelineId, DocumentState>,
|
||||
|
@ -506,24 +505,6 @@ pub struct InitialConstellationState {
|
|||
pub user_content_manager: UserContentManager,
|
||||
}
|
||||
|
||||
/// Data needed for webdriver
|
||||
struct WebDriverData {
|
||||
load_channel: Option<(PipelineId, IpcSender<WebDriverLoadStatus>)>,
|
||||
resize_channel: Option<IpcSender<Size2D<f32, CSSPixel>>>,
|
||||
// Forward responses from the script thread to the webdriver server.
|
||||
input_command_response_sender: Option<IpcSender<WebDriverCommandResponse>>,
|
||||
}
|
||||
|
||||
impl WebDriverData {
|
||||
fn new() -> WebDriverData {
|
||||
WebDriverData {
|
||||
load_channel: None,
|
||||
resize_channel: None,
|
||||
input_command_response_sender: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// When we are running reftests, we save an image to compare against a reference.
|
||||
/// This enum gives the possible states of preparing such an image.
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -685,7 +666,7 @@ where
|
|||
time_profiler_chan: state.time_profiler_chan,
|
||||
mem_profiler_chan: state.mem_profiler_chan.clone(),
|
||||
phantom: PhantomData,
|
||||
webdriver: WebDriverData::new(),
|
||||
webdriver_input_command_reponse_sender: None,
|
||||
document_states: HashMap::new(),
|
||||
#[cfg(feature = "webgpu")]
|
||||
webrender_wgpu,
|
||||
|
@ -1352,7 +1333,7 @@ where
|
|||
// Create a new top level browsing context. Will use response_chan to return
|
||||
// the browsing context id.
|
||||
EmbedderToConstellationMessage::NewWebView(url, webview_id, viewport_details) => {
|
||||
self.handle_new_top_level_browsing_context(url, webview_id, viewport_details, None);
|
||||
self.handle_new_top_level_browsing_context(url, webview_id, viewport_details);
|
||||
},
|
||||
// Close a top level browsing context.
|
||||
EmbedderToConstellationMessage::CloseWebView(webview_id) => {
|
||||
|
@ -1473,7 +1454,7 @@ where
|
|||
}
|
||||
},
|
||||
EmbedderToConstellationMessage::SetWebDriverResponseSender(sender) => {
|
||||
self.webdriver.input_command_response_sender = Some(sender);
|
||||
self.webdriver_input_command_reponse_sender = Some(sender);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1874,14 +1855,14 @@ where
|
|||
self.handle_finish_javascript_evaluation(evaluation_id, result)
|
||||
},
|
||||
ScriptToConstellationMessage::WebDriverInputComplete(msg_id) => {
|
||||
if let Some(ref reply_sender) = self.webdriver.input_command_response_sender {
|
||||
if let Some(ref reply_sender) = self.webdriver_input_command_reponse_sender {
|
||||
reply_sender
|
||||
.send(WebDriverCommandResponse { id: msg_id })
|
||||
.unwrap_or_else(|_| {
|
||||
warn!("Failed to send WebDriverInputComplete {:?}", msg_id);
|
||||
});
|
||||
} else {
|
||||
warn!("No WebDriver input_command_response_sender");
|
||||
warn!("No webdriver_input_command_reponse_sender");
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -2945,7 +2926,6 @@ where
|
|||
url: ServoUrl,
|
||||
webview_id: WebViewId,
|
||||
viewport_details: ViewportDetails,
|
||||
response_sender: Option<IpcSender<WebDriverLoadStatus>>,
|
||||
) {
|
||||
let pipeline_id = PipelineId::new();
|
||||
let browsing_context_id = BrowsingContextId::from(webview_id);
|
||||
|
@ -3002,10 +2982,6 @@ where
|
|||
}),
|
||||
viewport_details,
|
||||
});
|
||||
|
||||
if let Some(response_sender) = response_sender {
|
||||
self.webdriver.load_channel = Some((pipeline_id, response_sender));
|
||||
}
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
|
@ -3628,18 +3604,6 @@ where
|
|||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn handle_load_complete_msg(&mut self, webview_id: WebViewId, pipeline_id: PipelineId) {
|
||||
let mut webdriver_reset = false;
|
||||
if let Some((expected_pipeline_id, ref reply_chan)) = self.webdriver.load_channel {
|
||||
if expected_pipeline_id == pipeline_id {
|
||||
debug!("Sending load for {:?} to WebDriver", expected_pipeline_id);
|
||||
let _ = reply_chan.send(WebDriverLoadStatus::Complete);
|
||||
webdriver_reset = true;
|
||||
}
|
||||
}
|
||||
if webdriver_reset {
|
||||
self.webdriver.load_channel = None;
|
||||
}
|
||||
|
||||
if let Some(pipeline) = self.pipelines.get_mut(&pipeline_id) {
|
||||
debug!("{}: Marking as loaded", pipeline_id);
|
||||
pipeline.completely_loaded = true;
|
||||
|
@ -4930,10 +4894,6 @@ where
|
|||
|
||||
let browsing_context_id = BrowsingContextId::from(webview_id);
|
||||
self.resize_browsing_context(new_viewport_details, size_type, browsing_context_id);
|
||||
|
||||
if let Some(response_sender) = self.webdriver.resize_channel.take() {
|
||||
let _ = response_sender.send(new_viewport_details.size);
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when the window exits from fullscreen mode
|
||||
|
|
|
@ -1103,8 +1103,10 @@ fn handle_send_keys_file(
|
|||
Ok(false)
|
||||
}
|
||||
|
||||
/// Implementing step 5 - 8 of Element Send Keys. This function will send a boolean
|
||||
/// back to webdriver_server, indicating whether the dispatching of the key and
|
||||
/// Implementing step 5 - 7, plus part of step 8 of "Element Send Keys"
|
||||
/// where element is input element in the file upload state.
|
||||
/// This function will send a boolean back to webdriver_server,
|
||||
/// indicating whether the dispatching of the key and
|
||||
/// composition event is still needed or not.
|
||||
pub(crate) fn handle_will_send_keys(
|
||||
documents: &DocumentCollection,
|
||||
|
|
|
@ -243,7 +243,7 @@ pub enum WebDriverScriptCommand {
|
|||
IsEnabled(String, IpcSender<Result<bool, ErrorStatus>>),
|
||||
IsSelected(String, IpcSender<Result<bool, ErrorStatus>>),
|
||||
GetTitle(IpcSender<String>),
|
||||
/// Match the element type before sending the event for webdriver `element send keys`.
|
||||
/// Deal with the case of input element for Element Send Keys, which does not send keys.
|
||||
WillSendKeys(String, String, bool, IpcSender<Result<bool, ErrorStatus>>),
|
||||
IsDocumentReadyStateComplete(IpcSender<bool>),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue