diff options
-rw-r--r-- | ports/servo/browser.rs | 13 | ||||
-rw-r--r-- | ports/servo/main.rs | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/ports/servo/browser.rs b/ports/servo/browser.rs index 996ad276a8d..7ecefcc730f 100644 --- a/ports/servo/browser.rs +++ b/ports/servo/browser.rs @@ -99,7 +99,7 @@ impl Browser { String::from("") }; let title = "URL or search query"; - if let Some(input) = tinyfiledialogs::input_box(title, title, &url) { + if let Some(input) = get_url_input(title, &url) { if let Some(url) = sanitize_url(&input) { self.event_queue.push(WindowEvent::LoadUrl(id, url)); } @@ -351,6 +351,17 @@ fn display_alert_dialog(_message: String) { // tinyfiledialogs not supported on Android } +#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] +fn get_url_input(_title: &str, _url: &str) -> Option<String> { + // tinyfiledialogs not supported on Android + None +} + +#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] +fn get_url_input(title: &str, url: &str) -> Option<String> { + tinyfiledialogs::input_box(title, title, url) +} + #[cfg(target_os = "linux")] fn platform_get_selected_devices(devices: Vec<String>) -> Option<String> { let picker_name = "Choose a device"; diff --git a/ports/servo/main.rs b/ports/servo/main.rs index 31d249183af..b0db7926eb1 100644 --- a/ports/servo/main.rs +++ b/ports/servo/main.rs @@ -34,6 +34,7 @@ extern crate servo; #[cfg(all(feature = "unstable", not(target_os = "android")))] #[macro_use] extern crate sig; +#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] extern crate tinyfiledialogs; extern crate winit; #[cfg(target_os = "windows")] extern crate winapi; |