Issue #2653 - Part 1: Initial cleanup of AppId and isolated mozbrowser.

This removes a lot of the plumbing for having the platform embed itself
through IPC which was required for B2G running the browser as both
shell and browser application.
This commit is contained in:
Moonchild 2024-11-17 20:39:45 +01:00 committed by roytam1
commit 7b6e3a2d4a
77 changed files with 295 additions and 1799 deletions

View file

@ -569,11 +569,9 @@ WebConsoleActor.prototype =
let startedListeners = [];
let window = !this.parentActor.isRootActor ? this.window : null;
let appId = null;
let messageManager = null;
if (this._parentIsContentActor) {
appId = this.parentActor.docShell.appId;
messageManager = this.parentActor.messageManager;
}
@ -604,16 +602,16 @@ WebConsoleActor.prototype =
// Create a StackTraceCollector that's going to be shared both by the
// NetworkMonitorChild (getting messages about requests from parent) and
// by the NetworkMonitor that directly watches service workers requests.
this.stackTraceCollector = new StackTraceCollector({ window, appId });
this.stackTraceCollector = new StackTraceCollector({ window });
this.stackTraceCollector.init();
let processBoundary = Services.appinfo.processType !=
Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
if ((appId || messageManager) && processBoundary) {
if (messageManager && processBoundary) {
// Start a network monitor in the parent process to listen to
// most requests than happen in parent
this.networkMonitor =
new NetworkMonitorChild(appId, this.parentActor.outerWindowID,
new NetworkMonitorChild(this.parentActor.outerWindowID,
messageManager, this.conn, this);
this.networkMonitor.init();
// Spawn also one in the child to listen to service workers

View file

@ -37,12 +37,12 @@ function getTopWindow(win) {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (!docShell.isMozBrowserOrApp) {
if (!docShell.isMozBrowser) {
return win.top;
}
let topDocShell =
docShell.getSameTypeRootTreeItemIgnoreBrowserAndAppBoundaries();
docShell.getSameTypeRootTreeItemIgnoreBrowserBoundaries();
return topDocShell
? topDocShell.contentViewer.DOMDocument.defaultView
@ -98,12 +98,12 @@ function getParentWindow(win) {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
if (!docShell.isMozBrowserOrApp) {
if (!docShell.isMozBrowser) {
return win.parent;
}
let parentDocShell =
docShell.getSameTypeParentIgnoreBrowserAndAppBoundaries();
docShell.getSameTypeParentIgnoreBrowserBoundaries();
return parentDocShell
? parentDocShell.contentViewer.DOMDocument.defaultView

View file

@ -1551,8 +1551,6 @@ NetworkMonitor.prototype = {
* data to the WebConsoleActor or to a NetworkEventActor.
*
* @constructor
* @param number appId
* The web appId of the child process.
* @param number outerWindowID
* The outerWindowID of the TabActor's main window.
* @param nsIMessageManager messageManager
@ -1562,8 +1560,7 @@ NetworkMonitor.prototype = {
* @param object owner
* The WebConsoleActor that is listening for the network requests.
*/
function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner) {
this.appId = appId;
function NetworkMonitorChild(outerWindowID, messageManager, conn, owner) {
this.outerWindowID = outerWindowID;
this.conn = conn;
this.owner = owner;
@ -1577,7 +1574,6 @@ function NetworkMonitorChild(appId, outerWindowID, messageManager, conn, owner)
exports.NetworkMonitorChild = NetworkMonitorChild;
NetworkMonitorChild.prototype = {
appId: null,
owner: null,
_netEvents: null,
_saveRequestAndResponseBodies: true,
@ -1623,7 +1619,6 @@ NetworkMonitorChild.prototype = {
mm.addMessageListener(`${this._msgName}:newEvent`, this._onNewEvent);
mm.addMessageListener(`${this._msgName}:updateEvent`, this._onUpdateEvent);
mm.sendAsyncMessage(this._msgName, {
appId: this.appId,
outerWindowID: this.outerWindowID,
action: "start",
});