Report unprocessed network request count in troubleshooting info

Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/16939
This commit is contained in:
Raymond Hill 2023-03-08 09:36:09 -05:00
parent 0c9576d3e6
commit f9b03ebeac
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
4 changed files with 10 additions and 5 deletions

View File

@ -1175,6 +1175,7 @@ vAPI.Net = class {
this.suspendableListener = undefined;
this.listenerMap = new WeakMap();
this.suspendDepth = 0;
this.unprocessedRequestCount = 0;
browser.webRequest.onBeforeRequest.addListener(
details => {
@ -1227,8 +1228,10 @@ vAPI.Net = class {
);
}
onBeforeSuspendableRequest(details) {
if ( this.suspendableListener === undefined ) { return; }
return this.suspendableListener(details);
if ( this.suspendableListener !== undefined ) {
return this.suspendableListener(details);
}
this.unprocessedRequestCount += 1;
}
setSuspendableListener(listener) {
this.suspendableListener = listener;

View File

@ -560,7 +560,7 @@ const assetCacheRead = async function(assetKey, updateReadTime = false) {
µb.supportStats.maxAssetCacheWait = Math.max(
Date.now() - t0,
parseInt(µb.supportStats.maxAssetCacheWait, 10)
parseInt(µb.supportStats.maxAssetCacheWait, 10) || 0
) + ' ms';
if (

View File

@ -219,8 +219,9 @@ const µBlock = { // jshint ignore:line
readyToFilter: false,
supportStats: {
allReadyAfter: '',
maxAssetCacheWait: '0 ms',
allReadyAfter: '?',
maxAssetCacheWait: '?',
unprocessedRequestCount: '?',
},
pageStores: new Map(),

View File

@ -1147,6 +1147,7 @@ const webRequest = {
}
);
vAPI.net.unsuspend({ all: true });
µb.supportStats.unprocessedRequestCount = `${vAPI.net.unprocessedRequestCount}`;
};
})(),