Handler

Struct Handler 

Source
pub(crate) struct Handler {
    pub(crate) load_status_receiver: RoutedReceiver<WebDriverLoadStatus>,
    pub(crate) load_status_sender: GenericSender<WebDriverLoadStatus>,
    pub(crate) session: Option<WebDriverSession>,
    pub(crate) embedder_sender: Sender<WebDriverCommandMsg>,
    pub(crate) event_loop_waker: Box<dyn EventLoopWaker>,
    pub(crate) pending_input_event_receivers: RefCell<Vec<Receiver<()>>>,
    pub(crate) num_pending_actions: Cell<u32>,
}

Fields§

§load_status_receiver: RoutedReceiver<WebDriverLoadStatus>

The threaded receiver on which we can block for a load-status. It will receive messages sent on the load_status_sender, and forwarded by the IPC router.

§load_status_sender: GenericSender<WebDriverLoadStatus>

The IPC sender which we can clone and pass along to the constellation, for it to send us a load-status. Messages sent on it will be forwarded to the load_status_receiver.

§session: Option<WebDriverSession>§embedder_sender: Sender<WebDriverCommandMsg>

A Sender that sends messages to the embedder that this `WebDriver instance controls. In addition to sending a message, we must always wake up the embedder’s event loop so it knows that more messages are available for processing.

§event_loop_waker: Box<dyn EventLoopWaker>

An EventLoopWaker which is used to wake up the embedder event loop.

§pending_input_event_receivers: RefCell<Vec<Receiver<()>>>

A list of Receivers that are used to track when input events are handled in the DOM. Once these receivers receive a response, we know that the event has been handled.

TODO: Once we upgrade crossbeam-channel this can be replaced with a WaitGroup.

§num_pending_actions: Cell<u32>

Number of pending actions of which WebDriver is waiting for responses.

Implementations§

Source§

impl Handler

Source

pub(crate) fn dispatch_actions( &mut self, actions_by_tick: Vec<Vec<(String, ActionItem)>>, browsing_context: BrowsingContextId, ) -> Result<(), ErrorStatus>

https://w3c.github.io/webdriver/#dfn-dispatch-actions https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner For Servo, “dispatch actions” is identical to “dispatch actions inner”, as they are only different for a session that can run commands in parallel.

Source

fn wait_for_user_agent_handling_complete(&self) -> Result<(), ErrorStatus>

Source

fn dispatch_tick_actions( &mut self, tick_actions: &Vec<(String, ActionItem)>, tick_duration: u64, ) -> Result<(), ErrorStatus>

Source

fn dispatch_pause_action(&mut self, source_id: &str)

Source

fn dispatch_keydown_action(&mut self, source_id: &str, action: &KeyDownAction)

Source

fn dispatch_keyup_action(&mut self, source_id: &str, action: &KeyUpAction)

Source

fn dispatch_pointerdown_action( &mut self, source_id: &str, action: &PointerDownAction, )

Source

fn dispatch_pointerup_action( &mut self, source_id: &str, action: &PointerUpAction, )

Source

fn dispatch_pointermove_action( &mut self, source_id: &str, action: &PointerMoveAction, tick_duration: u64, ) -> Result<(), ErrorStatus>

Source

fn perform_pointer_move( &mut self, source_id: &str, duration: u64, start_x: f64, start_y: f64, target_x: f64, target_y: f64, tick_start: Instant, )

Source

fn dispatch_scroll_action( &self, source_id: &str, action: &WheelScrollAction, tick_duration: u64, ) -> Result<(), ErrorStatus>

Source

fn perform_scroll( &self, duration: u64, x: f64, y: f64, target_delta_x: f64, target_delta_y: f64, curr_delta_x: f64, curr_delta_y: f64, tick_start: Instant, )

Source

fn check_viewport_bound(&self, x: f64, y: f64) -> Result<(), ErrorStatus>

Verify that the given coordinates are within the boundary of the viewport. If x or y is less than 0 or greater than the width of the viewport in CSS pixels, then return error with error code move target out of bounds.

Source

fn get_origin_relative_coordinates( &self, origin: &PointerOrigin, x_offset: f64, y_offset: f64, source_id: &str, ) -> Result<(f64, f64), ErrorStatus>

Source

fn get_element_in_view_center_point( &self, web_element: &WebElement, ) -> Result<(i64, i64), ErrorStatus>

Source

pub(crate) fn extract_an_action_sequence( &mut self, actions: Vec<ActionSequence>, ) -> Vec<Vec<(String, ActionItem)>>

Source

fn process_an_input_source_action_sequence( &mut self, action_sequence: ActionSequence, ) -> Vec<ActionItem>

Source

fn input_state_table_mut(&mut self) -> &mut HashMap<String, InputSourceState>

Source

fn get_pointer_input_state_mut( &mut self, source_id: &str, ) -> &mut PointerInputState

Source

fn get_pointer_input_state(&self, source_id: &str) -> &PointerInputState

Source§

impl Handler

Source§

impl Handler

Source

pub(crate) fn create_session( &mut self, capabilities: &mut Map<String, Value>, servo_capabilities: &ServoCapabilities, ) -> WebDriverResult<Uuid>

Source§

impl Handler

Source§

impl Handler

Source

pub(crate) fn new( embedder_sender: Sender<WebDriverCommandMsg>, event_loop_waker: Box<dyn EventLoopWaker>, ) -> Handler

Source

pub(crate) fn browsing_context_id(&self) -> WebDriverResult<BrowsingContextId>

Source

pub(crate) fn webview_id(&self) -> WebDriverResult<WebViewId>

Source

pub(crate) fn send_input_event_to_embedder(&self, input_event: InputEvent)

Source

pub(crate) fn send_blocking_input_event_to_embedder( &self, input_event: InputEvent, )

Source

pub(crate) fn send_message_to_embedder( &self, msg: WebDriverCommandMsg, ) -> WebDriverResult<()>

Source

pub(crate) fn add_load_status_sender(&self) -> WebDriverResult<()>

Source

pub(crate) fn clear_load_status_sender(&self) -> WebDriverResult<()>

Source

pub(crate) fn verified_webview_id(&self) -> WebViewId

Source

pub(crate) fn focused_webview_id(&self) -> WebDriverResult<Option<WebViewId>>

Source

pub(crate) fn session(&self) -> WebDriverResult<&WebDriverSession>

Source

pub(crate) fn session_mut(&mut self) -> WebDriverResult<&mut WebDriverSession>

Source

pub(crate) fn handle_new_session( &mut self, parameters: &NewSessionParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_delete_session( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_status(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn browsing_context_script_command( &self, cmd_msg: WebDriverScriptCommand, verify: VerifyBrowsingContextIsOpen, ) -> WebDriverResult<()>

Send command to Script Thread with session’s current browsing context. If verify is VerifyBrowsingContextIsOpen::Yes, it would verify the existence of browsing context before sending.

Source

pub(crate) fn top_level_script_command( &self, cmd_msg: WebDriverScriptCommand, verify: VerifyBrowsingContextIsOpen, ) -> WebDriverResult<()>

Send command to Script Thread with session’s current top-level browsing context. If verify is VerifyBrowsingContextIsOpen::Yes, it would verify the existence of top-level browsing context before sending.

Source

pub(crate) fn handle_get( &mut self, parameters: &GetParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn wait_document_ready( &self, timeout: Option<u64>, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn wait_for_navigation_complete( &self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn wait_for_navigation(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_current_url(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_window_rect( &self, verify: VerifyBrowsingContextIsOpen, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_set_window_rect( &self, params: &WindowRectParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_maximize_window( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_is_enabled( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_is_selected( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_go_back(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_go_forward(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_refresh(&mut self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_title(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_window_handle( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_window_handles( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn get_window_handle( &mut self, webview_id: WebViewId, ) -> Option<String>

Source

pub(crate) fn get_window_handles(&self) -> Vec<String>

Source

pub(crate) fn get_all_webview_ids(&self) -> Vec<WebViewId>

Source

pub(crate) fn handle_close_window( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_new_window( &mut self, _parameters: &NewWindowParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_switch_to_frame( &mut self, parameters: &SwitchToFrameParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_switch_to_parent_frame( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_switch_to_window( &mut self, parameters: &SwitchToWindowParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn switch_to_frame( &mut self, frame_id: WebDriverFrameId, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_find_element( &self, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn implicit_wait<T>( &self, callback: impl Fn() -> Result<(bool, T), (bool, WebDriverError)>, ) -> Result<T, WebDriverError>

The boolean in callback result indicates whether implicit_wait can early return before timeout with current result.

Source

pub(crate) fn handle_find_elements( &self, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_find_element_from_element( &self, element: &WebElement, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_find_elements_from_element( &self, element: &WebElement, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_find_elements_from_shadow_root( &self, shadow_root: &ShadowRoot, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_find_element_from_shadow_root( &self, shadow_root: &ShadowRoot, parameters: &LocatorParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_get_shadow_root( &self, element: WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_rect( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_text( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_active_element(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_computed_role( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_tag_name( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_attribute( &self, element: &WebElement, name: &str, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_property( &self, element: &WebElement, name: &str, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_css( &self, element: &WebElement, name: &str, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_get_cookies(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_delete_cookies(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_get_timeouts( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_set_timeouts( &mut self, parameters: &TimeoutsParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_get_page_source( &self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_perform_actions( &mut self, parameters: ActionsParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_release_actions( &mut self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_execute_script( &self, parameters: JavascriptCommandParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_execute_async_script( &self, parameters: JavascriptCommandParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn javascript_evaluation_result_to_webdriver_response( &self, result: WebDriverJSResult, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_send_keys( &mut self, element: &WebElement, keys: &SendKeysParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_clear( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_element_click( &mut self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn perform_element_click( &mut self, element: String, ) -> WebDriverResult<WebDriverResponse>

https://w3c.github.io/webdriver/#element-click Step 8 for elements other than

Source

pub(crate) fn take_screenshot( &self, rect: Option<Rect<f32, CSSPixel>>, ) -> WebDriverResult<String>

Source

pub(crate) fn handle_take_screenshot( &self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_take_element_screenshot( &self, element: &WebElement, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_custom_handlers_set_mode( &self, parameters: &CustomHandlersSetModeParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_get_prefs( &self, parameters: &GetPrefsParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_set_prefs( &self, parameters: &SetPrefsParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_reset_prefs( &self, parameters: &GetPrefsParameters, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_shutdown(&self) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn handle_reset_all_cookies( &self, ) -> WebDriverResult<WebDriverResponse>

Source

pub(crate) fn verify_top_level_browsing_context_is_open( &self, webview_id: WebViewId, ) -> Result<(), WebDriverError>

Source

pub(crate) fn verify_browsing_context_is_open( &self, browsing_context_id: BrowsingContextId, ) -> Result<(), WebDriverError>

Source

pub(crate) fn focus_webview(&self, webview_id: WebViewId) -> WebDriverResult<()>

Source

pub(crate) fn focus_browsing_context( &self, browsing_cotext_id: BrowsingContextId, ) -> WebDriverResult<()>

Trait Implementations§

Auto Trait Implementations§

§

impl !Freeze for Handler

§

impl !RefUnwindSafe for Handler

§

impl Send for Handler

§

impl !Sync for Handler

§

impl Unpin for Handler

§

impl !UnwindSafe for Handler

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T