Bug 1388249 - Add crashreporter environment variables to geckodriver. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 23 Aug 2017 13:33:12 +0200
changeset 651232 35fc235ff6edb19c68fc1eebc3399da31d843990
parent 651231 a656c546285dc6020bb579bf37ccfce41140aeb6
child 727637 4dedb8477324b31f0685553d655a0e6490da4175
push id75647
push userbmo:hskupin@gmail.com
push dateWed, 23 Aug 2017 11:36:22 +0000
bugs1388249
milestone57.0a1
Bug 1388249 - Add crashreporter environment variables to geckodriver. In geckodriver we need a better control about the behavior of the crash reporter. It should be enabled by default if possible, but never show its window when a crash actually happens. Both settings will allow us later to analyze the generated minidump files. Further the crash reporter will shutdown Firefox now in case of content crashes. This prevents a possible hang of Marionette when a command in content gets executed and the framescript gets disconnected. MozReview-Commit-ID: DV1E7yQlElM
testing/geckodriver/CHANGES.md
testing/geckodriver/src/marionette.rs
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -1,28 +1,30 @@
 # Change log
 
 All notable changes to this program is documented in this file.
 
 ## Unreleased
 
 ### Added
+- Added crashreporter environment variables to better control the browser in case of crashes.
 - Added preference `dom.file.createInChild` set to true to allow file object creation in content processes.
 - New window `state` field on the window rect response object, returned from [`GetWindowRect`], [`SetWindowRect`], [`MinimizeWindow`], [`MaximizeWindow`], and [`FullscreenWindow`] commands
 
 [`FullscreenWindow`]: https://docs.rs/webdriver/0.29.0/webdriver/command/enum.WebDriverCommand.html#variant.FullscreenWindow
 [`GetWindowRect`]: https://docs.rs/webdriver/0.29.0/webdriver/command/enum.WebDriverCommand.html#variant.GetWindowRect
 [`MaximizeWindow`]: https://docs.rs/webdriver/0.29.0/webdriver/command/enum.WebDriverCommand.html#variant.MaximizeWindow
 [`MinimizeWindow`]: https://docs.rs/webdriver/0.29.0/webdriver/command/enum.WebDriverCommand.html#variant.MinimizeWindow
 [`SetWindowRect`]: https://docs.rs/webdriver/0.29.0/webdriver/command/enum.WebDriverCommand.html#variant.SetWindowRect
 
 ### Changed
 - To make sure no browser process is left behind when the [`New Session` command](https://docs.rs/webdriver/0.27.0/webdriver/command/enum.WebDriverCommand.html#variant.NewSession) fails, the process is closed immediately now.
 - The `proxyType` `noproxy` has been replaced with `direct` in accordance with recent WebDriver specification changes
 - `/moz/addon/install` command accepts an `addon` parameter, in lieu of `path`, containing an addon as a Base64 string
+- [mozrunner crate](https://crates.io/crates/mozrunner) upgraded to version 0.4.2
 
 ## 0.18.0 (2017-07-10)
 
 ### Changed
 - [`RectResponse`](https://docs.rs/webdriver/0.27.0/webdriver/response/struct.RectResponse.html) permits returning floats for `width` and `height` fields
 - New type [`CookieResponse`](https://docs.rs/webdriver/0.27.0/webdriver/response/struct.CookieResponse.html) for the [`GetNamedCookie` command](https://docs.rs/webdriver/0.27.0/webdriver/command/enum.WebDriverCommand.html#variant.GetNamedCookie) returns a single cookie, as opposed to an array of a single cookie
 - To pick up a prepared profile from the filesystem, it is now possible to pass `["-profile", "/path/to/profile"]` in the `args` array on `moz:firefoxOptions`
 - geckodriver now recommends Firefox 53 and greater
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -446,16 +446,21 @@ impl MarionetteHandler {
 
         let mut runner = try!(FirefoxRunner::new(&binary, options.profile.take())
                               .map_err(|e| WebDriverError::new(ErrorStatus::SessionNotCreated,
                                                                e.description().to_owned())));
 
         // double-dashed flags are not accepted on Windows systems
         runner.args().push("-marionette".to_owned());
 
+        // https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
+        runner.envs().insert("MOZ_CRASHREPORTER".to_string(), "1".to_string());
+        runner.envs().insert("MOZ_CRASHREPORTER_NO_REPORT".to_string(), "1".to_string());
+        runner.envs().insert("MOZ_CRASHREPORTER_SHUTDOWN".to_string(), "1".to_string());
+
         if let Some(args) = options.args.take() {
             runner.args().extend(args);
         };
 
         try!(self.set_prefs(port, &mut runner.profile, custom_profile, options.prefs)
             .map_err(|e| {
                 WebDriverError::new(ErrorStatus::SessionNotCreated,
                                     format!("Failed to set preferences: {}", e))