Bug 1976779 - rsclientcerts: make each backend responsible for rate-limiting calls to find_objects r=jschanck
Before this patch, `rsclientcerts::manager` would rate-limit calls to
`find_objects` to once every 3 seconds because the underlying operation can be
time-consuming (in particular, on macOS and Windows, if there are many
certificates/keys available). On Android, keys aren't available until the user
selects one, which means that if a call to `find_objects` happened before the
selection prompt was shown (which is what happens) and the user chose one in
less than 3 seconds, the backend wouldn't search again, thus making it seem like
no keys were available, which would cause Firefox to not send a client
certificate. This patch makes each backend implementation responsible for this
rate-limiting, because only they know if it's appropriate to do so (in particular,
on Android, `find_objects` doesn't have the same performance concern as
on macOS and Windows because rather than searching for certificates and
keys, it asks `ClientAuthCertificateManager` for the cached list of certificates
and keys that have already been approved for use by the user).
Differential Revision: https://phabricator.services.mozilla.com/D257065
<!DOCTYPE html><metacharset='UTF-8'><!--Color TestClear the four quadrants of the canvas as follows:+------+------+| blue |black || | |+------+------+| red |green || | |+------+------+Clear with a given alpha value. What effect this has depends on thecontext-creation args passed to this page.--><htmlclass='reftest-wait'><head><scripttype='text/javascript'src='webgl-utils.js'></script><scripttype='text/javascript'>'use strict';varCOLOR_VALUE=127.0/255.0;varALPHA_VALUE=127.0/255.0;functionrenderFrame(gl){gl.enable(gl.SCISSOR_TEST);gl.scissor(0,0,100,100);gl.clearColor(COLOR_VALUE,0.0,0.0,ALPHA_VALUE);gl.clear(gl.COLOR_BUFFER_BIT);gl.scissor(100,0,100,100);gl.clearColor(0.0,COLOR_VALUE,0.0,ALPHA_VALUE);gl.clear(gl.COLOR_BUFFER_BIT);gl.scissor(0,100,100,100);gl.clearColor(0.0,0.0,COLOR_VALUE,ALPHA_VALUE);gl.clear(gl.COLOR_BUFFER_BIT);gl.scissor(100,100,100,100);gl.clearColor(0.0,0.0,0.0,ALPHA_VALUE);gl.clear(gl.COLOR_BUFFER_BIT);}////////////////////////////////////////////////////////////////////////////////// BoilerplatevarTIMEOUT_MS=30*1000;functionsetStatus(text){varelem=document.getElementById('status');elem.innerHTML=text;}vargIsComplete=false;functionmarkComplete(statusText){if(!statusText)statusText='';if(gIsComplete)return;gIsComplete=true;setStatus(statusText);document.documentElement.removeAttribute('class');}functionmarkError(text){markComplete('Error: '+text);}functionmarkTimedOut(){markError('Timed out waiting on test completion.');}functionrunFrame(gl,frameCount,maxFrameCount){renderFrame(gl);frameCount++;if(frameCount>=maxFrameCount){console.log('Rendered '+frameCount+' frames.');markComplete();return;}requestAnimationFrame(function(){runFrame(gl,frameCount,maxFrameCount);});}functionrunTest(){varcanvas=document.getElementById('canvas');varoffscreenCanvas=canvas.transferControlToOffscreen();vargl=initGL(offscreenCanvas);if(!gl){markError('WebGL context creation failed.');return;}varmaxFrameCount=arg('frame',1);if(maxFrameCount<1){markError('Invalid `frame` arg: '+maxFrameCount);return;}setStatus('Waiting...');runFrame(gl,0,maxFrameCount);setTimeout(markTimedOut,TIMEOUT_MS);}</script></head><bodyonload='runTest();'><canvasid='canvas'width='200'height='200'></canvas><divid='status'></div></body></html>