From ce5b7ba0baa02d415887683021a5305110c86d25 Mon Sep 17 00:00:00 2001 From: n9k Date: Mon, 7 Mar 2022 03:19:44 +0000 Subject: [PATCH] Fix js memory leak Already existing tripcode css rules were being re-inserted because of a typo. --- anonstream/static/anonstream.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anonstream/static/anonstream.js b/anonstream/static/anonstream.js index c20c303..474ecf1 100644 --- a/anonstream/static/anonstream.js +++ b/anonstream/static/anonstream.js @@ -313,26 +313,26 @@ const update_user_tripcodes = (token_hash=null) => { for (const this_token_hash of token_hashes) { const tripcode = users[this_token_hash].tripcode; if (tripcode === null) { - if (!to_ignore_display.has(token_hash)) { + if (!to_ignore_display.has(this_token_hash)) { stylesheet_tripcode_display.insertRule( `[data-token-hash="${this_token_hash}"] > .for-tripcode { display: none; }`, stylesheet_tripcode_display.cssRules.length, ); } - if (!to_ignore_colors.has(token_hash)) { + if (!to_ignore_colors.has(this_token_hash)) { stylesheet_tripcode_colors.insertRule( `[data-token-hash="${this_token_hash}"] > .tripcode { background-color: initial; color: initial; }`, stylesheet_tripcode_colors.cssRules.length, ); } } else { - if (!to_ignore_display.has(token_hash)) { + if (!to_ignore_display.has(this_token_hash)) { stylesheet_tripcode_display.insertRule( `[data-token-hash="${this_token_hash}"] > .for-tripcode { display: inline; }`, stylesheet_tripcode_display.cssRules.length, ); } - if (!to_ignore_colors.has(token_hash)) { + if (!to_ignore_colors.has(this_token_hash)) { stylesheet_tripcode_colors.insertRule( `[data-token-hash="${this_token_hash}"] > .tripcode { background-color: ${tripcode.background_color}; color: ${tripcode.foreground_color}; }`, stylesheet_tripcode_colors.cssRules.length,