Bug 1378833 - use Environment service instead of sdk/system/environment in WebIDE;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Mon, 24 Jul 2017 23:11:17 +0200
changeset 421956 c6d36106525ba7b65a3587d643c3b145de80fb99
parent 421955 220a017bd68128fb1795c2bb81bd061772ce9fef
child 422007 9eddb0a92820c6445f9d1e680e4c239e888e93f0
child 422008 67be9d4a6c2cb1f344cf6faa62702bf020ee940e
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1378833
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1378833 - use Environment service instead of sdk/system/environment in WebIDE;r=ochameau MozReview-Commit-ID: 9Uc9HYImK6G
devtools/client/webide/modules/simulator-process.js
--- a/devtools/client/webide/modules/simulator-process.js
+++ b/devtools/client/webide/modules/simulator-process.js
@@ -2,17 +2,18 @@
  * 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 strict";
 
 const { Cc, Ci, Cu } = require("chrome");
 
-const Environment = require("sdk/system/environment").env;
+const Environment = Cc["@mozilla.org/process/environment;1"]
+                      .getService(Ci.nsIEnvironment);
 const EventEmitter = require("devtools/shared/event-emitter");
 const Subprocess = require("sdk/system/child_process/subprocess");
 const Services = require("Services");
 
 loader.lazyGetter(this, "OS", () => {
   switch (Services.appinfo.OS) {
     case "Darwin":
       return "mac64";
@@ -71,21 +72,21 @@ SimulatorProcess.prototype = {
     this.once("exit", () => {
       this.off("stdout", logHandler);
       this.off("stderr", logHandler);
     });
 
     let environment;
     if (OS.indexOf("linux") > -1) {
       environment = ["TMPDIR=" + Services.dirsvc.get("TmpD", Ci.nsIFile).path];
-      ["DISPLAY", "XAUTHORITY"].forEach(key => {
-        if (key in Environment) {
-          environment.push(key + "=" + Environment[key]);
-        }
-      });
+      ["DISPLAY", "XAUTHORITY"]
+        .filter(key => Environment.exists(key))
+        .forEach(key => {
+          environment.push(key + "=" + Environment.get(key));
+        });
     }
 
     // Spawn a B2G instance.
     this.process = Subprocess.call({
       command: b2g,
       arguments: this.args,
       environment: environment,
       stdout: data => this.emit("stdout", data),