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 14:53:33 +00:00
Родитель 1e3d0915e3
Коммит b853e6c2e4
4 изменённых файлов: 45 добавлений и 6 удалений

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

@ -38,7 +38,8 @@ rawPackets.set(`Unknown property such-unknown-property. Declaration dropp
"notes": null,
"chromeContext": false,
"cssSelectors": "p",
"isPromiseRejection": false
"isPromiseRejection": false,
"isForwardedFromContentProcess": false
},
"resourceType": "error-message"
});
@ -63,7 +64,8 @@ rawPackets.set(`Error in parsing value for padding-top. Declaration dropp
"notes": null,
"chromeContext": false,
"cssSelectors": "p",
"isPromiseRejection": false
"isPromiseRejection": false,
"isForwardedFromContentProcess": false
},
"resourceType": "error-message"
});

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

@ -84,6 +84,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -165,6 +166,7 @@ rawPackets.set(`SyntaxError: redeclaration of let a`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -250,6 +252,7 @@ rawPackets.set(`TypeError longString message`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -335,6 +338,7 @@ rawPackets.set(`throw string with URL`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": "“https://evil.com/?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa“ is evil and “https://not-so-evil.com/?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa“ is not good either",
"hasException": true
},
@ -392,6 +396,7 @@ rawPackets.set(`throw ""`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": "",
"hasException": true
},
@ -449,6 +454,7 @@ rawPackets.set(`throw "tomato"`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": "tomato",
"hasException": true
},
@ -506,6 +512,7 @@ rawPackets.set(`throw false`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": false,
"hasException": true
},
@ -563,6 +570,7 @@ rawPackets.set(`throw 0`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": 0,
"hasException": true
},
@ -620,6 +628,7 @@ rawPackets.set(`throw null`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"type": "null"
},
@ -679,6 +688,7 @@ rawPackets.set(`throw undefined`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"type": "undefined"
},
@ -738,6 +748,7 @@ rawPackets.set(`throw Symbol`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"type": "symbol",
"actor": "server0.conn4.child2/symbol38",
@ -799,6 +810,7 @@ rawPackets.set(`throw Object`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -882,6 +894,7 @@ rawPackets.set(`throw Error Object`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -959,6 +972,7 @@ rawPackets.set(`throw Error Object with custom name`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": false,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -1036,6 +1050,7 @@ rawPackets.set(`Promise reject ""`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": "",
"hasException": true
},
@ -1093,6 +1108,7 @@ rawPackets.set(`Promise reject "tomato"`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": "tomato",
"hasException": true
},
@ -1150,6 +1166,7 @@ rawPackets.set(`Promise reject false`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": false,
"hasException": true
},
@ -1207,6 +1224,7 @@ rawPackets.set(`Promise reject 0`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": 0,
"hasException": true
},
@ -1264,6 +1282,7 @@ rawPackets.set(`Promise reject null`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"type": "null"
},
@ -1323,6 +1342,7 @@ rawPackets.set(`Promise reject undefined`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"type": "undefined"
},
@ -1382,6 +1402,7 @@ rawPackets.set(`Promise reject Symbol`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"type": "symbol",
"actor": "server0.conn4.child2/symbol52",
@ -1443,6 +1464,7 @@ rawPackets.set(`Promise reject Object`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -1526,6 +1548,7 @@ rawPackets.set(`Promise reject Error Object`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",
@ -1603,6 +1626,7 @@ rawPackets.set(`Promise reject Error Object with custom name`, {
"chromeContext": false,
"cssSelectors": "",
"isPromiseRejection": true,
"isForwardedFromContentProcess": false,
"exception": {
"_grip": {
"type": "object",

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

@ -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,