Commit 07bc0f44 authored by Felipe Gomes's avatar Felipe Gomes
Browse files

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
parent 3dafad00
......@@ -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 ||
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment