Skip to content

Commit 90efefc

Browse files
author
Alexandru Michis
committed
Backed out 3 changesets (bug 1693805) for causing bc failures in browser_all_files_referenced.js
CLOSED TREE Backed out changeset 4b6ec8e2cf78 (bug 1693805) Backed out changeset 0a1b4a96c1cf (bug 1693805) Backed out changeset 3c883527d366 (bug 1693805)
1 parent 7db7c6e commit 90efefc

File tree

9 files changed

+62
-283
lines changed

9 files changed

+62
-283
lines changed

remote/cdp/CDP.jsm

+16-24
Original file line numberDiff line numberDiff line change
@@ -44,44 +44,38 @@ class CDP {
4444
/**
4545
* Creates a new instance of the CDP class.
4646
*
47-
* @param {RemoteAgent} agent
48-
* Reference to the Remote Agent instance.
47+
* @param {HttpServer} server
48+
* The HTTP server that handles new connection requests.
4949
*/
50-
constructor(agent) {
51-
this.agent = agent;
52-
this.targetList = null;
53-
}
54-
55-
get address() {
56-
const mainTarget = this.targetList.getMainProcessTarget();
57-
return mainTarget.wsDebuggerURL;
58-
}
59-
60-
/**
61-
* Starts the CDP support.
62-
*/
63-
async start() {
64-
RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS);
50+
constructor(server) {
51+
this.server = server;
6552

66-
this.agent.server.registerPrefixHandler("/json/", new JSONHandler(this));
53+
this.server.registerPrefixHandler("/json/", new JSONHandler(this));
6754

6855
this.targetList = new TargetList();
6956
this.targetList.on("target-created", (eventName, target) => {
70-
this.agent.server.registerPathHandler(target.path, target);
57+
this.server.registerPathHandler(target.path, target);
7158
});
7259
this.targetList.on("target-destroyed", (eventName, target) => {
73-
this.agent.server.registerPathHandler(target.path, null);
60+
this.server.registerPathHandler(target.path, null);
7461
});
7562

63+
RecommendedPreferences.applyPreferences(RECOMMENDED_PREFS);
64+
}
65+
66+
/**
67+
* Starts the CDP support.
68+
*/
69+
async start() {
7670
await this.targetList.watchForTargets();
7771

7872
// Immediatly instantiate the main process target in order
7973
// to be accessible via HTTP endpoint on startup
80-
74+
const mainTarget = this.targetList.getMainProcessTarget();
8175
Services.obs.notifyObservers(
8276
null,
8377
"remote-listening",
84-
`DevTools listening on ${this.address}`
78+
`DevTools listening on ${mainTarget.wsDebuggerURL}`
8579
);
8680
}
8781

@@ -90,8 +84,6 @@ class CDP {
9084
*/
9185
stop() {
9286
this.targetList.destructor();
93-
this.targetList = null;
94-
9587
RecommendedPreferences.restorePreferences(RECOMMENDED_PREFS);
9688
}
9789
}

remote/components/RemoteAgent.jsm

+44-46
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,38 @@ const { XPCOMUtils } = ChromeUtils.import(
1111
);
1212

1313
XPCOMUtils.defineLazyModuleGetters(this, {
14-
Preferences: "resource://gre/modules/Preferences.jsm",
1514
Services: "resource://gre/modules/Services.jsm",
1615

1716
CDP: "chrome://remote/content/cdp/CDP.jsm",
1817
HttpServer: "chrome://remote/content/server/HTTPD.jsm",
1918
Log: "chrome://remote/content/shared/Log.jsm",
20-
WebDriverBiDi: "chrome://remote/content/webdriver-bidi/WebDriverBiDi.jsm",
19+
Preferences: "resource://gre/modules/Preferences.jsm",
2120
});
2221

2322
XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
2423

25-
XPCOMUtils.defineLazyGetter(this, "activeProtocols", () => {
26-
const protocols = Services.prefs.getIntPref("remote.active-protocols");
27-
if (protocols < 1 || protocols > 3) {
28-
throw Error(`Invalid remote protocol identifier: ${protocols}`);
29-
}
30-
31-
return protocols;
32-
});
24+
const PREF_ACTIVE_PROTOCOLS = "remote.active-protocols";
25+
const PREF_FORCE_LOCAL = "remote.force-local";
3326

34-
const WEBDRIVER_BIDI_ACTIVE = 0x1;
27+
// const BIDI_ACTIVE = 0x1;
3528
const CDP_ACTIVE = 0x2;
3629

37-
// By default force local connections only
3830
const LOOPBACKS = ["localhost", "127.0.0.1", "[::1]"];
39-
const PREF_FORCE_LOCAL = "remote.force-local";
4031

4132
class RemoteAgentClass {
4233
constructor() {
34+
this.cdp = null;
4335
this.server = null;
4436

45-
if ((activeProtocols & WEBDRIVER_BIDI_ACTIVE) === WEBDRIVER_BIDI_ACTIVE) {
46-
this.webdriverBiDi = new WebDriverBiDi(this);
47-
logger.debug("WebDriver BiDi enabled");
48-
} else {
49-
this.webdriverBiDi = null;
37+
const protocols = Services.prefs.getIntPref(PREF_ACTIVE_PROTOCOLS);
38+
if (protocols < 1 || protocols > 3) {
39+
throw Error(`Invalid remote protocol identifier: ${protocols}`);
5040
}
41+
this.activeProtocols = protocols;
42+
}
5143

52-
if ((activeProtocols & CDP_ACTIVE) === CDP_ACTIVE) {
53-
this.cdp = new CDP(this);
54-
logger.debug("CDP enabled");
55-
} else {
56-
this.cdp = null;
57-
}
44+
get listening() {
45+
return !!this.server && !this.server.isStopped();
5846
}
5947

6048
get debuggerAddress() {
@@ -65,26 +53,6 @@ class RemoteAgentClass {
6553
return `${this.host}:${this.port}`;
6654
}
6755

68-
get host() {
69-
// Bug 1675471: When using the nsIRemoteAgent interface the HTTPd server's
70-
// primary identity ("this.server.identity.primaryHost") is lazily set.
71-
return this.server?._host;
72-
}
73-
74-
get listening() {
75-
return !!this.server && !this.server.isStopped();
76-
}
77-
78-
get port() {
79-
// Bug 1675471: When using the nsIRemoteAgent interface the HTTPd server's
80-
// primary identity ("this.server.identity.primaryPort") is lazily set.
81-
return this.server?._port;
82-
}
83-
84-
get scheme() {
85-
return this.server?.identity.primaryScheme;
86-
}
87-
8856
listen(url) {
8957
if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
9058
throw Components.Exception(
@@ -116,6 +84,10 @@ class RemoteAgentClass {
11684

11785
this.server = new HttpServer();
11886

87+
if ((this.activeProtocols & CDP_ACTIVE) === CDP_ACTIVE) {
88+
this.cdp = new CDP(this.server);
89+
}
90+
11991
return this.asyncListen(host, port);
12092
}
12193

@@ -124,7 +96,6 @@ class RemoteAgentClass {
12496
this.server._start(port, host);
12597

12698
await this.cdp?.start();
127-
await this.webdriverBiDi?.start();
12899
} catch (e) {
129100
await this.close();
130101
logger.error(`Unable to start remote agent: ${e.message}`, e);
@@ -136,7 +107,6 @@ class RemoteAgentClass {
136107
// Stop the CDP support before stopping the server.
137108
// Otherwise the HTTP server will fail to stop.
138109
this.cdp?.stop();
139-
this.webdriverBiDi?.stop();
140110

141111
if (this.listening) {
142112
return this.server.stop();
@@ -145,12 +115,40 @@ class RemoteAgentClass {
145115
// this function must never fail
146116
logger.error("unable to stop listener", e);
147117
} finally {
118+
this.cdp = null;
148119
this.server = null;
149120
}
150121

151122
return Promise.resolve();
152123
}
153124

125+
get scheme() {
126+
if (!this.server) {
127+
return null;
128+
}
129+
return this.server.identity.primaryScheme;
130+
}
131+
132+
get host() {
133+
if (!this.server) {
134+
return null;
135+
}
136+
137+
// Bug 1675471: When using the nsIRemoteAgent interface the HTTPd server's
138+
// primary identity ("this.server.identity.primaryHost") is lazily set.
139+
return this.server._host;
140+
}
141+
142+
get port() {
143+
if (!this.server) {
144+
return null;
145+
}
146+
147+
// Bug 1675471: When using the nsIRemoteAgent interface the HTTPd server's
148+
// primary identity ("this.server.identity.primaryPort") is lazily set.
149+
return this.server._port;
150+
}
151+
154152
// XPCOM
155153

156154
get QueryInterface() {

remote/moz.build

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ DIRS += [
77
"components",
88
"marionette",
99
"shared",
10-
"webdriver-bidi",
1110
]
1211

1312
JAR_MANIFESTS += ["jar.mn"]

remote/shared/Log.jsm

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ XPCOMUtils.defineLazyGetter(this, "prefLogLevel", () => {
4141
/** E10s compatible wrapper for the standard logger from Log.jsm. */
4242
class Log {
4343
static TYPES = {
44+
BIDI: "BiDi",
4445
CDP: "CDP",
4546
MARIONETTE: "Marionette",
4647
REMOTE_AGENT: "RemoteAgent",
47-
WEBDRIVER_BIDI: "WebDriver BiDi",
4848
};
4949

5050
/**

remote/shared/webdriver/Capabilities.jsm

+1-3
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,7 @@ class Capabilities extends Map {
440440
[
441441
"moz:debuggerAddress",
442442
// With bug 1715481 fixed always use the Remote Agent instance
443-
RemoteAgent.listening && RemoteAgent.cdp
444-
? remoteAgent.debuggerAddress
445-
: null,
443+
RemoteAgent.cdp ? remoteAgent.debuggerAddress : null,
446444
],
447445
[
448446
"moz:headless",

remote/webdriver-bidi/WebDriverBiDi.jsm

-52
This file was deleted.

0 commit comments

Comments
 (0)