1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-04 16:47:15 +02:00

Fix spurious error message in dev console

Ports can be disconnected under certain conditions,
and in such case runtime.lastError must be accessed
to avoid the extensions framework from emitting
error messages in the console.
This commit is contained in:
Raymond Hill 2021-07-31 07:20:38 -04:00
parent dc08478130
commit 2eb02c5adc
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -97,9 +97,12 @@ vAPI.messaging = {
// as world-ending, i.e. stay around. Except for embedded frames.
disconnectListener: function() {
void browser.runtime.lastError;
this.port = null;
if ( window !== window.top ) {
vAPI.shutdown.exec();
} else {
this.destroyPort();
}
},
disconnectListenerBound: null,
@ -129,8 +132,7 @@ vAPI.messaging = {
messageListenerBound: null,
canDestroyPort: function() {
return this.pending.size === 0 &&
(
return this.pending.size === 0 && (
this.extensions.length === 0 ||
this.extensions.every(e => e.canDestroyPort())
);