Ignore unused tabs.onUpdated() events

This commit is contained in:
Raymond Hill 2021-10-17 12:55:31 -04:00
parent 9f693c75c7
commit e4d75fa025
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 1 deletions

View File

@ -524,9 +524,12 @@ vAPI.Tabs = class {
} }
onUpdatedHandler(tabId, changeInfo, tab) { onUpdatedHandler(tabId, changeInfo, tab) {
// Ignore uninteresting update events
const { status = '', title = '', url = '' } = changeInfo;
if ( status === '' && title === '' && url === '' ) { return; }
// https://github.com/gorhill/uBlock/issues/3073 // https://github.com/gorhill/uBlock/issues/3073
// Fall back to `tab.url` when `changeInfo.url` is not set. // Fall back to `tab.url` when `changeInfo.url` is not set.
if ( typeof changeInfo.url !== 'string' ) { if ( url === '' ) {
changeInfo.url = tab && tab.url; changeInfo.url = tab && tab.url;
} }
if ( changeInfo.url ) { if ( changeInfo.url ) {