Bug 1639165 - Don't log messages forwarded from content processes when multiprocess browser toolbox is enabled. r=Honza.

We were getting duplicated nsIScriptError in the Browser Toolbox console and the Browser Console
when the multiprocess pref is enabled, because error from content processes are forwarded to
the main process.
The previous patch of this queue added a isForwardedFromContentProcess flag to nsIScriptError,
that we use in this patch to _not_ handle forwarded messages in multiprocess browser console
and browser toolbox console.

Differential Revision: https://phabricator.services.mozilla.com/D78231
This commit is contained in:
nchevobbe 2020-06-05 08:11:35 +00:00
Родитель d27d062988
Коммит 9c7ffe54b3
2 изменённых файлов: 17 добавлений и 4 удалений

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

@ -65,6 +65,10 @@ class WebConsoleUI {
this.hud.currentTarget &&
this.hud.currentTarget.isParentProcess &&
!this.hud.currentTarget.isAddon;
this.fissionSupport = Services.prefs.getBoolPref(
constants.PREFS.FEATURES.BROWSER_TOOLBOX_FISSION
);
this.window = this.hud.iframeWindow;
this._onPanelSelected = this._onPanelSelected.bind(this);
@ -343,6 +347,15 @@ class WebConsoleUI {
}
_onResourceAvailable({ resourceType, targetFront, resource }) {
// Ignore messages forwarded from content processes if we're in fission browser toolbox.
if (
resourceType === this.hud.resourceWatcher.TYPES.ERROR_MESSAGE &&
resource.pageError.isForwardedFromContentProcess &&
(this.isBrowserToolboxConsole || this.isBrowserConsole) &&
this.fissionSupport
) {
return;
}
this.wrapper.dispatchMessageAdd(resource);
}
@ -370,11 +383,10 @@ class WebConsoleUI {
// This is a top level target. It may update on process switches
// when navigating to another domain.
if (targetFront.isTopLevel) {
const fissionSupport = Services.prefs.getBoolPref(
constants.PREFS.FEATURES.BROWSER_TOOLBOX_FISSION
);
const needContentProcessMessagesListener =
targetFront.isParentProcess && !targetFront.isAddon && !fissionSupport;
targetFront.isParentProcess &&
!targetFront.isAddon &&
!this.fissionSupport;
this.proxy = new WebConsoleConnectionProxy(
this,
targetFront,

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

@ -1721,6 +1721,7 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
chromeContext: pageError.isFromChromeContext,
cssSelectors: pageError.cssSelectors,
isPromiseRejection: pageError.isPromiseRejection,
isForwardedFromContentProcess: pageError.isForwardedFromContentProcess,
};
// If the pageError does have an exception object, we want to return the grip for it,