wingman-jr-addon / wingman_jr

This is the official repository (https://github.com/wingman-jr-addon/wingman_jr) for the Wingman Jr. Firefox addon, which filters NSFW images in the browser fully client-side: https://addons.mozilla.org/en-US/firefox/addon/wingman-jr-filter/ Optional DNS-blocking using Cloudflare's 1.1.1.1 for families! Also, check out the blog!
https://wingman-jr.blogspot.com/
Other
35 stars 6 forks source link

Timing info variable capture not working reliably in private mode #180

Closed wingman-jr-addon closed 1 year ago

wingman-jr-addon commented 1 year ago

I believe this is the true root cause for the user report #178 and #179 . The following code was cause sqrxScore to sometimes not be assigned in private mode, which would then cause filtering to not engage.

                let sqrxrScore;
                if(PROC_timingInfoDumpCount<10) {
                    PROC_timingInfoDumpCount++;
                    let timingInfo = await tf.time(async ()=>sqrxrScore=await procPredict(img));
                    WJR_DEBUG && console.debug('PERF: TIMING NORMAL: '+JSON.stringify(timingInfo));
                } else {
                    sqrxrScore = await procPredict(img);
                }

Something about trying to set the function local variable inside the lambda seemed to be not working. Fortunately, this code is not really necessary and can be removed.