//! The files Servo asks its embedder for: data lists and the built-in pages (network error, //! certificate error, crash). Nacre ships its own versions of the pages so their titles are known //! to the browser (see `ERROR_TITLE` and friends) and they read like the rest of Nacre. use std::path::PathBuf; use servo::resources::{Resource, ResourceReaderMethods}; /// Title of the network error page; a tab showing it is treated as "failed to load". pub const ERROR_TITLE: &str = "Couldn't open this page"; pub const BAD_CERT_TITLE: &str = "Connection not secure"; pub const CRASH_TITLE: &str = "This page crashed"; struct NacreResources; impl ResourceReaderMethods for NacreResources { fn read(&self, resource: Resource) -> Vec { match resource { Resource::BluetoothBlocklist => &include_bytes!("../assets/servo/gatt_blocklist.txt")[..], Resource::DomainList => &include_bytes!("../assets/servo/public_domains.txt")[..], Resource::HstsPreloadList => &include_bytes!("../assets/servo/hsts_preload.fstmap")[..], Resource::BadCertHTML => &include_bytes!("../assets/servo/badcert.html")[..], Resource::NetErrorHTML => &include_bytes!("../assets/servo/neterror.html")[..], Resource::BrokenImageIcon => &include_bytes!("../assets/servo/rippy.png")[..], Resource::CrashHTML => &include_bytes!("../assets/servo/crash.html")[..], Resource::DirectoryListingHTML => &include_bytes!("../assets/servo/directory-listing.html")[..], Resource::AboutMemoryHTML => &include_bytes!("../assets/servo/about-memory.html")[..], Resource::DebuggerJS => &include_bytes!("../assets/servo/debugger.js")[..], Resource::JsonViewerHTML => &include_bytes!("../assets/servo/json-viewer.html")[..], } .to_owned() } fn sandbox_access_files(&self) -> Vec { Vec::new() } fn sandbox_access_files_dirs(&self) -> Vec { Vec::new() } } servo::submit_resource_reader!(&NacreResources);