Files
tubestation/servo/components/script/dom/navigatorinfo.rs
Manish Goregaokar 8e0ed407b9 servo: Merge #4485 - Replace most to_string calls by into_string calls (from servo:into_string); r=Ms2ger
`str::to_string()` goes through a `Formatter`, `str::into_string()` is a direct copy and is apparently 5× faster.

This is a rebase of the boring and bitrot-prone parts of #4366.

Source-Repo: https://github.com/servo/servo
Source-Revision: 9857ea26cb9ee262654bee97322dbbf373486bff
2014-12-27 06:51:44 -07:00

38 lines
873 B
Rust

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use servo_util::str::DOMString;
use servo_util::opts;
pub struct NavigatorInfo;
impl NavigatorInfo {
pub fn Product() -> DOMString {
"Gecko".into_string()
}
pub fn TaintEnabled() -> bool {
false
}
pub fn AppName() -> DOMString {
"Netscape".into_string() // Like Gecko/Webkit
}
pub fn AppCodeName() -> DOMString {
"Mozilla".into_string()
}
pub fn Platform() -> DOMString {
"".into_string()
}
pub fn UserAgent() -> DOMString {
match opts::get().user_agent {
Some(ref user_agent) => user_agent.clone(),
None => "".into_string(),
}
}
}