mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use arboard in servoshell instead of rust-clipboard (#30274)
rust-clipboard is unmaintained, which means that it pulls in very old dependencies (including a version xcb with 3 critical security vulnerabilities). In addition, we already depend on arboard. This removes four crates from our dependency graph.
This commit is contained in:
parent
8d5dc7a0bb
commit
0cf84f9f7c
4 changed files with 18 additions and 63 deletions
47
Cargo.lock
generated
47
Cargo.lock
generated
|
@ -179,7 +179,9 @@ version = "3.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac57f2b058a76363e357c056e4f74f1945bf734d37b8b3ef49066c4787dde0fc"
|
||||
dependencies = [
|
||||
"clipboard-win 4.5.0",
|
||||
"clipboard-win",
|
||||
"core-graphics",
|
||||
"image",
|
||||
"log",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
|
@ -814,28 +816,6 @@ dependencies = [
|
|||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25a904646c0340239dcf7c51677b33928bf24fdf424b79a57909c0109075b2e7"
|
||||
dependencies = [
|
||||
"clipboard-win 2.2.0",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"x11-clipboard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "4.5.0"
|
||||
|
@ -5528,9 +5508,9 @@ dependencies = [
|
|||
name = "servoshell"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"backtrace",
|
||||
"cc",
|
||||
"clipboard",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
"egui_glow",
|
||||
|
@ -7359,15 +7339,6 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-clipboard"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89bd49c06c9eb5d98e6ba6536cf64ac9f7ee3a009b2f53996d405b3944f6bcea"
|
||||
dependencies = [
|
||||
"xcb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "x11-dl"
|
||||
version = "2.21.0"
|
||||
|
@ -7401,16 +7372,6 @@ dependencies = [
|
|||
"nix 0.24.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcb"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e917a3f24142e9ff8be2414e36c649d47d6cc2ba81f16201cdef96e533e02de"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xcursor"
|
||||
version = "0.3.4"
|
||||
|
|
|
@ -44,8 +44,8 @@ webgl_backtrace = ["libservo/webgl_backtrace"]
|
|||
xr-profile = ["libservo/xr-profile"]
|
||||
|
||||
[target.'cfg(not(target_os = "android"))'.dependencies]
|
||||
arboard = "3"
|
||||
backtrace = { workspace = true }
|
||||
clipboard = "0.5"
|
||||
egui = "0.22.0"
|
||||
egui_glow = { version = "0.22.0", features = ["winit"] }
|
||||
egui-winit = { version = "0.22.0", default-features = false, features = ["clipboard", "wayland"] }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use crate::keyutils::{CMD_OR_ALT, CMD_OR_CONTROL};
|
||||
use crate::window_trait::{WindowPortsMethods, LINE_HEIGHT};
|
||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use arboard::Clipboard;
|
||||
use euclid::{Point2D, Vector2D};
|
||||
use keyboard_types::{Key, KeyboardEvent, Modifiers, ShortcutMatcher};
|
||||
use servo::compositing::windowing::{WebRenderDebugOption, EmbedderEvent};
|
||||
|
@ -47,7 +47,7 @@ pub struct Browser<Window: WindowPortsMethods + ?Sized> {
|
|||
|
||||
window: Rc<Window>,
|
||||
event_queue: Vec<EmbedderEvent>,
|
||||
clipboard_ctx: Option<ClipboardContext>,
|
||||
clipboard: Option<Clipboard>,
|
||||
shutdown_requested: bool,
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ where
|
|||
browser_id: None,
|
||||
browsers: Vec::new(),
|
||||
window,
|
||||
clipboard_ctx: match ClipboardContext::new() {
|
||||
clipboard: match Clipboard::new() {
|
||||
Ok(c) => Some(c),
|
||||
Err(e) => {
|
||||
warn!("Error creating clipboard context ({})", e);
|
||||
|
@ -420,23 +420,20 @@ where
|
|||
self.handle_key_from_servo(browser_id, key_event);
|
||||
},
|
||||
EmbedderMsg::GetClipboardContents(sender) => {
|
||||
let contents = match self.clipboard_ctx {
|
||||
Some(ref mut ctx) => match ctx.get_contents() {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
warn!("Error getting clipboard contents ({}), defaulting to empty string", e);
|
||||
"".to_owned()
|
||||
},
|
||||
},
|
||||
None => "".to_owned(),
|
||||
};
|
||||
let contents = self.clipboard
|
||||
.as_mut()
|
||||
.and_then(|clipboard| clipboard.get_text().ok())
|
||||
.unwrap_or_else(|| {
|
||||
warn!("Error getting clipboard text. Returning empty string.");
|
||||
String::new()
|
||||
});
|
||||
if let Err(e) = sender.send(contents) {
|
||||
warn!("Failed to send clipboard ({})", e);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::SetClipboardContents(text) => {
|
||||
if let Some(ref mut ctx) = self.clipboard_ctx {
|
||||
if let Err(e) = ctx.set_contents(text) {
|
||||
if let Some(ref mut clipboard) = self.clipboard {
|
||||
if let Err(e) = clipboard.set_text(text) {
|
||||
warn!("Error setting clipboard contents ({})", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ rand = [
|
|||
[ignore]
|
||||
# Ignored packages with duplicated versions
|
||||
packages = [
|
||||
"ahash",
|
||||
"arrayvec",
|
||||
"base64",
|
||||
"cfg-if",
|
||||
|
@ -81,10 +82,6 @@ packages = [
|
|||
|
||||
# Temporarily duplicated until gleam can be upgrded.
|
||||
"uuid",
|
||||
|
||||
# winit port minibrowser (servo/servo#30049)
|
||||
"clipboard-win",
|
||||
"ahash",
|
||||
]
|
||||
# Files that are ignored for all tidy and lint checks.
|
||||
files = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue