Bug 827976 - Use a different method to detect if xpcshell tests are running. r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D21078

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Felipe Gomes 2019-03-04 18:52:53 +00:00
Родитель b2e6c063a6
Коммит 7a9810f6b4
1 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -6,7 +6,7 @@
"use strict";
const { Cu } = require("chrome");
const { Cc, Ci, Cu } = require("chrome");
const Services = require("Services");
const { Pool } = require("devtools/shared/protocol");
const { LazyPool, createExtraActors } = require("devtools/shared/protocol/lazy-pool");
@ -542,16 +542,13 @@ RootActor.prototype = {
// If the request doesn't contains id parameter or id is 0
// (id == 0, based on onListProcesses implementation)
if ((!("id" in request)) || request.id === 0) {
// Check if we are running on xpcshell. hiddenDOMWindow is going to throw on it.
// Check if we are running on xpcshell.
// When running on xpcshell, there is no valid browsing context to attach to
// and so ParentProcessTargetActor doesn't make sense as it inherits from
// BrowsingContextTargetActor. So instead use ContentProcessTargetActor, which
// matches xpcshell needs.
let isXpcshell = true;
try {
isXpcshell = !Services.wm.getMostRecentWindow(null) &&
!Services.appShell.hiddenDOMWindow;
} catch (e) {}
const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
const isXpcshell = env.exists("XPCSHELL_TEST_PROFILE_DIR");
if (!isXpcshell && this._parentProcessTargetActor &&
(!this._parentProcessTargetActor.docShell ||