Skip to content

Commit

Permalink
Send servo version in mozbrowser error.
Browse files Browse the repository at this point in the history
Also moved servo version to util for usage by the --version flag
and for sending the version to browser.html with mozbrowsererror
  • Loading branch information
cbrewster committed Jul 1, 2016
1 parent f2d7982 commit ed678cb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/script/dom/htmliframeelement.rs
Expand Up @@ -49,6 +49,7 @@ use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::ReflowGoal;
use url::Url;
use util::prefs::mozbrowser_enabled;
use util::servo_version;

#[derive(HeapSizeOf)]
enum SandboxAllowance {
Expand Down Expand Up @@ -358,6 +359,7 @@ impl MozBrowserEventDetailBuilder for HTMLIFrameElement {
type_: Some(DOMString::from(error_type.name())),
description: description.map(DOMString::from),
report: report.map(DOMString::from),
version: Some(DOMString::from_string(servo_version().into())),
}.to_jsval(cx, rval);
},
MozBrowserEvent::SecurityChange(https_state) => {
Expand Down
1 change: 1 addition & 0 deletions components/script/dom/webidls/BrowserElement.webidl
Expand Up @@ -61,6 +61,7 @@ dictionary BrowserElementErrorEventDetail {
DOMString type;
DOMString description;
DOMString report;
DOMString version;
};

dictionary BrowserElementLocationChangeEventDetail {
Expand Down
3 changes: 2 additions & 1 deletion components/servo/main.rs
Expand Up @@ -40,6 +40,7 @@ use servo::Browser;
use servo::compositing::windowing::WindowEvent;
use servo::util::opts::{self, ArgumentParsingResult};
use servo::util::panicking::initiate_panic_hook;
use servo::util::servo_version;
use std::process;
use std::rc::Rc;

Expand Down Expand Up @@ -104,7 +105,7 @@ fn main() {
}

if opts::get().is_printing_version {
println!("Servo {}{}", env!("CARGO_PKG_VERSION"), env!("GIT_INFO"));
println!("{}", servo_version());
process::exit(0);
}

Expand Down
4 changes: 4 additions & 0 deletions components/util/lib.rs
Expand Up @@ -64,3 +64,7 @@ pub fn arc_ptr_eq<T: 'static>(a: &Arc<T>, b: &Arc<T>) -> bool {
let b: &T = &**b;
(a as *const T) == (b as *const T)
}

pub fn servo_version() -> &'static str {
concat!("Servo ", env!("CARGO_PKG_VERSION"), env!("GIT_INFO"))
}

0 comments on commit ed678cb

Please sign in to comment.