Send servo version in mozbrowser error.

Also moved servo version to util for usage by the --version flag
and for sending the version to browser.html with mozbrowsererror
This commit is contained in:
Connor Brewster 2016-07-01 15:27:57 -06:00
parent f2d798232f
commit ed678cb7f1
4 changed files with 9 additions and 1 deletions

View file

@ -49,6 +49,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::ReflowGoal; use style::context::ReflowGoal;
use url::Url; use url::Url;
use util::prefs::mozbrowser_enabled; use util::prefs::mozbrowser_enabled;
use util::servo_version;
#[derive(HeapSizeOf)] #[derive(HeapSizeOf)]
enum SandboxAllowance { enum SandboxAllowance {
@ -358,6 +359,7 @@ impl MozBrowserEventDetailBuilder for HTMLIFrameElement {
type_: Some(DOMString::from(error_type.name())), type_: Some(DOMString::from(error_type.name())),
description: description.map(DOMString::from), description: description.map(DOMString::from),
report: report.map(DOMString::from), report: report.map(DOMString::from),
version: Some(DOMString::from_string(servo_version().into())),
}.to_jsval(cx, rval); }.to_jsval(cx, rval);
}, },
MozBrowserEvent::SecurityChange(https_state) => { MozBrowserEvent::SecurityChange(https_state) => {

View file

@ -61,6 +61,7 @@ dictionary BrowserElementErrorEventDetail {
DOMString type; DOMString type;
DOMString description; DOMString description;
DOMString report; DOMString report;
DOMString version;
}; };
dictionary BrowserElementLocationChangeEventDetail { dictionary BrowserElementLocationChangeEventDetail {

View file

@ -40,6 +40,7 @@ use servo::Browser;
use servo::compositing::windowing::WindowEvent; use servo::compositing::windowing::WindowEvent;
use servo::util::opts::{self, ArgumentParsingResult}; use servo::util::opts::{self, ArgumentParsingResult};
use servo::util::panicking::initiate_panic_hook; use servo::util::panicking::initiate_panic_hook;
use servo::util::servo_version;
use std::process; use std::process;
use std::rc::Rc; use std::rc::Rc;
@ -104,7 +105,7 @@ fn main() {
} }
if opts::get().is_printing_version { if opts::get().is_printing_version {
println!("Servo {}{}", env!("CARGO_PKG_VERSION"), env!("GIT_INFO")); println!("{}", servo_version());
process::exit(0); process::exit(0);
} }

View file

@ -64,3 +64,7 @@ pub fn arc_ptr_eq<T: 'static>(a: &Arc<T>, b: &Arc<T>) -> bool {
let b: &T = &**b; let b: &T = &**b;
(a as *const T) == (b as *const T) (a as *const T) == (b as *const T)
} }
pub fn servo_version() -> &'static str {
concat!("Servo ", env!("CARGO_PKG_VERSION"), env!("GIT_INFO"))
}