aboutsummaryrefslogtreecommitdiffstats
path: root/ports/servoshell
diff options
context:
space:
mode:
Diffstat (limited to 'ports/servoshell')
-rw-r--r--ports/servoshell/Cargo.toml2
-rw-r--r--ports/servoshell/crash_handler.rs2
-rw-r--r--ports/servoshell/egl/ohos.rs17
-rw-r--r--ports/servoshell/egl/ohos/simpleservo.rs14
-rw-r--r--ports/servoshell/egl/servo_glue.rs4
-rw-r--r--ports/servoshell/lib.rs7
-rw-r--r--ports/servoshell/parser.rs7
7 files changed, 21 insertions, 32 deletions
diff --git a/ports/servoshell/Cargo.toml b/ports/servoshell/Cargo.toml
index f944b988ae2..c207ba1762b 100644
--- a/ports/servoshell/Cargo.toml
+++ b/ports/servoshell/Cargo.toml
@@ -128,7 +128,7 @@ winit = "0.30.5"
[target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "windows"))'.dependencies]
image = { workspace = true }
-[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
+[target.'cfg(any(all(target_os = "linux", not(target_env = "ohos")), target_os = "macos"))'.dependencies]
sig = "1.0"
[target.'cfg(target_os = "windows")'.dependencies]
diff --git a/ports/servoshell/crash_handler.rs b/ports/servoshell/crash_handler.rs
index 94c0b10f992..c7f084f7e42 100644
--- a/ports/servoshell/crash_handler.rs
+++ b/ports/servoshell/crash_handler.rs
@@ -11,6 +11,8 @@ pub fn install() {
use std::sync::atomic;
use std::thread;
+ use sig::signal;
+
use crate::backtrace;
extern "C" fn handler(sig: i32) {
diff --git a/ports/servoshell/egl/ohos.rs b/ports/servoshell/egl/ohos.rs
index e4586c90f8f..e005eb0114c 100644
--- a/ports/servoshell/egl/ohos.rs
+++ b/ports/servoshell/egl/ohos.rs
@@ -30,7 +30,6 @@ use ohos_sys::xcomponent::{
use servo::compositing::windowing::EmbedderEvent;
use servo::embedder_traits;
use servo::embedder_traits::{InputMethodType, PromptResult};
-use servo::euclid::Point2D;
use servo::style::Zero;
use simpleservo::EventLoopWaker;
use xcomponent_sys::{
@@ -82,7 +81,7 @@ unsafe impl Send for XComponentWrapper {}
unsafe impl Send for WindowWrapper {}
#[derive(Clone, Copy, Debug)]
-enum TouchEventType {
+pub(super) enum TouchEventType {
Down,
Up,
Move,
@@ -91,7 +90,7 @@ enum TouchEventType {
}
#[derive(Debug)]
-enum ServoAction {
+pub(super) enum ServoAction {
WakeUp,
LoadUrl(String),
GoBack,
@@ -206,11 +205,9 @@ unsafe extern "C" fn on_vsync_cb(
data: *mut ::core::ffi::c_void,
) {
trace!("Vsync callback at time {timestamp}");
- // SAFETY: We require the function registering us as a callback
- let (native_vsync, data) = unsafe {
- let native = ohos_vsync::NativeVsync::from_raw(data.cast());
- (native, 0)
- };
+ // SAFETY: We require the function registering us as a callback provides a valid
+ // `OH_NativeVSync` object. We do not use `data` after this point.
+ let native_vsync = unsafe { ohos_vsync::NativeVsync::from_raw(data.cast()) };
call(ServoAction::Vsync).unwrap();
// Todo: Do we have a callback for when the frame finished rendering?
unsafe {
@@ -507,7 +504,7 @@ pub fn go_forward() {
#[napi(js_name = "registerURLcallback")]
pub fn register_url_callback(callback: Function<String, ()>) -> napi_ohos::Result<()> {
debug!("register_url_callback called!");
- let mut tsfn_builder = callback.build_threadsafe_function();
+ let tsfn_builder = callback.build_threadsafe_function();
let function = tsfn_builder
.max_queue_size::<UPDATE_URL_QUEUE_SIZE>()
.build()?;
@@ -522,7 +519,7 @@ pub fn register_url_callback(callback: Function<String, ()>) -> napi_ohos::Resul
#[napi]
pub fn register_prompt_toast_callback(callback: Function<String, ()>) -> napi_ohos::Result<()> {
debug!("register_prompt_toast_callback called!");
- let mut tsfn_builder = callback.build_threadsafe_function();
+ let tsfn_builder = callback.build_threadsafe_function();
let function = tsfn_builder.max_queue_size::<PROMPT_QUEUE_SIZE>().build()?;
PROMPT_TOAST
diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs
index 76796e06c7d..a29c9fa44fb 100644
--- a/ports/servoshell/egl/ohos/simpleservo.rs
+++ b/ports/servoshell/egl/ohos/simpleservo.rs
@@ -82,18 +82,12 @@ pub fn init(
"--prefs-file /path/to/prefs.json",
);
- let opts_matches;
- let content_process_token;
- match opts::from_cmdline_args(opts, &args) {
- ArgumentParsingResult::ContentProcess(matches, token) => {
+ let opts_matches = match opts::from_cmdline_args(opts, &args) {
+ ArgumentParsingResult::ContentProcess(matches, _token) => {
error!("Content Process mode not supported / tested yet on OpenHarmony!");
- opts_matches = matches;
- content_process_token = Some(token);
- },
- ArgumentParsingResult::ChromeProcess(matches) => {
- opts_matches = matches;
- content_process_token = None;
+ matches
},
+ ArgumentParsingResult::ChromeProcess(matches) => matches,
};
crate::prefs::register_user_prefs(&opts_matches);
diff --git a/ports/servoshell/egl/servo_glue.rs b/ports/servoshell/egl/servo_glue.rs
index ab16a04277b..56e39c03564 100644
--- a/ports/servoshell/egl/servo_glue.rs
+++ b/ports/servoshell/egl/servo_glue.rs
@@ -26,7 +26,6 @@ use servo::script_traits::{
};
use servo::servo_geometry::DeviceIndependentPixel;
use servo::style_traits::DevicePixel;
-use servo::webrender_api::units::DeviceIntRect;
use servo::webrender_api::ScrollLocation;
use servo::webrender_traits::RenderingContext;
use servo::{gl, Servo, TopLevelBrowsingContextId};
@@ -501,7 +500,8 @@ impl ServoGlue {
let trusted = origin == PromptOrigin::Trusted;
let res = match definition {
PromptDefinition::Alert(message, sender) => {
- sender.send(cb.prompt_alert(message, trusted))
+ cb.prompt_alert(message, trusted);
+ sender.send(())
},
PromptDefinition::OkCancel(message, sender) => {
sender.send(cb.prompt_ok_cancel(message, trusted))
diff --git a/ports/servoshell/lib.rs b/ports/servoshell/lib.rs
index ed29f6284e3..8e19e055265 100644
--- a/ports/servoshell/lib.rs
+++ b/ports/servoshell/lib.rs
@@ -4,21 +4,18 @@
use cfg_if::cfg_if;
-#[cfg(any(target_os = "macos", target_os = "linux"))]
-#[macro_use]
-extern crate sig;
-
#[cfg(test)]
mod test;
#[cfg(not(target_os = "android"))]
mod backtrace;
+#[cfg(not(target_env = "ohos"))]
mod crash_handler;
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
pub(crate) mod desktop;
#[cfg(any(target_os = "android", target_env = "ohos"))]
mod egl;
-#[cfg(not(target_os = "android"))]
+#[cfg(not(any(target_os = "android", target_env = "ohos")))]
mod panic_hook;
mod parser;
mod prefs;
diff --git a/ports/servoshell/parser.rs b/ports/servoshell/parser.rs
index 3ebe259d1cc..aba9818093f 100644
--- a/ports/servoshell/parser.rs
+++ b/ports/servoshell/parser.rs
@@ -2,20 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+#[cfg(not(any(target_os = "android", target_env = "ohos")))]
use std::path::{Path, PathBuf};
-use log::warn;
use servo::net_traits::pub_domains::is_reg_domain;
use servo::servo_config::pref;
use servo::servo_url::ServoUrl;
-use url::{self, Url};
#[cfg(not(any(target_os = "android", target_env = "ohos")))]
pub fn parse_url_or_filename(cwd: &Path, input: &str) -> Result<ServoUrl, ()> {
match ServoUrl::parse(input) {
Ok(url) => Ok(url),
Err(url::ParseError::RelativeUrlWithoutBase) => {
- Url::from_file_path(&*cwd.join(input)).map(ServoUrl::from_url)
+ url::Url::from_file_path(&*cwd.join(input)).map(ServoUrl::from_url)
},
Err(_) => Err(()),
}
@@ -33,7 +32,7 @@ pub fn get_default_url(
let cmdline_url = url_opt.map(|s| s.to_string()).and_then(|url_string| {
parse_url_or_filename(cwd.as_ref(), &url_string)
.map_err(|error| {
- warn!("URL parsing failed ({:?}).", error);
+ log::warn!("URL parsing failed ({:?}).", error);
error
})
.ok()